2015-10-08 21:15:14 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2018-05-11 19:43:49 +00:00
|
|
|
*
|
|
|
|
* @format
|
2015-10-08 21:15:14 +00:00
|
|
|
*/
|
2018-05-11 19:43:49 +00:00
|
|
|
|
2015-10-08 21:15:14 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-26 19:59:54 +00:00
|
|
|
const launchEditor = require('../util/launchEditor');
|
2015-10-08 21:15:14 +00:00
|
|
|
|
2016-11-28 20:40:11 +00:00
|
|
|
module.exports = function({projectRoots}) {
|
2016-06-21 17:45:44 +00:00
|
|
|
return function(req, res, next) {
|
|
|
|
if (req.url === '/open-stack-frame') {
|
2016-11-28 20:40:11 +00:00
|
|
|
const frame = JSON.parse(req.rawBody);
|
|
|
|
launchEditor(frame.file, frame.lineNumber, projectRoots);
|
2016-06-21 17:45:44 +00:00
|
|
|
res.end('OK');
|
|
|
|
} else {
|
|
|
|
next();
|
|
|
|
}
|
|
|
|
};
|
2015-10-08 21:15:14 +00:00
|
|
|
};
|