first commit
This commit is contained in:
34
build/node_modules/prepack/lib/debugger/Breakpoint.js
generated
vendored
Normal file
34
build/node_modules/prepack/lib/debugger/Breakpoint.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
/**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var Breakpoint = exports.Breakpoint = function Breakpoint(filePath, line) {
|
||||
var column = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
var temporary = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||||
var enabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
||||
|
||||
_classCallCheck(this, Breakpoint);
|
||||
|
||||
this.filePath = filePath;
|
||||
this.line = line;
|
||||
this.temporary = temporary;
|
||||
this.enabled = enabled;
|
||||
this.column = column;
|
||||
}
|
||||
|
||||
//real breakpoint set by client or temporary one set by debugger
|
||||
;
|
||||
//# sourceMappingURL=Breakpoint.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/Breakpoint.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/Breakpoint.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/debugger/Breakpoint.js"],"names":["Breakpoint","filePath","line","column","temporary","enabled"],"mappings":";;;;;;;;AAAA;;;;;;;;;IAWaA,U,WAAAA,U,GACX,oBAAYC,QAAZ,EAA8BC,IAA9B,EAAqH;AAAA,MAAzEC,MAAyE,uEAAxD,CAAwD;AAAA,MAArDC,SAAqD,uEAAhC,KAAgC;AAAA,MAAzBC,OAAyB,uEAAN,IAAM;;AAAA;;AACnH,OAAKJ,QAAL,GAAgBA,QAAhB;AACA,OAAKC,IAAL,GAAYA,IAAZ;AACA,OAAKE,SAAL,GAAiBA,SAAjB;AACA,OAAKC,OAAL,GAAeA,OAAf;AACA,OAAKF,MAAL,GAAcA,MAAd;AACD;;AAKD","file":"Breakpoint.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nexport class Breakpoint {\n constructor(filePath: string, line: number, column: number = 0, temporary: boolean = false, enabled: boolean = true) {\n this.filePath = filePath;\n this.line = line;\n this.temporary = temporary;\n this.enabled = enabled;\n this.column = column;\n }\n filePath: string;\n line: number;\n column: number;\n\n //real breakpoint set by client or temporary one set by debugger\n temporary: boolean;\n enabled: boolean;\n}\n"]}
|
||||
84
build/node_modules/prepack/lib/debugger/BreakpointCollection.js
generated
vendored
Normal file
84
build/node_modules/prepack/lib/debugger/BreakpointCollection.js
generated
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.BreakpointCollection = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _PerFileBreakpointMap = require("./PerFileBreakpointMap.js");
|
||||
|
||||
var _Breakpoint = require("./Breakpoint.js");
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
// Storing BreakpointStores for all source files
|
||||
var BreakpointCollection = exports.BreakpointCollection = function () {
|
||||
function BreakpointCollection() {
|
||||
_classCallCheck(this, BreakpointCollection);
|
||||
|
||||
this.breakpointMaps = new Map();
|
||||
}
|
||||
|
||||
_createClass(BreakpointCollection, [{
|
||||
key: "addBreakpoint",
|
||||
value: function addBreakpoint(filePath, lineNum) {
|
||||
var columnNum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
|
||||
if (!(filePath in this.breakpointMaps)) {
|
||||
this.breakpointMaps[filePath] = new _PerFileBreakpointMap.PerFileBreakpointMap(filePath);
|
||||
}
|
||||
var breakpointMap = this.breakpointMaps[filePath];
|
||||
breakpointMap.addBreakpoint(lineNum, columnNum);
|
||||
}
|
||||
}, {
|
||||
key: "getBreakpoint",
|
||||
value: function getBreakpoint(filePath, lineNum) {
|
||||
var columnNum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
|
||||
if (filePath in this.breakpointMaps) {
|
||||
var breakpointMap = this.breakpointMaps[filePath];
|
||||
return breakpointMap.getBreakpoint(lineNum, columnNum);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}, {
|
||||
key: "removeBreakpoint",
|
||||
value: function removeBreakpoint(filePath, lineNum) {
|
||||
var columnNum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
|
||||
if (filePath in this.breakpointMaps) {
|
||||
this.breakpointMaps[filePath].removeBreakpoint(lineNum, columnNum);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "enableBreakpoint",
|
||||
value: function enableBreakpoint(filePath, lineNum) {
|
||||
var columnNum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
|
||||
if (filePath in this.breakpointMaps) {
|
||||
this.breakpointMaps[filePath].enableBreakpoint(lineNum, columnNum);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "disableBreakpoint",
|
||||
value: function disableBreakpoint(filePath, lineNum) {
|
||||
var columnNum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
|
||||
if (filePath in this.breakpointMaps) {
|
||||
this.breakpointMaps[filePath].disableBreakpoint(lineNum, columnNum);
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return BreakpointCollection;
|
||||
}();
|
||||
//# sourceMappingURL=BreakpointCollection.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/BreakpointCollection.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/BreakpointCollection.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/debugger/BreakpointCollection.js"],"names":["BreakpointCollection","breakpointMaps","Map","filePath","lineNum","columnNum","breakpointMap","addBreakpoint","getBreakpoint","undefined","removeBreakpoint","enableBreakpoint","disableBreakpoint"],"mappings":";;;;;;;qjBAAA;;;;;;;;;AAWA;;AACA;;;;AAEA;IACaA,oB,WAAAA,oB;AACX,kCAAc;AAAA;;AACZ,SAAKC,cAAL,GAAsB,IAAIC,GAAJ,EAAtB;AACD;;;;kCAGaC,Q,EAAkBC,O,EAAwC;AAAA,UAAvBC,SAAuB,uEAAH,CAAG;;AACtE,UAAI,EAAEF,YAAY,KAAKF,cAAnB,CAAJ,EAAwC;AACtC,aAAKA,cAAL,CAAoBE,QAApB,IAAgC,+CAAyBA,QAAzB,CAAhC;AACD;AACD,UAAIG,gBAAgB,KAAKL,cAAL,CAAoBE,QAApB,CAApB;AACAG,oBAAcC,aAAd,CAA4BH,OAA5B,EAAqCC,SAArC;AACD;;;kCAEaF,Q,EAAkBC,O,EAA2D;AAAA,UAA1CC,SAA0C,uEAAtB,CAAsB;;AACzF,UAAIF,YAAY,KAAKF,cAArB,EAAqC;AACnC,YAAIK,gBAAgB,KAAKL,cAAL,CAAoBE,QAApB,CAApB;AACA,eAAOG,cAAcE,aAAd,CAA4BJ,OAA5B,EAAqCC,SAArC,CAAP;AACD;AACD,aAAOI,SAAP;AACD;;;qCAEgBN,Q,EAAkBC,O,EAAwC;AAAA,UAAvBC,SAAuB,uEAAH,CAAG;;AACzE,UAAIF,YAAY,KAAKF,cAArB,EAAqC;AACnC,aAAKA,cAAL,CAAoBE,QAApB,EAA8BO,gBAA9B,CAA+CN,OAA/C,EAAwDC,SAAxD;AACD;AACF;;;qCAEgBF,Q,EAAkBC,O,EAAwC;AAAA,UAAvBC,SAAuB,uEAAH,CAAG;;AACzE,UAAIF,YAAY,KAAKF,cAArB,EAAqC;AACnC,aAAKA,cAAL,CAAoBE,QAApB,EAA8BQ,gBAA9B,CAA+CP,OAA/C,EAAwDC,SAAxD;AACD;AACF;;;sCAEiBF,Q,EAAkBC,O,EAAwC;AAAA,UAAvBC,SAAuB,uEAAH,CAAG;;AAC1E,UAAIF,YAAY,KAAKF,cAArB,EAAqC;AACnC,aAAKA,cAAL,CAAoBE,QAApB,EAA8BS,iBAA9B,CAAgDR,OAAhD,EAAyDC,SAAzD;AACD;AACF","file":"BreakpointCollection.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport { PerFileBreakpointMap } from \"./PerFileBreakpointMap.js\";\nimport { Breakpoint } from \"./Breakpoint.js\";\n\n// Storing BreakpointStores for all source files\nexport class BreakpointCollection {\n constructor() {\n this.breakpointMaps = new Map();\n }\n breakpointMaps: { [string]: PerFileBreakpointMap };\n\n addBreakpoint(filePath: string, lineNum: number, columnNum: number = 0) {\n if (!(filePath in this.breakpointMaps)) {\n this.breakpointMaps[filePath] = new PerFileBreakpointMap(filePath);\n }\n let breakpointMap = this.breakpointMaps[filePath];\n breakpointMap.addBreakpoint(lineNum, columnNum);\n }\n\n getBreakpoint(filePath: string, lineNum: number, columnNum: number = 0): void | Breakpoint {\n if (filePath in this.breakpointMaps) {\n let breakpointMap = this.breakpointMaps[filePath];\n return breakpointMap.getBreakpoint(lineNum, columnNum);\n }\n return undefined;\n }\n\n removeBreakpoint(filePath: string, lineNum: number, columnNum: number = 0) {\n if (filePath in this.breakpointMaps) {\n this.breakpointMaps[filePath].removeBreakpoint(lineNum, columnNum);\n }\n }\n\n enableBreakpoint(filePath: string, lineNum: number, columnNum: number = 0) {\n if (filePath in this.breakpointMaps) {\n this.breakpointMaps[filePath].enableBreakpoint(lineNum, columnNum);\n }\n }\n\n disableBreakpoint(filePath: string, lineNum: number, columnNum: number = 0) {\n if (filePath in this.breakpointMaps) {\n this.breakpointMaps[filePath].disableBreakpoint(lineNum, columnNum);\n }\n }\n}\n"]}
|
||||
124
build/node_modules/prepack/lib/debugger/BreakpointManager.js
generated
vendored
Normal file
124
build/node_modules/prepack/lib/debugger/BreakpointManager.js
generated
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.BreakpointManager = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _PerFileBreakpointMap = require("./PerFileBreakpointMap.js");
|
||||
|
||||
var _Breakpoint = require("./Breakpoint.js");
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
// Storing BreakpointStores for all source files
|
||||
var BreakpointManager = exports.BreakpointManager = function () {
|
||||
function BreakpointManager() {
|
||||
_classCallCheck(this, BreakpointManager);
|
||||
|
||||
this._breakpointMaps = new Map();
|
||||
}
|
||||
|
||||
_createClass(BreakpointManager, [{
|
||||
key: "addBreakpointMulti",
|
||||
value: function addBreakpointMulti(breakpoints) {
|
||||
this._doBreakpointsAction(breakpoints, this._addBreakpoint.bind(this));
|
||||
}
|
||||
}, {
|
||||
key: "_addBreakpoint",
|
||||
value: function _addBreakpoint(bp) {
|
||||
if (!(bp.filePath in this._breakpointMaps)) {
|
||||
this._breakpointMaps[bp.filePath] = new _PerFileBreakpointMap.PerFileBreakpointMap(bp.filePath);
|
||||
}
|
||||
var breakpointMap = this._breakpointMaps[bp.filePath];
|
||||
breakpointMap.addBreakpoint(bp.line, bp.column);
|
||||
}
|
||||
}, {
|
||||
key: "getBreakpoint",
|
||||
value: function getBreakpoint(filePath, lineNum) {
|
||||
var columnNum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
|
||||
if (filePath in this._breakpointMaps) {
|
||||
var breakpointMap = this._breakpointMaps[filePath];
|
||||
return breakpointMap.getBreakpoint(lineNum, columnNum);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}, {
|
||||
key: "removeBreakpointMulti",
|
||||
value: function removeBreakpointMulti(breakpoints) {
|
||||
this._doBreakpointsAction(breakpoints, this._removeBreakpoint.bind(this));
|
||||
}
|
||||
}, {
|
||||
key: "_removeBreakpoint",
|
||||
value: function _removeBreakpoint(bp) {
|
||||
if (bp.filePath in this._breakpointMaps) {
|
||||
this._breakpointMaps[bp.filePath].removeBreakpoint(bp.line, bp.column);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "enableBreakpointMulti",
|
||||
value: function enableBreakpointMulti(breakpoints) {
|
||||
this._doBreakpointsAction(breakpoints, this._enableBreakpoint.bind(this));
|
||||
}
|
||||
}, {
|
||||
key: "_enableBreakpoint",
|
||||
value: function _enableBreakpoint(bp) {
|
||||
if (bp.filePath in this._breakpointMaps) {
|
||||
this._breakpointMaps[bp.filePath].enableBreakpoint(bp.line, bp.column);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "disableBreakpointMulti",
|
||||
value: function disableBreakpointMulti(breakpoints) {
|
||||
this._doBreakpointsAction(breakpoints, this._disableBreakpoint.bind(this));
|
||||
}
|
||||
}, {
|
||||
key: "_disableBreakpoint",
|
||||
value: function _disableBreakpoint(bp) {
|
||||
if (bp.filePath in this._breakpointMaps) {
|
||||
this._breakpointMaps[bp.filePath].disableBreakpoint(bp.line, bp.column);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_doBreakpointsAction",
|
||||
value: function _doBreakpointsAction(breakpoints, action) {
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = breakpoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var bp = _step.value;
|
||||
|
||||
action(bp);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return BreakpointManager;
|
||||
}();
|
||||
//# sourceMappingURL=BreakpointManager.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/BreakpointManager.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/BreakpointManager.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/debugger/BreakpointManager.js"],"names":["BreakpointManager","_breakpointMaps","Map","breakpoints","_doBreakpointsAction","_addBreakpoint","bind","bp","filePath","breakpointMap","addBreakpoint","line","column","lineNum","columnNum","getBreakpoint","undefined","_removeBreakpoint","removeBreakpoint","_enableBreakpoint","enableBreakpoint","_disableBreakpoint","disableBreakpoint","action"],"mappings":";;;;;;;qjBAAA;;;;;;;;;AAWA;;AACA;;;;AAGA;IACaA,iB,WAAAA,iB;AACX,+BAAc;AAAA;;AACZ,SAAKC,eAAL,GAAuB,IAAIC,GAAJ,EAAvB;AACD;;;;uCAGkBC,W,EAAoC;AACrD,WAAKC,oBAAL,CAA0BD,WAA1B,EAAuC,KAAKE,cAAL,CAAoBC,IAApB,CAAyB,IAAzB,CAAvC;AACD;;;mCAEcC,E,EAAoB;AACjC,UAAI,EAAEA,GAAGC,QAAH,IAAe,KAAKP,eAAtB,CAAJ,EAA4C;AAC1C,aAAKA,eAAL,CAAqBM,GAAGC,QAAxB,IAAoC,+CAAyBD,GAAGC,QAA5B,CAApC;AACD;AACD,UAAIC,gBAAgB,KAAKR,eAAL,CAAqBM,GAAGC,QAAxB,CAApB;AACAC,oBAAcC,aAAd,CAA4BH,GAAGI,IAA/B,EAAqCJ,GAAGK,MAAxC;AACD;;;kCAEaJ,Q,EAAkBK,O,EAA2D;AAAA,UAA1CC,SAA0C,uEAAtB,CAAsB;;AACzF,UAAIN,YAAY,KAAKP,eAArB,EAAsC;AACpC,YAAIQ,gBAAgB,KAAKR,eAAL,CAAqBO,QAArB,CAApB;AACA,eAAOC,cAAcM,aAAd,CAA4BF,OAA5B,EAAqCC,SAArC,CAAP;AACD;AACD,aAAOE,SAAP;AACD;;;0CAEqBb,W,EAAoC;AACxD,WAAKC,oBAAL,CAA0BD,WAA1B,EAAuC,KAAKc,iBAAL,CAAuBX,IAAvB,CAA4B,IAA5B,CAAvC;AACD;;;sCAEiBC,E,EAAoB;AACpC,UAAIA,GAAGC,QAAH,IAAe,KAAKP,eAAxB,EAAyC;AACvC,aAAKA,eAAL,CAAqBM,GAAGC,QAAxB,EAAkCU,gBAAlC,CAAmDX,GAAGI,IAAtD,EAA4DJ,GAAGK,MAA/D;AACD;AACF;;;0CAEqBT,W,EAAoC;AACxD,WAAKC,oBAAL,CAA0BD,WAA1B,EAAuC,KAAKgB,iBAAL,CAAuBb,IAAvB,CAA4B,IAA5B,CAAvC;AACD;;;sCAEiBC,E,EAAoB;AACpC,UAAIA,GAAGC,QAAH,IAAe,KAAKP,eAAxB,EAAyC;AACvC,aAAKA,eAAL,CAAqBM,GAAGC,QAAxB,EAAkCY,gBAAlC,CAAmDb,GAAGI,IAAtD,EAA4DJ,GAAGK,MAA/D;AACD;AACF;;;2CAEsBT,W,EAAoC;AACzD,WAAKC,oBAAL,CAA0BD,WAA1B,EAAuC,KAAKkB,kBAAL,CAAwBf,IAAxB,CAA6B,IAA7B,CAAvC;AACD;;;uCAEkBC,E,EAAoB;AACrC,UAAIA,GAAGC,QAAH,IAAe,KAAKP,eAAxB,EAAyC;AACvC,aAAKA,eAAL,CAAqBM,GAAGC,QAAxB,EAAkCc,iBAAlC,CAAoDf,GAAGI,IAAvD,EAA6DJ,GAAGK,MAAhE;AACD;AACF;;;yCAEoBT,W,EAAoCoB,M,EAAgC;AAAA;AAAA;AAAA;;AAAA;AACvF,6BAAepB,WAAf,8HAA4B;AAAA,cAAnBI,EAAmB;;AAC1BgB,iBAAOhB,EAAP;AACD;AAHsF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIxF","file":"BreakpointManager.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport { PerFileBreakpointMap } from \"./PerFileBreakpointMap.js\";\nimport { Breakpoint } from \"./Breakpoint.js\";\nimport type { Breakpoint as BreakpointType } from \"./types.js\";\n\n// Storing BreakpointStores for all source files\nexport class BreakpointManager {\n constructor() {\n this._breakpointMaps = new Map();\n }\n _breakpointMaps: { [string]: PerFileBreakpointMap };\n\n addBreakpointMulti(breakpoints: Array<BreakpointType>) {\n this._doBreakpointsAction(breakpoints, this._addBreakpoint.bind(this));\n }\n\n _addBreakpoint(bp: BreakpointType) {\n if (!(bp.filePath in this._breakpointMaps)) {\n this._breakpointMaps[bp.filePath] = new PerFileBreakpointMap(bp.filePath);\n }\n let breakpointMap = this._breakpointMaps[bp.filePath];\n breakpointMap.addBreakpoint(bp.line, bp.column);\n }\n\n getBreakpoint(filePath: string, lineNum: number, columnNum: number = 0): void | Breakpoint {\n if (filePath in this._breakpointMaps) {\n let breakpointMap = this._breakpointMaps[filePath];\n return breakpointMap.getBreakpoint(lineNum, columnNum);\n }\n return undefined;\n }\n\n removeBreakpointMulti(breakpoints: Array<BreakpointType>) {\n this._doBreakpointsAction(breakpoints, this._removeBreakpoint.bind(this));\n }\n\n _removeBreakpoint(bp: BreakpointType) {\n if (bp.filePath in this._breakpointMaps) {\n this._breakpointMaps[bp.filePath].removeBreakpoint(bp.line, bp.column);\n }\n }\n\n enableBreakpointMulti(breakpoints: Array<BreakpointType>) {\n this._doBreakpointsAction(breakpoints, this._enableBreakpoint.bind(this));\n }\n\n _enableBreakpoint(bp: BreakpointType) {\n if (bp.filePath in this._breakpointMaps) {\n this._breakpointMaps[bp.filePath].enableBreakpoint(bp.line, bp.column);\n }\n }\n\n disableBreakpointMulti(breakpoints: Array<BreakpointType>) {\n this._doBreakpointsAction(breakpoints, this._disableBreakpoint.bind(this));\n }\n\n _disableBreakpoint(bp: BreakpointType) {\n if (bp.filePath in this._breakpointMaps) {\n this._breakpointMaps[bp.filePath].disableBreakpoint(bp.line, bp.column);\n }\n }\n\n _doBreakpointsAction(breakpoints: Array<BreakpointType>, action: BreakpointType => void) {\n for (let bp of breakpoints) {\n action(bp);\n }\n }\n}\n"]}
|
||||
294
build/node_modules/prepack/lib/debugger/Debugger.js
generated
vendored
Normal file
294
build/node_modules/prepack/lib/debugger/Debugger.js
generated
vendored
Normal file
@@ -0,0 +1,294 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DebugServer = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _BreakpointManager = require("./BreakpointManager.js");
|
||||
|
||||
var _Breakpoint = require("./Breakpoint.js");
|
||||
|
||||
var _invariant = require("../invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _DebugMessage = require("./channel/DebugMessage.js");
|
||||
|
||||
var _DebuggerError = require("./DebuggerError.js");
|
||||
|
||||
var _realm = require("./../realm.js");
|
||||
|
||||
var _VariableManager = require("./VariableManager.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var DebugServer = exports.DebugServer = function () {
|
||||
function DebugServer(channel, realm) {
|
||||
_classCallCheck(this, DebugServer);
|
||||
|
||||
this._breakpoints = new _BreakpointManager.BreakpointManager();
|
||||
this._previousExecutedLine = 0;
|
||||
this._previousExecutedCol = 0;
|
||||
this._lastRunRequestID = 0;
|
||||
this._channel = channel;
|
||||
this._realm = realm;
|
||||
this._variableManager = new _VariableManager.VariableManager(realm);
|
||||
this.waitForRun();
|
||||
}
|
||||
// the collection of breakpoints
|
||||
|
||||
// the channel to communicate with the adapter
|
||||
|
||||
|
||||
_createClass(DebugServer, [{
|
||||
key: "waitForRun",
|
||||
|
||||
/* Block until adapter says to run
|
||||
/* ast: the current ast node we are stopped on
|
||||
*/
|
||||
value: function waitForRun(ast) {
|
||||
var keepRunning = false;
|
||||
var request = void 0;
|
||||
while (!keepRunning) {
|
||||
request = this._channel.readIn();
|
||||
keepRunning = this.processDebuggerCommand(request, ast);
|
||||
}
|
||||
}
|
||||
|
||||
// Checking if the debugger needs to take any action on reaching this ast node
|
||||
|
||||
}, {
|
||||
key: "checkForActions",
|
||||
value: function checkForActions(ast) {
|
||||
this.checkForBreakpoint(ast);
|
||||
|
||||
// last step: set the current location as the previously executed line
|
||||
if (ast.loc && ast.loc.source !== null) {
|
||||
this._previousExecutedFile = ast.loc.source;
|
||||
this._previousExecutedLine = ast.loc.start.line;
|
||||
this._previousExecutedCol = ast.loc.start.column;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to find a breakpoint at the given location and check if we should stop on it
|
||||
|
||||
}, {
|
||||
key: "findStoppableBreakpoint",
|
||||
value: function findStoppableBreakpoint(filePath, lineNum, colNum) {
|
||||
var breakpoint = this._breakpoints.getBreakpoint(filePath, lineNum, colNum);
|
||||
if (breakpoint && breakpoint.enabled) {
|
||||
// checking if this is the same file and line we stopped at last time
|
||||
// if so, we should skip it this time
|
||||
// Note: for the case when the debugger is supposed to stop on the same
|
||||
// breakpoint consecutively (e.g. the statement is in a loop), some other
|
||||
// ast node (e.g. block, loop) must have been checked in between so
|
||||
// previousExecutedFile and previousExecutedLine will have changed
|
||||
if (breakpoint.column !== 0) {
|
||||
// this is a column breakpoint
|
||||
if (filePath === this._previousExecutedFile && lineNum === this._previousExecutedLine && colNum === this._previousExecutedCol) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
// this is a line breakpoint
|
||||
if (filePath === this._previousExecutedFile && lineNum === this._previousExecutedLine) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return breakpoint;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, {
|
||||
key: "checkForBreakpoint",
|
||||
value: function checkForBreakpoint(ast) {
|
||||
if (ast.loc && ast.loc.source) {
|
||||
var location = ast.loc;
|
||||
var filePath = location.source;
|
||||
if (filePath === null) return;
|
||||
var lineNum = location.start.line;
|
||||
var colNum = location.start.column;
|
||||
// Check whether there is a breakpoint we need to stop on here
|
||||
var breakpoint = this.findStoppableBreakpoint(filePath, lineNum, colNum);
|
||||
if (breakpoint === null) return;
|
||||
// Tell the adapter that Prepack has stopped on this breakpoint
|
||||
this._channel.sendBreakpointStopped(breakpoint.filePath, breakpoint.line, breakpoint.column);
|
||||
// Wait for the adapter to tell us to run again
|
||||
this.waitForRun(ast);
|
||||
}
|
||||
}
|
||||
|
||||
// Process a command from a debugger. Returns whether Prepack should unblock
|
||||
// if it is blocked
|
||||
|
||||
}, {
|
||||
key: "processDebuggerCommand",
|
||||
value: function processDebuggerCommand(request, ast) {
|
||||
var requestID = request.id;
|
||||
var command = request.command;
|
||||
var args = request.arguments;
|
||||
switch (command) {
|
||||
case _DebugMessage.DebugMessage.BREAKPOINT_ADD_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "breakpoint");
|
||||
this._breakpoints.addBreakpointMulti(args.breakpoints);
|
||||
this._channel.sendBreakpointsAcknowledge(_DebugMessage.DebugMessage.BREAKPOINT_ADD_ACKNOWLEDGE, requestID, args);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.BREAKPOINT_REMOVE_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "breakpoint");
|
||||
this._breakpoints.removeBreakpointMulti(args.breakpoints);
|
||||
this._channel.sendBreakpointsAcknowledge(_DebugMessage.DebugMessage.BREAKPOINT_REMOVE_ACKNOWLEDGE, requestID, args);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.BREAKPOINT_ENABLE_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "breakpoint");
|
||||
this._breakpoints.enableBreakpointMulti(args.breakpoints);
|
||||
this._channel.sendBreakpointsAcknowledge(_DebugMessage.DebugMessage.BREAKPOINT_ENABLE_ACKNOWLEDGE, requestID, args);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.BREAKPOINT_DISABLE_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "breakpoint");
|
||||
this._breakpoints.disableBreakpointMulti(args.breakpoints);
|
||||
this._channel.sendBreakpointsAcknowledge(_DebugMessage.DebugMessage.BREAKPOINT_DISABLE_ACKNOWLEDGE, requestID, args);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.PREPACK_RUN_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "run");
|
||||
this._onDebuggeeResume();
|
||||
return true;
|
||||
case _DebugMessage.DebugMessage.STACKFRAMES_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "stackframe");
|
||||
(0, _invariant2.default)(ast !== undefined);
|
||||
this.processStackframesCommand(requestID, args, ast);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.SCOPES_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "scopes");
|
||||
this.processScopesCommand(requestID, args);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.VARIABLES_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "variables");
|
||||
this.processVariablesCommand(requestID, args);
|
||||
break;
|
||||
default:
|
||||
throw new _DebuggerError.DebuggerError("Invalid command", "Invalid command from adapter: " + command);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
key: "processStackframesCommand",
|
||||
value: function processStackframesCommand(requestID, args, ast) {
|
||||
var frameInfos = [];
|
||||
var loc = this._getFrameLocation(ast.loc);
|
||||
var fileName = loc.fileName;
|
||||
var line = loc.line;
|
||||
var column = loc.column;
|
||||
|
||||
// the UI displays the current frame as index 0, so we iterate backwards
|
||||
// from the current frame
|
||||
for (var i = this._realm.contextStack.length - 1; i >= 0; i--) {
|
||||
var frame = this._realm.contextStack[i];
|
||||
var functionName = "(anonymous function)";
|
||||
if (frame.function && frame.function.__originalName) {
|
||||
functionName = frame.function.__originalName;
|
||||
}
|
||||
|
||||
var frameInfo = {
|
||||
id: this._realm.contextStack.length - 1 - i,
|
||||
functionName: functionName,
|
||||
fileName: fileName,
|
||||
line: line,
|
||||
column: column
|
||||
};
|
||||
frameInfos.push(frameInfo);
|
||||
loc = this._getFrameLocation(frame.loc);
|
||||
fileName = loc.fileName;
|
||||
line = loc.line;
|
||||
column = loc.column;
|
||||
}
|
||||
this._channel.sendStackframeResponse(requestID, frameInfos);
|
||||
}
|
||||
}, {
|
||||
key: "_getFrameLocation",
|
||||
value: function _getFrameLocation(loc) {
|
||||
var fileName = "unknown";
|
||||
var line = 0;
|
||||
var column = 0;
|
||||
if (loc && loc.source) {
|
||||
fileName = loc.source;
|
||||
line = loc.start.line;
|
||||
column = loc.start.column;
|
||||
}
|
||||
return {
|
||||
fileName: fileName,
|
||||
line: line,
|
||||
column: column
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "processScopesCommand",
|
||||
value: function processScopesCommand(requestID, args) {
|
||||
// first check that frameId is in the valid range
|
||||
if (args.frameId < 0 || args.frameId >= this._realm.contextStack.length) {
|
||||
throw new _DebuggerError.DebuggerError("Invalid command", "Invalid frame id for scopes request: " + args.frameId);
|
||||
}
|
||||
// here the frameId is in reverse order of the contextStack, ie frameId 0
|
||||
// refers to last element of contextStack
|
||||
var stackIndex = this._realm.contextStack.length - 1 - args.frameId;
|
||||
var context = this._realm.contextStack[stackIndex];
|
||||
(0, _invariant2.default)(context instanceof _realm.ExecutionContext);
|
||||
var scopes = [];
|
||||
if (context.variableEnvironment) {
|
||||
// get a new mapping for this collection of variables
|
||||
var variableRef = this._variableManager.getReferenceForValue(context.variableEnvironment);
|
||||
var scope = {
|
||||
name: "Locals",
|
||||
variablesReference: variableRef,
|
||||
expensive: false
|
||||
};
|
||||
scopes.push(scope);
|
||||
}
|
||||
if (context.lexicalEnvironment) {
|
||||
// get a new mapping for this collection of variables
|
||||
var _variableRef = this._variableManager.getReferenceForValue(context.lexicalEnvironment);
|
||||
var _scope = {
|
||||
name: "Globals",
|
||||
variablesReference: _variableRef,
|
||||
expensive: false
|
||||
};
|
||||
scopes.push(_scope);
|
||||
}
|
||||
this._channel.sendScopesResponse(requestID, scopes);
|
||||
}
|
||||
}, {
|
||||
key: "processVariablesCommand",
|
||||
value: function processVariablesCommand(requestID, args) {
|
||||
var variables = this._variableManager.getVariablesByReference(args.variablesReference);
|
||||
this._channel.sendVariablesResponse(requestID, variables);
|
||||
}
|
||||
|
||||
// actions that need to happen before Prepack can resume
|
||||
|
||||
}, {
|
||||
key: "_onDebuggeeResume",
|
||||
value: function _onDebuggeeResume() {
|
||||
// resets the variable manager
|
||||
this._variableManager.clean();
|
||||
}
|
||||
}, {
|
||||
key: "shutdown",
|
||||
value: function shutdown() {
|
||||
//let the adapter know Prepack is done running
|
||||
this._channel.sendPrepackFinish();
|
||||
}
|
||||
}]);
|
||||
|
||||
return DebugServer;
|
||||
}();
|
||||
//# sourceMappingURL=Debugger.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/Debugger.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/Debugger.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
24
build/node_modules/prepack/lib/debugger/DebuggerConstants.js
generated
vendored
Normal file
24
build/node_modules/prepack/lib/debugger/DebuggerConstants.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
/**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var DebuggerConstants = exports.DebuggerConstants = function DebuggerConstants() {
|
||||
_classCallCheck(this, DebuggerConstants);
|
||||
};
|
||||
|
||||
DebuggerConstants.DEFAULT_REQUEST_ID = 0;
|
||||
DebuggerConstants.PREPACK_THREAD_ID = 1;
|
||||
//# sourceMappingURL=DebuggerConstants.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/DebuggerConstants.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/DebuggerConstants.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/debugger/DebuggerConstants.js"],"names":["DebuggerConstants","DEFAULT_REQUEST_ID","PREPACK_THREAD_ID"],"mappings":";;;;;;;;AAAA;;;;;;;;;IAWaA,iB,WAAAA,iB;;;;AAAAA,iB,CAIJC,kB,GAA6B,C;AAJzBD,iB,CASJE,iB,GAA4B,C","file":"DebuggerConstants.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nexport class DebuggerConstants {\n // request ID used between the debug adapter and Prepack when there is no\n // corresponding command from the UI. Currently, this is only used on starting\n // up Prepack\n static DEFAULT_REQUEST_ID: number = 0;\n\n // some requests/responses require a thread ID according to vscode protocol\n // since Prepack only has 1 thread, we use this constant where a thread ID\n // is required\n static PREPACK_THREAD_ID: number = 1;\n}\n"]}
|
||||
24
build/node_modules/prepack/lib/debugger/DebuggerError.js
generated
vendored
Normal file
24
build/node_modules/prepack/lib/debugger/DebuggerError.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var DebuggerError = exports.DebuggerError = function DebuggerError(errorType, message) {
|
||||
_classCallCheck(this, DebuggerError);
|
||||
|
||||
this.errorType = errorType;
|
||||
this.message = message;
|
||||
}; /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
// More error types will be added as needed
|
||||
//# sourceMappingURL=DebuggerError.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/DebuggerError.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/DebuggerError.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/debugger/DebuggerError.js"],"names":["DebuggerError","errorType","message"],"mappings":";;;;;;;;IAcaA,a,WAAAA,a,GACX,uBAAYC,SAAZ,EAA0CC,OAA1C,EAA2D;AAAA;;AACzD,OAAKD,SAAL,GAAiBA,SAAjB;AACA,OAAKC,OAAL,GAAeA,OAAf;AACD,C,EAlBH;;;;;;;;;AAWA","file":"DebuggerError.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\n// More error types will be added as needed\nexport type DebuggerErrorType = \"Invalid command\" | \"Invalid response\";\n\nexport class DebuggerError {\n constructor(errorType: DebuggerErrorType, message: string) {\n this.errorType = errorType;\n this.message = message;\n }\n errorType: DebuggerErrorType;\n message: string;\n}\n"]}
|
||||
109
build/node_modules/prepack/lib/debugger/PerFileBreakpointMap.js
generated
vendored
Normal file
109
build/node_modules/prepack/lib/debugger/PerFileBreakpointMap.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.PerFileBreakpointMap = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _Breakpoint = require("./Breakpoint.js");
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
// Storage for all the breakpoints in one source file
|
||||
// Each source file will be associated with one PerFileBreakpointMap
|
||||
var PerFileBreakpointMap = exports.PerFileBreakpointMap = function () {
|
||||
function PerFileBreakpointMap(filePath) {
|
||||
_classCallCheck(this, PerFileBreakpointMap);
|
||||
|
||||
this.filePath = filePath;
|
||||
this.breakpoints = new Map();
|
||||
}
|
||||
|
||||
//map of line:column to Breakpoint objects
|
||||
|
||||
|
||||
_createClass(PerFileBreakpointMap, [{
|
||||
key: "addBreakpoint",
|
||||
value: function addBreakpoint(line) {
|
||||
var column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
var temporary = arguments[2];
|
||||
var enabled = arguments[3];
|
||||
|
||||
var breakpoint = new _Breakpoint.Breakpoint(this.filePath, line, column, temporary, enabled);
|
||||
var key = this._getKey(line, column);
|
||||
this.breakpoints[key] = breakpoint;
|
||||
}
|
||||
}, {
|
||||
key: "getBreakpoint",
|
||||
value: function getBreakpoint(line) {
|
||||
var column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
|
||||
//check for a column breakpoint first, then line breakpoint
|
||||
if (column !== 0) {
|
||||
var key = this._getKey(line, column);
|
||||
if (key in this.breakpoints) {
|
||||
return this.breakpoints[key];
|
||||
} else {
|
||||
key = this._getKey(line, 0);
|
||||
if (key in this.breakpoints) {
|
||||
return this.breakpoints[key];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var _key = this._getKey(line, 0);
|
||||
if (_key in this.breakpoints) {
|
||||
return this.breakpoints[_key];
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}, {
|
||||
key: "removeBreakpoint",
|
||||
value: function removeBreakpoint(line) {
|
||||
var column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
|
||||
var key = this._getKey(line, column);
|
||||
if (key in this.breakpoints) {
|
||||
delete this.breakpoints[key];
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "enableBreakpoint",
|
||||
value: function enableBreakpoint(line) {
|
||||
var column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
|
||||
var key = this._getKey(line, column);
|
||||
if (key in this.breakpoints) {
|
||||
this.breakpoints[key].enabled = true;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "disableBreakpoint",
|
||||
value: function disableBreakpoint(line) {
|
||||
var column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
|
||||
var key = this._getKey(line, column);
|
||||
if (key in this.breakpoints) {
|
||||
this.breakpoints[key].enabled = false;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_getKey",
|
||||
value: function _getKey(line, column) {
|
||||
return line + ":" + column;
|
||||
}
|
||||
}]);
|
||||
|
||||
return PerFileBreakpointMap;
|
||||
}();
|
||||
//# sourceMappingURL=PerFileBreakpointMap.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/PerFileBreakpointMap.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/PerFileBreakpointMap.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/debugger/PerFileBreakpointMap.js"],"names":["PerFileBreakpointMap","filePath","breakpoints","Map","line","column","temporary","enabled","breakpoint","key","_getKey","undefined"],"mappings":";;;;;;;qjBAAA;;;;;;;;;AAWA;;;;AAEA;AACA;IACaA,oB,WAAAA,oB;AACX,gCAAYC,QAAZ,EAA8B;AAAA;;AAC5B,SAAKA,QAAL,GAAgBA,QAAhB;AACA,SAAKC,WAAL,GAAmB,IAAIC,GAAJ,EAAnB;AACD;;AAGD;;;;;kCAGcC,I,EAA0E;AAAA,UAA5DC,MAA4D,uEAA3C,CAA2C;AAAA,UAAxCC,SAAwC;AAAA,UAAnBC,OAAmB;;AACtF,UAAIC,aAAa,2BAAe,KAAKP,QAApB,EAA8BG,IAA9B,EAAoCC,MAApC,EAA4CC,SAA5C,EAAuDC,OAAvD,CAAjB;AACA,UAAIE,MAAM,KAAKC,OAAL,CAAaN,IAAb,EAAmBC,MAAnB,CAAV;AACA,WAAKH,WAAL,CAAiBO,GAAjB,IAAwBD,UAAxB;AACD;;;kCAEaJ,I,EAAqD;AAAA,UAAvCC,MAAuC,uEAAtB,CAAsB;;AACjE;AACA,UAAIA,WAAW,CAAf,EAAkB;AAChB,YAAII,MAAM,KAAKC,OAAL,CAAaN,IAAb,EAAmBC,MAAnB,CAAV;AACA,YAAII,OAAO,KAAKP,WAAhB,EAA6B;AAC3B,iBAAO,KAAKA,WAAL,CAAiBO,GAAjB,CAAP;AACD,SAFD,MAEO;AACLA,gBAAM,KAAKC,OAAL,CAAaN,IAAb,EAAmB,CAAnB,CAAN;AACA,cAAIK,OAAO,KAAKP,WAAhB,EAA6B;AAC3B,mBAAO,KAAKA,WAAL,CAAiBO,GAAjB,CAAP;AACD;AACF;AACF,OAVD,MAUO;AACL,YAAIA,OAAM,KAAKC,OAAL,CAAaN,IAAb,EAAmB,CAAnB,CAAV;AACA,YAAIK,QAAO,KAAKP,WAAhB,EAA6B;AAC3B,iBAAO,KAAKA,WAAL,CAAiBO,IAAjB,CAAP;AACD;AACF;;AAED,aAAOE,SAAP;AACD;;;qCAEgBP,I,EAAkC;AAAA,UAApBC,MAAoB,uEAAH,CAAG;;AACjD,UAAII,MAAM,KAAKC,OAAL,CAAaN,IAAb,EAAmBC,MAAnB,CAAV;AACA,UAAII,OAAO,KAAKP,WAAhB,EAA6B;AAC3B,eAAO,KAAKA,WAAL,CAAiBO,GAAjB,CAAP;AACD;AACF;;;qCAEgBL,I,EAAkC;AAAA,UAApBC,MAAoB,uEAAH,CAAG;;AACjD,UAAII,MAAM,KAAKC,OAAL,CAAaN,IAAb,EAAmBC,MAAnB,CAAV;AACA,UAAII,OAAO,KAAKP,WAAhB,EAA6B;AAC3B,aAAKA,WAAL,CAAiBO,GAAjB,EAAsBF,OAAtB,GAAgC,IAAhC;AACD;AACF;;;sCAEiBH,I,EAAkC;AAAA,UAApBC,MAAoB,uEAAH,CAAG;;AAClD,UAAII,MAAM,KAAKC,OAAL,CAAaN,IAAb,EAAmBC,MAAnB,CAAV;AACA,UAAII,OAAO,KAAKP,WAAhB,EAA6B;AAC3B,aAAKA,WAAL,CAAiBO,GAAjB,EAAsBF,OAAtB,GAAgC,KAAhC;AACD;AACF;;;4BAEOH,I,EAAcC,M,EAAwB;AAC5C,aAAUD,IAAV,SAAkBC,MAAlB;AACD","file":"PerFileBreakpointMap.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport { Breakpoint } from \"./Breakpoint.js\";\n\n// Storage for all the breakpoints in one source file\n// Each source file will be associated with one PerFileBreakpointMap\nexport class PerFileBreakpointMap {\n constructor(filePath: string) {\n this.filePath = filePath;\n this.breakpoints = new Map();\n }\n filePath: string;\n\n //map of line:column to Breakpoint objects\n breakpoints: { [string]: Breakpoint };\n\n addBreakpoint(line: number, column: number = 0, temporary?: boolean, enabled?: boolean) {\n let breakpoint = new Breakpoint(this.filePath, line, column, temporary, enabled);\n let key = this._getKey(line, column);\n this.breakpoints[key] = breakpoint;\n }\n\n getBreakpoint(line: number, column: number = 0): void | Breakpoint {\n //check for a column breakpoint first, then line breakpoint\n if (column !== 0) {\n let key = this._getKey(line, column);\n if (key in this.breakpoints) {\n return this.breakpoints[key];\n } else {\n key = this._getKey(line, 0);\n if (key in this.breakpoints) {\n return this.breakpoints[key];\n }\n }\n } else {\n let key = this._getKey(line, 0);\n if (key in this.breakpoints) {\n return this.breakpoints[key];\n }\n }\n\n return undefined;\n }\n\n removeBreakpoint(line: number, column: number = 0) {\n let key = this._getKey(line, column);\n if (key in this.breakpoints) {\n delete this.breakpoints[key];\n }\n }\n\n enableBreakpoint(line: number, column: number = 0) {\n let key = this._getKey(line, column);\n if (key in this.breakpoints) {\n this.breakpoints[key].enabled = true;\n }\n }\n\n disableBreakpoint(line: number, column: number = 0) {\n let key = this._getKey(line, column);\n if (key in this.breakpoints) {\n this.breakpoints[key].enabled = false;\n }\n }\n\n _getKey(line: number, column: number): string {\n return `${line}:${column}`;\n }\n}\n"]}
|
||||
53
build/node_modules/prepack/lib/debugger/ReferenceMap.js
generated
vendored
Normal file
53
build/node_modules/prepack/lib/debugger/ReferenceMap.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
/**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
// A map with an incrementing counter as the keys
|
||||
// Used to store references to variable collections since DebugProtocol
|
||||
// specifies fetching variable collections via unique IDs
|
||||
var ReferenceMap = exports.ReferenceMap = function () {
|
||||
function ReferenceMap() {
|
||||
_classCallCheck(this, ReferenceMap);
|
||||
|
||||
this._counter = 0;
|
||||
this._mapping = new Map();
|
||||
}
|
||||
|
||||
_createClass(ReferenceMap, [{
|
||||
key: "add",
|
||||
value: function add(value) {
|
||||
this._counter++;
|
||||
this._mapping[this._counter] = value;
|
||||
return this._counter;
|
||||
}
|
||||
}, {
|
||||
key: "get",
|
||||
value: function get(reference) {
|
||||
return this._mapping[reference];
|
||||
}
|
||||
}, {
|
||||
key: "clean",
|
||||
value: function clean() {
|
||||
this._counter = 0;
|
||||
this._mapping = new Map();
|
||||
}
|
||||
}]);
|
||||
|
||||
return ReferenceMap;
|
||||
}();
|
||||
//# sourceMappingURL=ReferenceMap.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/ReferenceMap.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/ReferenceMap.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/debugger/ReferenceMap.js"],"names":["ReferenceMap","_counter","_mapping","Map","value","reference"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;AAWA;AACA;AACA;IACaA,Y,WAAAA,Y;AACX,0BAAc;AAAA;;AACZ,SAAKC,QAAL,GAAgB,CAAhB;AACA,SAAKC,QAAL,GAAgB,IAAIC,GAAJ,EAAhB;AACD;;;;wBAIGC,K,EAAkB;AACpB,WAAKH,QAAL;AACA,WAAKC,QAAL,CAAc,KAAKD,QAAnB,IAA+BG,KAA/B;AACA,aAAO,KAAKH,QAAZ;AACD;;;wBAEGI,S,EAA6B;AAC/B,aAAO,KAAKH,QAAL,CAAcG,SAAd,CAAP;AACD;;;4BAEO;AACN,WAAKJ,QAAL,GAAgB,CAAhB;AACA,WAAKC,QAAL,GAAgB,IAAIC,GAAJ,EAAhB;AACD","file":"ReferenceMap.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\n// A map with an incrementing counter as the keys\n// Used to store references to variable collections since DebugProtocol\n// specifies fetching variable collections via unique IDs\nexport class ReferenceMap<T> {\n constructor() {\n this._counter = 0;\n this._mapping = new Map();\n }\n _counter: number;\n _mapping: { [number]: T };\n\n add(value: T): number {\n this._counter++;\n this._mapping[this._counter] = value;\n return this._counter;\n }\n\n get(reference: number): void | T {\n return this._mapping[reference];\n }\n\n clean() {\n this._counter = 0;\n this._mapping = new Map();\n }\n}\n"]}
|
||||
190
build/node_modules/prepack/lib/debugger/VariableManager.js
generated
vendored
Normal file
190
build/node_modules/prepack/lib/debugger/VariableManager.js
generated
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.VariableManager = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _ReferenceMap = require("./ReferenceMap.js");
|
||||
|
||||
var _environment = require("./../environment.js");
|
||||
|
||||
var _index = require("./../values/index.js");
|
||||
|
||||
var _invariant = require("./../invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _is = require("./../methods/is.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
// This class manages the handling of variable requests in the debugger
|
||||
// The DebugProtocol specifies collections of variables are to be fetched using a
|
||||
// unique reference ID called a variablesReference. This class can generate new
|
||||
// variablesReferences to pass to the UI and then perform lookups for those
|
||||
// variablesReferences when they are requested.
|
||||
var VariableManager = exports.VariableManager = function () {
|
||||
function VariableManager(realm) {
|
||||
_classCallCheck(this, VariableManager);
|
||||
|
||||
this._containerCache = new Map();
|
||||
this._referenceMap = new _ReferenceMap.ReferenceMap();
|
||||
this._realm = realm;
|
||||
}
|
||||
// cache for created references
|
||||
|
||||
// map for looking up references
|
||||
|
||||
|
||||
_createClass(VariableManager, [{
|
||||
key: "getReferenceForValue",
|
||||
|
||||
|
||||
// Given a container, either returns a cached reference for that container if
|
||||
// it exists or return a new reference
|
||||
value: function getReferenceForValue(value) {
|
||||
var cachedRef = this._containerCache.get(value);
|
||||
if (cachedRef !== undefined) {
|
||||
return cachedRef;
|
||||
}
|
||||
|
||||
var varRef = this._referenceMap.add(value);
|
||||
this._containerCache.set(value, varRef);
|
||||
return varRef;
|
||||
}
|
||||
|
||||
// The entry point for retrieving a collection of variables by a reference
|
||||
|
||||
}, {
|
||||
key: "getVariablesByReference",
|
||||
value: function getVariablesByReference(reference) {
|
||||
var container = this._referenceMap.get(reference);
|
||||
if (!container) return [];
|
||||
if (container instanceof _environment.LexicalEnvironment) {
|
||||
return this._getVariablesFromEnv(container);
|
||||
} else if (container instanceof _index.ObjectValue) {
|
||||
return this._getVariablesFromObject(container);
|
||||
} else {
|
||||
(0, _invariant2.default)(false, "Invalid variable container");
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_getVariablesFromObject",
|
||||
value: function _getVariablesFromObject(object) {
|
||||
var variables = [];
|
||||
var names = object.properties.keys();
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = names[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var name = _step.value;
|
||||
|
||||
var binding = object.properties.get(name);
|
||||
(0, _invariant2.default)(binding !== undefined);
|
||||
if (binding.descriptor) {
|
||||
if ((0, _is.IsDataDescriptor)(this._realm, binding.descriptor)) {
|
||||
var value = binding.descriptor.value;
|
||||
if (value instanceof _index.Value) {
|
||||
var variable = this._getVariableFromValue(name, value);
|
||||
variables.push(variable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return variables;
|
||||
}
|
||||
}, {
|
||||
key: "_getVariablesFromEnv",
|
||||
value: function _getVariablesFromEnv(env) {
|
||||
var envRecord = env.environmentRecord;
|
||||
if (envRecord instanceof _environment.DeclarativeEnvironmentRecord) {
|
||||
return this._getVariablesFromDeclarativeEnv(envRecord);
|
||||
}
|
||||
// TODO: implement retrieving variables for other kinds of environment records
|
||||
return [];
|
||||
}
|
||||
}, {
|
||||
key: "_getVariablesFromDeclarativeEnv",
|
||||
value: function _getVariablesFromDeclarativeEnv(env) {
|
||||
var variables = [];
|
||||
var bindings = env.bindings;
|
||||
for (var name in bindings) {
|
||||
var binding = bindings[name];
|
||||
if (binding.value) {
|
||||
var variable = this._getVariableFromValue(name, binding.value);
|
||||
variables.push(variable);
|
||||
}
|
||||
}
|
||||
return variables;
|
||||
}
|
||||
}, {
|
||||
key: "_getVariableFromValue",
|
||||
value: function _getVariableFromValue(name, value) {
|
||||
if (value instanceof _index.ConcreteValue) {
|
||||
return this._getVariableFromConcreteValue(name, value);
|
||||
} else {
|
||||
(0, _invariant2.default)(false, "Unsupported type of: " + name);
|
||||
}
|
||||
// TODO: implement variables request for abstract values
|
||||
}
|
||||
}, {
|
||||
key: "_getVariableFromConcreteValue",
|
||||
value: function _getVariableFromConcreteValue(name, value) {
|
||||
if (value instanceof _index.PrimitiveValue) {
|
||||
var variable = {
|
||||
name: name,
|
||||
value: value.toDisplayString(),
|
||||
variablesReference: 0
|
||||
};
|
||||
return variable;
|
||||
} else if (value instanceof _index.ObjectValue) {
|
||||
var _variable = {
|
||||
name: name,
|
||||
value: "Object",
|
||||
variablesReference: this.getReferenceForValue(value)
|
||||
};
|
||||
return _variable;
|
||||
} else {
|
||||
(0, _invariant2.default)(false, "Concrete value must be primitive or object");
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "clean",
|
||||
value: function clean() {
|
||||
this._containerCache = new Map();
|
||||
this._referenceMap.clean();
|
||||
}
|
||||
}]);
|
||||
|
||||
return VariableManager;
|
||||
}();
|
||||
//# sourceMappingURL=VariableManager.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/VariableManager.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/VariableManager.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
478
build/node_modules/prepack/lib/debugger/adapter/DebugAdapter.js
generated
vendored
Normal file
478
build/node_modules/prepack/lib/debugger/adapter/DebugAdapter.js
generated
vendored
Normal file
@@ -0,0 +1,478 @@
|
||||
"use strict";
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _vscodeDebugadapter = require("vscode-debugadapter");
|
||||
|
||||
var _vscodeDebugprotocol = require("vscode-debugprotocol");
|
||||
|
||||
var DebugProtocol = _interopRequireWildcard(_vscodeDebugprotocol);
|
||||
|
||||
var _AdapterChannel = require("./channel/AdapterChannel.js");
|
||||
|
||||
var _invariant = require("./../common/invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _DebugMessage = require("./../common/channel/DebugMessage.js");
|
||||
|
||||
var _DebuggerConstants = require("./../common/DebuggerConstants.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
/* An implementation of an debugger adapter adhering to the VSCode Debug protocol
|
||||
* The adapter is responsible for communication between the UI and Prepack
|
||||
*/
|
||||
var PrepackDebugSession = function (_DebugSession) {
|
||||
_inherits(PrepackDebugSession, _DebugSession);
|
||||
|
||||
/**
|
||||
* Creates a new debug adapter that is used for one debug session.
|
||||
* We configure the default implementation of a debug adapter here.
|
||||
*/
|
||||
function PrepackDebugSession() {
|
||||
_classCallCheck(this, PrepackDebugSession);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (PrepackDebugSession.__proto__ || Object.getPrototypeOf(PrepackDebugSession)).call(this));
|
||||
|
||||
_this.setDebuggerLinesStartAt1(true);
|
||||
_this.setDebuggerColumnsStartAt1(true);
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(PrepackDebugSession, [{
|
||||
key: "_generateDebugFilePath",
|
||||
value: function _generateDebugFilePath(direction) {
|
||||
var time = Date.now();
|
||||
var filePath = "/tmp/";
|
||||
if (direction === "in") {
|
||||
filePath += "prepack-debug-engine2adapter-" + time + ".txt";
|
||||
} else {
|
||||
filePath += "prepack-debug-adapter2engine-" + time + ".txt";
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
}, {
|
||||
key: "_registerMessageCallbacks",
|
||||
value: function _registerMessageCallbacks() {
|
||||
var _this2 = this;
|
||||
|
||||
this._adapterChannel.registerChannelEvent(_DebugMessage.DebugMessage.STOPPED_RESPONSE, function (response) {
|
||||
var result = response.result;
|
||||
(0, _invariant2.default)(result.kind === "stopped");
|
||||
_this2.sendEvent(new _vscodeDebugadapter.StoppedEvent(result.reason + ": " + result.filePath + " " + result.line + ":" + result.column, _DebuggerConstants.DebuggerConstants.PREPACK_THREAD_ID));
|
||||
});
|
||||
this._adapterChannel.registerChannelEvent(_DebugMessage.DebugMessage.STEPINTO_RESPONSE, function (response) {
|
||||
var result = response.result;
|
||||
(0, _invariant2.default)(result.kind === "stepInto");
|
||||
_this2.sendEvent(new _vscodeDebugadapter.StoppedEvent("Stepped into " + (result.filePath + " " + result.line + ":" + result.column), _DebuggerConstants.DebuggerConstants.PREPACK_THREAD_ID));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* The 'initialize' request is the first request called by the UI
|
||||
* to interrogate the features the debug adapter provides.
|
||||
*/
|
||||
// Override
|
||||
|
||||
}, {
|
||||
key: "initializeRequest",
|
||||
value: function initializeRequest(response, args) {
|
||||
// Let the UI know that we can start accepting breakpoint requests.
|
||||
// The UI will end the configuration sequence by calling 'configurationDone' request.
|
||||
this.sendEvent(new _vscodeDebugadapter.InitializedEvent());
|
||||
|
||||
this._clientID = args.clientID;
|
||||
response.body = response.body || {};
|
||||
response.body.supportsConfigurationDoneRequest = true;
|
||||
// Respond back to the UI with the configurations. Will add more configurations gradually as needed.
|
||||
// Adapter can respond immediately here because no message is sent to Prepack
|
||||
this.sendResponse(response);
|
||||
}
|
||||
|
||||
// Override
|
||||
|
||||
}, {
|
||||
key: "configurationDoneRequest",
|
||||
value: function configurationDoneRequest(response, args) {
|
||||
// initial handshake with UI is complete
|
||||
if (this._clientID !== _DebuggerConstants.DebuggerConstants.CLI_CLIENTID) {
|
||||
// for all ui except the CLI, autosend the first run request
|
||||
this._adapterChannel.run(_DebuggerConstants.DebuggerConstants.DEFAULT_REQUEST_ID, function (runResponse) {});
|
||||
}
|
||||
this.sendResponse(response);
|
||||
}
|
||||
|
||||
// Override
|
||||
|
||||
}, {
|
||||
key: "launchRequest",
|
||||
value: function launchRequest(response, args) {
|
||||
var _this3 = this;
|
||||
|
||||
var inFilePath = this._generateDebugFilePath("in");
|
||||
var outFilePath = this._generateDebugFilePath("out");
|
||||
// set up the communication channel
|
||||
this._adapterChannel = new _AdapterChannel.AdapterChannel(inFilePath, outFilePath);
|
||||
this._registerMessageCallbacks();
|
||||
var launchArgs = {
|
||||
kind: "launch",
|
||||
sourceFile: args.sourceFile,
|
||||
prepackRuntime: args.prepackRuntime,
|
||||
prepackArguments: args.prepackArguments,
|
||||
debugInFilePath: inFilePath,
|
||||
debugOutFilePath: outFilePath,
|
||||
outputCallback: function outputCallback(data) {
|
||||
var outputEvent = new _vscodeDebugadapter.OutputEvent(data.toString(), "stdout");
|
||||
_this3.sendEvent(outputEvent);
|
||||
},
|
||||
exitCallback: function exitCallback() {
|
||||
_this3.sendEvent(new _vscodeDebugadapter.TerminatedEvent());
|
||||
process.exit();
|
||||
}
|
||||
};
|
||||
this._adapterChannel.launch(response.request_seq, launchArgs, function (dbgResponse) {
|
||||
_this3.sendResponse(response);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Request Prepack to continue running when it is stopped
|
||||
*/
|
||||
// Override
|
||||
|
||||
}, {
|
||||
key: "continueRequest",
|
||||
value: function continueRequest(response, args) {
|
||||
var _this4 = this;
|
||||
|
||||
// send a Run request to Prepack and try to send the next request
|
||||
this._adapterChannel.run(response.request_seq, function (dbgResponse) {
|
||||
_this4.sendResponse(response);
|
||||
});
|
||||
}
|
||||
|
||||
// Override
|
||||
|
||||
}, {
|
||||
key: "setBreakPointsRequest",
|
||||
value: function setBreakPointsRequest(response, args) {
|
||||
var _this5 = this;
|
||||
|
||||
if (!args.source.path || !args.breakpoints) return;
|
||||
var filePath = args.source.path;
|
||||
var breakpointInfos = [];
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = args.breakpoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var breakpoint = _step.value;
|
||||
|
||||
var line = breakpoint.line;
|
||||
var column = 0;
|
||||
if (breakpoint.column) {
|
||||
column = breakpoint.column;
|
||||
}
|
||||
var breakpointInfo = {
|
||||
kind: "breakpoint",
|
||||
requestID: response.request_seq,
|
||||
filePath: filePath,
|
||||
line: line,
|
||||
column: column
|
||||
};
|
||||
breakpointInfos.push(breakpointInfo);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._adapterChannel.setBreakpoints(response.request_seq, breakpointInfos, function (dbgResponse) {
|
||||
var result = dbgResponse.result;
|
||||
(0, _invariant2.default)(result.kind === "breakpoint-add");
|
||||
var breakpoints = [];
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator2 = result.breakpoints[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
||||
var breakpointInfo = _step2.value;
|
||||
|
||||
var source = {
|
||||
path: breakpointInfo.filePath
|
||||
};
|
||||
var _breakpoint = {
|
||||
verified: true,
|
||||
source: source,
|
||||
line: breakpointInfo.line,
|
||||
column: breakpointInfo.column
|
||||
};
|
||||
breakpoints.push(_breakpoint);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
response.body = {
|
||||
breakpoints: breakpoints
|
||||
};
|
||||
_this5.sendResponse(response);
|
||||
});
|
||||
}
|
||||
|
||||
// Override
|
||||
|
||||
}, {
|
||||
key: "stackTraceRequest",
|
||||
value: function stackTraceRequest(response, args) {
|
||||
var _this6 = this;
|
||||
|
||||
this._adapterChannel.getStackFrames(response.request_seq, function (dbgResponse) {
|
||||
var result = dbgResponse.result;
|
||||
(0, _invariant2.default)(result.kind === "stackframe");
|
||||
var frameInfos = result.stackframes;
|
||||
var frames = [];
|
||||
var _iteratorNormalCompletion3 = true;
|
||||
var _didIteratorError3 = false;
|
||||
var _iteratorError3 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator3 = frameInfos[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
||||
var frameInfo = _step3.value;
|
||||
|
||||
var source = {
|
||||
path: frameInfo.fileName
|
||||
};
|
||||
var frame = {
|
||||
id: frameInfo.id,
|
||||
name: frameInfo.functionName,
|
||||
source: source,
|
||||
line: frameInfo.line,
|
||||
column: frameInfo.column
|
||||
};
|
||||
frames.push(frame);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError3 = true;
|
||||
_iteratorError3 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
||||
_iterator3.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError3) {
|
||||
throw _iteratorError3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
response.body = {
|
||||
stackFrames: frames
|
||||
};
|
||||
_this6.sendResponse(response);
|
||||
});
|
||||
}
|
||||
|
||||
// Override
|
||||
|
||||
}, {
|
||||
key: "threadsRequest",
|
||||
value: function threadsRequest(response) {
|
||||
// There will only be 1 thread, so respond immediately
|
||||
var thread = {
|
||||
id: _DebuggerConstants.DebuggerConstants.PREPACK_THREAD_ID,
|
||||
name: "main"
|
||||
};
|
||||
response.body = {
|
||||
threads: [thread]
|
||||
};
|
||||
this.sendResponse(response);
|
||||
}
|
||||
|
||||
// Override
|
||||
|
||||
}, {
|
||||
key: "scopesRequest",
|
||||
value: function scopesRequest(response, args) {
|
||||
var _this7 = this;
|
||||
|
||||
this._adapterChannel.getScopes(response.request_seq, args.frameId, function (dbgResponse) {
|
||||
var result = dbgResponse.result;
|
||||
(0, _invariant2.default)(result.kind === "scopes");
|
||||
var scopeInfos = result.scopes;
|
||||
var scopes = [];
|
||||
var _iteratorNormalCompletion4 = true;
|
||||
var _didIteratorError4 = false;
|
||||
var _iteratorError4 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator4 = scopeInfos[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
||||
var scopeInfo = _step4.value;
|
||||
|
||||
var scope = {
|
||||
name: scopeInfo.name,
|
||||
variablesReference: scopeInfo.variablesReference,
|
||||
expensive: scopeInfo.expensive
|
||||
};
|
||||
scopes.push(scope);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError4 = true;
|
||||
_iteratorError4 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion4 && _iterator4.return) {
|
||||
_iterator4.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError4) {
|
||||
throw _iteratorError4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
response.body = {
|
||||
scopes: scopes
|
||||
};
|
||||
_this7.sendResponse(response);
|
||||
});
|
||||
}
|
||||
|
||||
// Override
|
||||
|
||||
}, {
|
||||
key: "variablesRequest",
|
||||
value: function variablesRequest(response, args) {
|
||||
var _this8 = this;
|
||||
|
||||
this._adapterChannel.getVariables(response.request_seq, args.variablesReference, function (dbgResponse) {
|
||||
var result = dbgResponse.result;
|
||||
(0, _invariant2.default)(result.kind === "variables");
|
||||
var variableInfos = result.variables;
|
||||
var variables = [];
|
||||
var _iteratorNormalCompletion5 = true;
|
||||
var _didIteratorError5 = false;
|
||||
var _iteratorError5 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator5 = variableInfos[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
||||
var varInfo = _step5.value;
|
||||
|
||||
var variable = {
|
||||
name: varInfo.name,
|
||||
value: varInfo.value,
|
||||
variablesReference: varInfo.variablesReference
|
||||
};
|
||||
variables.push(variable);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError5 = true;
|
||||
_iteratorError5 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion5 && _iterator5.return) {
|
||||
_iterator5.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError5) {
|
||||
throw _iteratorError5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
response.body = {
|
||||
variables: variables
|
||||
};
|
||||
_this8.sendResponse(response);
|
||||
});
|
||||
}
|
||||
|
||||
// Override
|
||||
|
||||
}, {
|
||||
key: "stepInRequest",
|
||||
value: function stepInRequest(response, args) {
|
||||
var _this9 = this;
|
||||
|
||||
this._adapterChannel.stepInto(response.request_seq, function (dbgResponse) {
|
||||
_this9.sendResponse(response);
|
||||
});
|
||||
}
|
||||
|
||||
// Override
|
||||
|
||||
}, {
|
||||
key: "nextRequest",
|
||||
value: function nextRequest(response, args) {
|
||||
var _this10 = this;
|
||||
|
||||
this._adapterChannel.stepOver(response.request_seq, function (dbgResponse) {
|
||||
_this10.sendResponse(response);
|
||||
});
|
||||
}
|
||||
|
||||
// Override
|
||||
|
||||
}, {
|
||||
key: "evaluateRequest",
|
||||
value: function evaluateRequest(response, args) {
|
||||
var _this11 = this;
|
||||
|
||||
this._adapterChannel.evaluate(response.request_seq, args.frameId, args.expression, function (dbgResponse) {
|
||||
var evalResult = dbgResponse.result;
|
||||
(0, _invariant2.default)(evalResult.kind === "evaluate");
|
||||
response.body = {
|
||||
result: evalResult.displayValue,
|
||||
type: evalResult.type,
|
||||
variablesReference: evalResult.variablesReference
|
||||
};
|
||||
_this11.sendResponse(response);
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
return PrepackDebugSession;
|
||||
}(_vscodeDebugadapter.DebugSession);
|
||||
|
||||
_vscodeDebugadapter.DebugSession.run(PrepackDebugSession);
|
||||
//# sourceMappingURL=DebugAdapter.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/adapter/DebugAdapter.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/adapter/DebugAdapter.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
230
build/node_modules/prepack/lib/debugger/adapter/channel/AdapterChannel.js
generated
vendored
Normal file
230
build/node_modules/prepack/lib/debugger/adapter/channel/AdapterChannel.js
generated
vendored
Normal file
@@ -0,0 +1,230 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AdapterChannel = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _FileIOWrapper = require("./../../common/channel/FileIOWrapper.js");
|
||||
|
||||
var _MessageMarshaller = require("./../../common/channel/MessageMarshaller.js");
|
||||
|
||||
var _queueFifo = require("queue-fifo");
|
||||
|
||||
var _queueFifo2 = _interopRequireDefault(_queueFifo);
|
||||
|
||||
var _events = require("events");
|
||||
|
||||
var _events2 = _interopRequireDefault(_events);
|
||||
|
||||
var _invariant = require("./../../common/invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _DebugMessage = require("./../../common/channel/DebugMessage.js");
|
||||
|
||||
var _child_process = require("child_process");
|
||||
|
||||
var _child_process2 = _interopRequireDefault(_child_process);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
//Channel used by the debug adapter to communicate with Prepack
|
||||
var AdapterChannel = exports.AdapterChannel = function () {
|
||||
function AdapterChannel(inFilePath, outFilePath) {
|
||||
_classCallCheck(this, AdapterChannel);
|
||||
|
||||
this._ioWrapper = new _FileIOWrapper.FileIOWrapper(true, inFilePath, outFilePath);
|
||||
this._marshaller = new _MessageMarshaller.MessageMarshaller();
|
||||
this._queue = new _queueFifo2.default();
|
||||
this._pendingRequestCallbacks = new Map();
|
||||
this._eventEmitter = new _events2.default();
|
||||
}
|
||||
|
||||
_createClass(AdapterChannel, [{
|
||||
key: "_handleFileReadError",
|
||||
|
||||
|
||||
// Error handler for errors in files from the adapter channel
|
||||
value: function _handleFileReadError(err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
}, {
|
||||
key: "_processPrepackMessage",
|
||||
value: function _processPrepackMessage(message) {
|
||||
var dbgResponse = this._marshaller.unmarshallResponse(message);
|
||||
if (dbgResponse.result.kind === "breakpoint-add") {
|
||||
this._eventEmitter.emit(_DebugMessage.DebugMessage.BREAKPOINT_ADD_ACKNOWLEDGE, dbgResponse.id, dbgResponse);
|
||||
} else if (dbgResponse.result.kind === "stopped") {
|
||||
this._eventEmitter.emit(_DebugMessage.DebugMessage.STOPPED_RESPONSE, dbgResponse);
|
||||
} else if (dbgResponse.result.kind === "stepInto") {
|
||||
this._eventEmitter.emit(_DebugMessage.DebugMessage.STEPINTO_RESPONSE, dbgResponse);
|
||||
}
|
||||
this._prepackWaiting = true;
|
||||
this._processRequestCallback(dbgResponse);
|
||||
this.trySendNextRequest();
|
||||
}
|
||||
|
||||
// Check to see if the next request to Prepack can be sent and send it if so
|
||||
|
||||
}, {
|
||||
key: "trySendNextRequest",
|
||||
value: function trySendNextRequest() {
|
||||
// check to see if Prepack is ready to accept another request
|
||||
if (!this._prepackWaiting) return false;
|
||||
// check that there is a message to send
|
||||
if (this._queue.isEmpty()) return false;
|
||||
var request = this._queue.dequeue();
|
||||
this.listenOnFile(this._processPrepackMessage.bind(this));
|
||||
this.writeOut(request);
|
||||
this._prepackWaiting = false;
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "_addRequestCallback",
|
||||
value: function _addRequestCallback(requestID, callback) {
|
||||
(0, _invariant2.default)(!this._pendingRequestCallbacks.has(requestID), "Request ID already exists in pending requests");
|
||||
this._pendingRequestCallbacks.set(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "_processRequestCallback",
|
||||
value: function _processRequestCallback(response) {
|
||||
var callback = this._pendingRequestCallbacks.get(response.id);
|
||||
(0, _invariant2.default)(callback !== undefined, "Request ID does not exist in pending requests: " + response.id);
|
||||
callback(response);
|
||||
this._pendingRequestCallbacks.delete(response.id);
|
||||
}
|
||||
}, {
|
||||
key: "registerChannelEvent",
|
||||
value: function registerChannelEvent(event, listener) {
|
||||
this._eventEmitter.addListener(event, listener);
|
||||
}
|
||||
}, {
|
||||
key: "launch",
|
||||
value: function launch(requestID, args, callback) {
|
||||
var _this = this;
|
||||
|
||||
this.sendDebuggerStart(requestID);
|
||||
this.listenOnFile(this._processPrepackMessage.bind(this));
|
||||
var prepackCommand = [args.sourceFile].concat(args.prepackArguments);
|
||||
// Note: here the input file for the adapter is the output file for Prepack, and vice versa.
|
||||
prepackCommand = prepackCommand.concat(["--debugInFilePath", args.debugOutFilePath, "--debugOutFilePath", args.debugInFilePath]);
|
||||
|
||||
var runtime = "prepack";
|
||||
if (args.prepackRuntime.length > 0) {
|
||||
// user specified a Prepack path
|
||||
runtime = "node";
|
||||
prepackCommand = [args.prepackRuntime].concat(prepackCommand);
|
||||
}
|
||||
this._prepackProcess = _child_process2.default.spawn(runtime, prepackCommand);
|
||||
|
||||
process.on("exit", function () {
|
||||
_this._prepackProcess.kill();
|
||||
_this.clean();
|
||||
process.exit();
|
||||
});
|
||||
|
||||
process.on("SIGINT", function () {
|
||||
_this._prepackProcess.kill();
|
||||
process.exit();
|
||||
});
|
||||
|
||||
this._prepackProcess.stdout.on("data", args.outputCallback);
|
||||
|
||||
this._prepackProcess.on("exit", args.exitCallback);
|
||||
this._addRequestCallback(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "run",
|
||||
value: function run(requestID, callback) {
|
||||
this._queue.enqueue(this._marshaller.marshallContinueRequest(requestID));
|
||||
this.trySendNextRequest();
|
||||
this._addRequestCallback(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "setBreakpoints",
|
||||
value: function setBreakpoints(requestID, breakpoints, callback) {
|
||||
this._queue.enqueue(this._marshaller.marshallSetBreakpointsRequest(requestID, breakpoints));
|
||||
this.trySendNextRequest();
|
||||
this._addRequestCallback(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "getStackFrames",
|
||||
value: function getStackFrames(requestID, callback) {
|
||||
this._queue.enqueue(this._marshaller.marshallStackFramesRequest(requestID));
|
||||
this.trySendNextRequest();
|
||||
this._addRequestCallback(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "getScopes",
|
||||
value: function getScopes(requestID, frameId, callback) {
|
||||
this._queue.enqueue(this._marshaller.marshallScopesRequest(requestID, frameId));
|
||||
this.trySendNextRequest();
|
||||
this._addRequestCallback(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "getVariables",
|
||||
value: function getVariables(requestID, variablesReference, callback) {
|
||||
this._queue.enqueue(this._marshaller.marshallVariablesRequest(requestID, variablesReference));
|
||||
this.trySendNextRequest();
|
||||
this._addRequestCallback(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "stepInto",
|
||||
value: function stepInto(requestID, callback) {
|
||||
this._queue.enqueue(this._marshaller.marshallStepIntoRequest(requestID));
|
||||
this.trySendNextRequest();
|
||||
this._addRequestCallback(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "stepOver",
|
||||
value: function stepOver(requestID, callback) {
|
||||
this._queue.enqueue(this._marshaller.marshallStepOverRequest(requestID));
|
||||
this.trySendNextRequest();
|
||||
this._addRequestCallback(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "evaluate",
|
||||
value: function evaluate(requestID, frameId, expression, callback) {
|
||||
this._queue.enqueue(this._marshaller.marshallEvaluateRequest(requestID, frameId, expression));
|
||||
this.trySendNextRequest();
|
||||
this._addRequestCallback(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "writeOut",
|
||||
value: function writeOut(contents) {
|
||||
this._ioWrapper.writeOutSync(contents);
|
||||
}
|
||||
}, {
|
||||
key: "sendDebuggerStart",
|
||||
value: function sendDebuggerStart(requestID) {
|
||||
this.writeOut(this._marshaller.marshallDebuggerStart(requestID));
|
||||
}
|
||||
}, {
|
||||
key: "listenOnFile",
|
||||
value: function listenOnFile(messageProcessor) {
|
||||
this._ioWrapper.readIn(this._handleFileReadError.bind(this), messageProcessor);
|
||||
}
|
||||
}, {
|
||||
key: "clean",
|
||||
value: function clean() {
|
||||
this._ioWrapper.clearInFile();
|
||||
this._ioWrapper.clearOutFile();
|
||||
}
|
||||
}]);
|
||||
|
||||
return AdapterChannel;
|
||||
}();
|
||||
//# sourceMappingURL=AdapterChannel.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/adapter/channel/AdapterChannel.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/adapter/channel/AdapterChannel.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
209
build/node_modules/prepack/lib/debugger/channel/AdapterChannel.js
generated
vendored
Normal file
209
build/node_modules/prepack/lib/debugger/channel/AdapterChannel.js
generated
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.AdapterChannel = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _FileIOWrapper = require("./FileIOWrapper.js");
|
||||
|
||||
var _MessageMarshaller = require("./MessageMarshaller.js");
|
||||
|
||||
var _queueFifo = require("queue-fifo");
|
||||
|
||||
var _queueFifo2 = _interopRequireDefault(_queueFifo);
|
||||
|
||||
var _events = require("events");
|
||||
|
||||
var _events2 = _interopRequireDefault(_events);
|
||||
|
||||
var _invariant = require("./../../invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _DebugMessage = require("./DebugMessage.js");
|
||||
|
||||
var _child_process = require("child_process");
|
||||
|
||||
var _child_process2 = _interopRequireDefault(_child_process);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
//Channel used by the debug adapter to communicate with Prepack
|
||||
var AdapterChannel = exports.AdapterChannel = function () {
|
||||
function AdapterChannel(inFilePath, outFilePath) {
|
||||
_classCallCheck(this, AdapterChannel);
|
||||
|
||||
this._ioWrapper = new _FileIOWrapper.FileIOWrapper(true, inFilePath, outFilePath);
|
||||
this._marshaller = new _MessageMarshaller.MessageMarshaller();
|
||||
this._queue = new _queueFifo2.default();
|
||||
this._pendingRequestCallbacks = new Map();
|
||||
this._eventEmitter = new _events2.default();
|
||||
}
|
||||
|
||||
_createClass(AdapterChannel, [{
|
||||
key: "_handleFileReadError",
|
||||
|
||||
|
||||
// Error handler for errors in files from the adapter channel
|
||||
value: function _handleFileReadError(err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
}, {
|
||||
key: "_processPrepackMessage",
|
||||
value: function _processPrepackMessage(message) {
|
||||
var dbgResponse = this._marshaller.unmarshallResponse(message);
|
||||
if (dbgResponse.result.kind === "ready") {
|
||||
this._eventEmitter.emit(_DebugMessage.DebugMessage.PREPACK_READY_RESPONSE, dbgResponse);
|
||||
} else if (dbgResponse.result.kind === "breakpoint-add") {
|
||||
this._eventEmitter.emit(_DebugMessage.DebugMessage.BREAKPOINT_ADD_ACKNOWLEDGE, dbgResponse.id, dbgResponse);
|
||||
} else if (dbgResponse.result.kind === "breakpoint-stopped") {
|
||||
this._eventEmitter.emit(_DebugMessage.DebugMessage.BREAKPOINT_STOPPED_RESPONSE, dbgResponse);
|
||||
}
|
||||
this._prepackWaiting = true;
|
||||
this._processRequestCallback(dbgResponse);
|
||||
this.trySendNextRequest();
|
||||
}
|
||||
|
||||
// Check to see if the next request to Prepack can be sent and send it if so
|
||||
|
||||
}, {
|
||||
key: "trySendNextRequest",
|
||||
value: function trySendNextRequest() {
|
||||
// check to see if Prepack is ready to accept another request
|
||||
if (!this._prepackWaiting) return false;
|
||||
// check that there is a message to send
|
||||
if (this._queue.isEmpty()) return false;
|
||||
var request = this._queue.dequeue();
|
||||
this.listenOnFile(this._processPrepackMessage.bind(this));
|
||||
this.writeOut(request);
|
||||
this._prepackWaiting = false;
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "_addRequestCallback",
|
||||
value: function _addRequestCallback(requestID, callback) {
|
||||
(0, _invariant2.default)(!(requestID in this._pendingRequestCallbacks), "Request ID already exists in pending requests");
|
||||
this._pendingRequestCallbacks[requestID] = callback;
|
||||
}
|
||||
}, {
|
||||
key: "_processRequestCallback",
|
||||
value: function _processRequestCallback(response) {
|
||||
(0, _invariant2.default)(response.id in this._pendingRequestCallbacks, "Request ID does not exist in pending requests: " + response.id);
|
||||
var callback = this._pendingRequestCallbacks[response.id];
|
||||
callback(response);
|
||||
}
|
||||
}, {
|
||||
key: "registerChannelEvent",
|
||||
value: function registerChannelEvent(event, listener) {
|
||||
this._eventEmitter.addListener(event, listener);
|
||||
}
|
||||
}, {
|
||||
key: "launch",
|
||||
value: function launch(requestID, args, callback) {
|
||||
var _this = this;
|
||||
|
||||
this.sendDebuggerStart(requestID);
|
||||
this.listenOnFile(this._processPrepackMessage.bind(this));
|
||||
|
||||
var prepackCommand = [args.sourceFile].concat(args.prepackArguments);
|
||||
// Note: here the input file for the adapter is the output file for Prepack, and vice versa.
|
||||
prepackCommand = prepackCommand.concat(["--debugInFilePath", args.debugOutFilePath, "--debugOutFilePath", args.debugInFilePath]);
|
||||
|
||||
var runtime = "prepack";
|
||||
if (args.prepackRuntime.length > 0) {
|
||||
// user specified a Prepack path
|
||||
runtime = "node";
|
||||
prepackCommand = [args.prepackRuntime].concat(prepackCommand);
|
||||
}
|
||||
this._prepackProcess = _child_process2.default.spawn(runtime, prepackCommand);
|
||||
|
||||
process.on("exit", function () {
|
||||
_this._prepackProcess.kill();
|
||||
_this.clean();
|
||||
process.exit();
|
||||
});
|
||||
|
||||
process.on("SIGINT", function () {
|
||||
_this._prepackProcess.kill();
|
||||
process.exit();
|
||||
});
|
||||
|
||||
this._prepackProcess.stdout.on("data", args.outputCallback);
|
||||
|
||||
this._prepackProcess.on("exit", args.exitCallback);
|
||||
this._addRequestCallback(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "run",
|
||||
value: function run(requestID, callback) {
|
||||
this._queue.enqueue(this._marshaller.marshallContinueRequest(requestID));
|
||||
this.trySendNextRequest();
|
||||
this._addRequestCallback(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "setBreakpoints",
|
||||
value: function setBreakpoints(requestID, breakpoints, callback) {
|
||||
this._queue.enqueue(this._marshaller.marshallSetBreakpointsRequest(requestID, breakpoints));
|
||||
this.trySendNextRequest();
|
||||
this._addRequestCallback(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "getStackFrames",
|
||||
value: function getStackFrames(requestID, callback) {
|
||||
this._queue.enqueue(this._marshaller.marshallStackFramesRequest(requestID));
|
||||
this.trySendNextRequest();
|
||||
this._addRequestCallback(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "getScopes",
|
||||
value: function getScopes(requestID, frameId, callback) {
|
||||
this._queue.enqueue(this._marshaller.marshallScopesRequest(requestID, frameId));
|
||||
this.trySendNextRequest();
|
||||
this._addRequestCallback(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "getVariables",
|
||||
value: function getVariables(requestID, variablesReference, callback) {
|
||||
this._queue.enqueue(this._marshaller.marshallVariablesRequest(requestID, variablesReference));
|
||||
this.trySendNextRequest();
|
||||
this._addRequestCallback(requestID, callback);
|
||||
}
|
||||
}, {
|
||||
key: "writeOut",
|
||||
value: function writeOut(contents) {
|
||||
this._ioWrapper.writeOutSync(contents);
|
||||
}
|
||||
}, {
|
||||
key: "sendDebuggerStart",
|
||||
value: function sendDebuggerStart(requestID) {
|
||||
this.writeOut(this._marshaller.marshallDebuggerStart(requestID));
|
||||
}
|
||||
}, {
|
||||
key: "listenOnFile",
|
||||
value: function listenOnFile(messageProcessor) {
|
||||
this._ioWrapper.readIn(this._handleFileReadError.bind(this), messageProcessor);
|
||||
}
|
||||
}, {
|
||||
key: "clean",
|
||||
value: function clean() {
|
||||
this._ioWrapper.clearInFile();
|
||||
this._ioWrapper.clearOutFile();
|
||||
}
|
||||
}]);
|
||||
|
||||
return AdapterChannel;
|
||||
}();
|
||||
//# sourceMappingURL=AdapterChannel.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/channel/AdapterChannel.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/channel/AdapterChannel.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
127
build/node_modules/prepack/lib/debugger/channel/DebugChannel.js
generated
vendored
Normal file
127
build/node_modules/prepack/lib/debugger/channel/DebugChannel.js
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DebugChannel = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _invariant = require("./../../invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _FileIOWrapper = require("./FileIOWrapper.js");
|
||||
|
||||
var _DebugMessage = require("./DebugMessage.js");
|
||||
|
||||
var _MessageMarshaller = require("./MessageMarshaller.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
//Channel used by the DebugServer in Prepack to communicate with the debug adapter
|
||||
var DebugChannel = exports.DebugChannel = function () {
|
||||
function DebugChannel(ioWrapper) {
|
||||
_classCallCheck(this, DebugChannel);
|
||||
|
||||
this._requestReceived = false;
|
||||
this._ioWrapper = ioWrapper;
|
||||
this._marshaller = new _MessageMarshaller.MessageMarshaller();
|
||||
}
|
||||
|
||||
_createClass(DebugChannel, [{
|
||||
key: "debuggerIsAttached",
|
||||
|
||||
|
||||
/*
|
||||
/* Only called in the beginning to check if a debugger is attached
|
||||
*/
|
||||
value: function debuggerIsAttached() {
|
||||
var message = this._ioWrapper.readInSyncOnce();
|
||||
if (message === null) return false;
|
||||
var parts = message.split(" ");
|
||||
var requestID = parseInt(parts[0], 10);
|
||||
(0, _invariant2.default)(!isNaN(requestID), "Request ID must be a number");
|
||||
var command = parts[1];
|
||||
if (command === _DebugMessage.DebugMessage.DEBUGGER_ATTACHED) {
|
||||
this._requestReceived = true;
|
||||
this._ioWrapper.clearInFile();
|
||||
this.writeOut(requestID + " " + _DebugMessage.DebugMessage.PREPACK_READY_RESPONSE);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Reads in a request from the debug adapter
|
||||
/* The caller is responsible for sending a response with the appropriate
|
||||
/* contents at the right time.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "readIn",
|
||||
value: function readIn() {
|
||||
var message = this._ioWrapper.readInSync();
|
||||
this._requestReceived = true;
|
||||
return this._marshaller.unmarshallRequest(message);
|
||||
}
|
||||
|
||||
// Write out a response to the debug adapter
|
||||
|
||||
}, {
|
||||
key: "writeOut",
|
||||
value: function writeOut(contents) {
|
||||
//Prepack only writes back to the debug adapter in response to a request
|
||||
(0, _invariant2.default)(this._requestReceived, "Prepack writing message without being requested: " + contents);
|
||||
this._ioWrapper.writeOutSync(contents);
|
||||
this._requestReceived = false;
|
||||
}
|
||||
}, {
|
||||
key: "sendBreakpointsAcknowledge",
|
||||
value: function sendBreakpointsAcknowledge(messageType, requestID, args) {
|
||||
this.writeOut(this._marshaller.marshallBreakpointAcknowledge(requestID, messageType, args.breakpoints));
|
||||
}
|
||||
}, {
|
||||
key: "sendBreakpointStopped",
|
||||
value: function sendBreakpointStopped(filePath, line, column) {
|
||||
var breakpointInfo = {
|
||||
kind: "breakpoint",
|
||||
filePath: filePath,
|
||||
line: line,
|
||||
column: column
|
||||
};
|
||||
this.writeOut(this._marshaller.marshallBreakpointStopped(breakpointInfo));
|
||||
}
|
||||
}, {
|
||||
key: "sendStackframeResponse",
|
||||
value: function sendStackframeResponse(requestID, stackframes) {
|
||||
this.writeOut(this._marshaller.marshallStackFramesResponse(requestID, stackframes));
|
||||
}
|
||||
}, {
|
||||
key: "sendScopesResponse",
|
||||
value: function sendScopesResponse(requestID, scopes) {
|
||||
this.writeOut(this._marshaller.marshallScopesResponse(requestID, scopes));
|
||||
}
|
||||
}, {
|
||||
key: "sendVariablesResponse",
|
||||
value: function sendVariablesResponse(requestID, variables) {
|
||||
this.writeOut(this._marshaller.marshallVariablesResponse(requestID, variables));
|
||||
}
|
||||
}, {
|
||||
key: "sendPrepackFinish",
|
||||
value: function sendPrepackFinish() {
|
||||
this.writeOut(this._marshaller.marshallPrepackFinish());
|
||||
}
|
||||
}]);
|
||||
|
||||
return DebugChannel;
|
||||
}();
|
||||
//# sourceMappingURL=DebugChannel.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/channel/DebugChannel.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/channel/DebugChannel.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
42
build/node_modules/prepack/lib/debugger/channel/DebugMessage.js
generated
vendored
Normal file
42
build/node_modules/prepack/lib/debugger/channel/DebugMessage.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
/**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
//A collection of messages used between Prepack and the debug adapter
|
||||
var DebugMessage = exports.DebugMessage = function DebugMessage() {
|
||||
_classCallCheck(this, DebugMessage);
|
||||
};
|
||||
|
||||
DebugMessage.DEBUGGER_ATTACHED = "DebuggerAttached";
|
||||
DebugMessage.PREPACK_RUN_COMMAND = "PrepackRun";
|
||||
DebugMessage.BREAKPOINT_ADD_COMMAND = "Breakpoint-add-command";
|
||||
DebugMessage.BREAKPOINT_REMOVE_COMMAND = "Breakpoint-remove-command";
|
||||
DebugMessage.BREAKPOINT_ENABLE_COMMAND = "Breakpoint-enable-command";
|
||||
DebugMessage.BREAKPOINT_DISABLE_COMMAND = "Breakpoint-disable-command";
|
||||
DebugMessage.STACKFRAMES_COMMAND = "Stackframes-command";
|
||||
DebugMessage.SCOPES_COMMAND = "Scopes-command";
|
||||
DebugMessage.VARIABLES_COMMAND = "Variables-command";
|
||||
DebugMessage.PREPACK_READY_RESPONSE = "PrepackReady";
|
||||
DebugMessage.PREPACK_FINISH_RESPONSE = "PrepackFinish";
|
||||
DebugMessage.BREAKPOINT_STOPPED_RESPONSE = "Breakpoint-stopped-response";
|
||||
DebugMessage.STACKFRAMES_RESPONSE = "Stackframes-response";
|
||||
DebugMessage.SCOPES_RESPONSE = "Scopes-response";
|
||||
DebugMessage.VARIABLES_RESPONSE = "Variables-response";
|
||||
DebugMessage.BREAKPOINT_ADD_ACKNOWLEDGE = "Breakpoint-add-acknowledge";
|
||||
DebugMessage.BREAKPOINT_REMOVE_ACKNOWLEDGE = "Breakpoint-remove-acknowledge";
|
||||
DebugMessage.BREAKPOINT_ENABLE_ACKNOWLEDGE = "Breakpoint-enable-acknowledge";
|
||||
DebugMessage.BREAKPOINT_DISABLE_ACKNOWLEDGE = "Breakpoint-disable-acknowledge";
|
||||
//# sourceMappingURL=DebugMessage.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/channel/DebugMessage.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/channel/DebugMessage.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/debugger/channel/DebugMessage.js"],"names":["DebugMessage","DEBUGGER_ATTACHED","PREPACK_RUN_COMMAND","BREAKPOINT_ADD_COMMAND","BREAKPOINT_REMOVE_COMMAND","BREAKPOINT_ENABLE_COMMAND","BREAKPOINT_DISABLE_COMMAND","STACKFRAMES_COMMAND","SCOPES_COMMAND","VARIABLES_COMMAND","PREPACK_READY_RESPONSE","PREPACK_FINISH_RESPONSE","BREAKPOINT_STOPPED_RESPONSE","STACKFRAMES_RESPONSE","SCOPES_RESPONSE","VARIABLES_RESPONSE","BREAKPOINT_ADD_ACKNOWLEDGE","BREAKPOINT_REMOVE_ACKNOWLEDGE","BREAKPOINT_ENABLE_ACKNOWLEDGE","BREAKPOINT_DISABLE_ACKNOWLEDGE"],"mappings":";;;;;;;;AAAA;;;;;;;;;AAWA;IACaA,Y,WAAAA,Y;;;;AAAAA,Y,CAGJC,iB,GAA4B,kB;AAHxBD,Y,CAKJE,mB,GAA8B,Y;AAL1BF,Y,CAOJG,sB,GAAiC,wB;AAP7BH,Y,CASJI,yB,GAAoC,2B;AAThCJ,Y,CAWJK,yB,GAAoC,2B;AAXhCL,Y,CAaJM,0B,GAAqC,4B;AAbjCN,Y,CAeJO,mB,GAA8B,qB;AAf1BP,Y,CAiBJQ,c,GAAyB,gB;AAjBrBR,Y,CAmBJS,iB,GAA4B,mB;AAnBxBT,Y,CAuBJU,sB,GAAiC,c;AAvB7BV,Y,CAyBJW,uB,GAAkC,e;AAzB9BX,Y,CA2BJY,2B,GAAsC,6B;AA3BlCZ,Y,CA6BJa,oB,GAA+B,sB;AA7B3Bb,Y,CA+BJc,e,GAA0B,iB;AA/BtBd,Y,CAiCJe,kB,GAA6B,oB;AAjCzBf,Y,CAqCJgB,0B,GAAqC,4B;AArCjChB,Y,CAuCJiB,6B,GAAwC,+B;AAvCpCjB,Y,CAyCJkB,6B,GAAwC,+B;AAzCpClB,Y,CA2CJmB,8B,GAAyC,gC","file":"DebugMessage.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\n//A collection of messages used between Prepack and the debug adapter\nexport class DebugMessage {\n /* Messages from adapter to Prepack */\n // Tell Prepack a debugger is present\n static DEBUGGER_ATTACHED: string = \"DebuggerAttached\";\n // Command Prepack to keep running\n static PREPACK_RUN_COMMAND: string = \"PrepackRun\";\n // Command to set a breakpoint\n static BREAKPOINT_ADD_COMMAND: string = \"Breakpoint-add-command\";\n // Command to remove a breakpoint\n static BREAKPOINT_REMOVE_COMMAND: string = \"Breakpoint-remove-command\";\n // Command to enable a breakpoint\n static BREAKPOINT_ENABLE_COMMAND: string = \"Breakpoint-enable-command\";\n // Command to disable a breakpoint\n static BREAKPOINT_DISABLE_COMMAND: string = \"Breakpoint-disable-command\";\n // Command to fetch stack frames\n static STACKFRAMES_COMMAND: string = \"Stackframes-command\";\n // Command to fetch scopes\n static SCOPES_COMMAND: string = \"Scopes-command\";\n // Command to fetch variables\n static VARIABLES_COMMAND: string = \"Variables-command\";\n\n /* Messages from Prepack to adapter with requested information */\n // Respond to the adapter that Prepack is ready\n static PREPACK_READY_RESPONSE: string = \"PrepackReady\";\n // Respond to the adapter that Prepack is finished\n static PREPACK_FINISH_RESPONSE: string = \"PrepackFinish\";\n // Respond to the adapter that Prepack has stopped on a breakpoint\n static BREAKPOINT_STOPPED_RESPONSE: string = \"Breakpoint-stopped-response\";\n // Respond to the adapter with the request stackframes\n static STACKFRAMES_RESPONSE: string = \"Stackframes-response\";\n // Respond to the adapter with the requested scopes\n static SCOPES_RESPONSE: string = \"Scopes-response\";\n // Respond to the adapter with the requested variables\n static VARIABLES_RESPONSE: string = \"Variables-response\";\n\n /* Messages from Prepack to adapter to acknowledge having received the request */\n // Acknowledgement for setting a breakpoint\n static BREAKPOINT_ADD_ACKNOWLEDGE: string = \"Breakpoint-add-acknowledge\";\n // Acknowledgement for removing a breakpoint\n static BREAKPOINT_REMOVE_ACKNOWLEDGE: string = \"Breakpoint-remove-acknowledge\";\n // Acknowledgement for enabling a breakpoint\n static BREAKPOINT_ENABLE_ACKNOWLEDGE: string = \"Breakpoint-enable-acknowledge\";\n // Acknoledgement for disabling a breakpoint\n static BREAKPOINT_DISABLE_ACKNOWLEDGE: string = \"Breakpoint-disable-acknowledge\";\n}\n"]}
|
||||
121
build/node_modules/prepack/lib/debugger/channel/FileIOWrapper.js
generated
vendored
Normal file
121
build/node_modules/prepack/lib/debugger/channel/FileIOWrapper.js
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.FileIOWrapper = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _fs = require("fs");
|
||||
|
||||
var _fs2 = _interopRequireDefault(_fs);
|
||||
|
||||
var _path = require("path");
|
||||
|
||||
var _path2 = _interopRequireDefault(_path);
|
||||
|
||||
var _MessagePackager = require("./MessagePackager.js");
|
||||
|
||||
var _invariant = require("../../invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var FileIOWrapper = exports.FileIOWrapper = function () {
|
||||
function FileIOWrapper(isAdapter, inFilePath, outFilePath) {
|
||||
_classCallCheck(this, FileIOWrapper);
|
||||
|
||||
// the paths are expected to be relative to Prepack top level directory
|
||||
this._inFilePath = _path2.default.join(__dirname, "../../../", inFilePath);
|
||||
this._outFilePath = _path2.default.join(__dirname, "../../../", outFilePath);
|
||||
this._packager = new _MessagePackager.MessagePackager(isAdapter);
|
||||
this._isAdapter = isAdapter;
|
||||
}
|
||||
|
||||
_createClass(FileIOWrapper, [{
|
||||
key: "readIn",
|
||||
|
||||
|
||||
// Read in a message from the input asynchronously
|
||||
value: function readIn(errorHandler, messageProcessor) {
|
||||
var _this = this;
|
||||
|
||||
_fs2.default.readFile(this._inFilePath, { encoding: "utf8" }, function (err, contents) {
|
||||
if (err) {
|
||||
errorHandler(err);
|
||||
return;
|
||||
}
|
||||
var message = _this._packager.unpackage(contents);
|
||||
if (message === null) {
|
||||
_this.readIn(errorHandler, messageProcessor);
|
||||
return;
|
||||
}
|
||||
//clear the file
|
||||
_fs2.default.writeFileSync(_this._inFilePath, "");
|
||||
//process the message
|
||||
messageProcessor(message);
|
||||
});
|
||||
}
|
||||
|
||||
// Read in a message from the input synchronously
|
||||
|
||||
}, {
|
||||
key: "readInSync",
|
||||
value: function readInSync() {
|
||||
var message = null;
|
||||
while (true) {
|
||||
var contents = _fs2.default.readFileSync(this._inFilePath, "utf8");
|
||||
message = this._packager.unpackage(contents);
|
||||
if (message === null) continue;
|
||||
break;
|
||||
}
|
||||
// loop should not break when message is still null
|
||||
(0, _invariant2.default)(message !== null);
|
||||
//clear the file
|
||||
_fs2.default.writeFileSync(this._inFilePath, "");
|
||||
return message;
|
||||
}
|
||||
|
||||
// Read in a message from the input synchronously only once
|
||||
|
||||
}, {
|
||||
key: "readInSyncOnce",
|
||||
value: function readInSyncOnce() {
|
||||
var contents = _fs2.default.readFileSync(this._inFilePath, "utf8");
|
||||
var message = this._packager.unpackage(contents);
|
||||
return message;
|
||||
}
|
||||
|
||||
// Write out a message to the output synchronously
|
||||
|
||||
}, {
|
||||
key: "writeOutSync",
|
||||
value: function writeOutSync(contents) {
|
||||
_fs2.default.writeFileSync(this._outFilePath, this._packager.package(contents));
|
||||
}
|
||||
}, {
|
||||
key: "clearInFile",
|
||||
value: function clearInFile() {
|
||||
_fs2.default.writeFileSync(this._inFilePath, "");
|
||||
}
|
||||
}, {
|
||||
key: "clearOutFile",
|
||||
value: function clearOutFile() {
|
||||
_fs2.default.writeFileSync(this._outFilePath, "");
|
||||
}
|
||||
}]);
|
||||
|
||||
return FileIOWrapper;
|
||||
}();
|
||||
//# sourceMappingURL=FileIOWrapper.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/channel/FileIOWrapper.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/channel/FileIOWrapper.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/debugger/channel/FileIOWrapper.js"],"names":["FileIOWrapper","isAdapter","inFilePath","outFilePath","_inFilePath","join","__dirname","_outFilePath","_packager","_isAdapter","errorHandler","messageProcessor","readFile","encoding","err","contents","message","unpackage","readIn","writeFileSync","readFileSync","package"],"mappings":";;;;;;;qjBAAA;;;;;;;;;AAWA;;;;AACA;;;;AACA;;AACA;;;;;;;;IAEaA,a,WAAAA,a;AACX,yBAAYC,SAAZ,EAAgCC,UAAhC,EAAoDC,WAApD,EAAyE;AAAA;;AACvE;AACA,SAAKC,WAAL,GAAmB,eAAKC,IAAL,CAAUC,SAAV,EAAqB,WAArB,EAAkCJ,UAAlC,CAAnB;AACA,SAAKK,YAAL,GAAoB,eAAKF,IAAL,CAAUC,SAAV,EAAqB,WAArB,EAAkCH,WAAlC,CAApB;AACA,SAAKK,SAAL,GAAiB,qCAAoBP,SAApB,CAAjB;AACA,SAAKQ,UAAL,GAAkBR,SAAlB;AACD;;;;;;AAMD;2BACOS,Y,EAA0CC,gB,EAA6C;AAAA;;AAC5F,mBAAGC,QAAH,CAAY,KAAKR,WAAjB,EAA8B,EAAES,UAAU,MAAZ,EAA9B,EAAoD,UAACC,GAAD,EAAmBC,QAAnB,EAAwC;AAC1F,YAAID,GAAJ,EAAS;AACPJ,uBAAaI,GAAb;AACA;AACD;AACD,YAAIE,UAAU,MAAKR,SAAL,CAAeS,SAAf,CAAyBF,QAAzB,CAAd;AACA,YAAIC,YAAY,IAAhB,EAAsB;AACpB,gBAAKE,MAAL,CAAYR,YAAZ,EAA0BC,gBAA1B;AACA;AACD;AACD;AACA,qBAAGQ,aAAH,CAAiB,MAAKf,WAAtB,EAAmC,EAAnC;AACA;AACAO,yBAAiBK,OAAjB;AACD,OAdD;AAeD;;AAED;;;;iCACqB;AACnB,UAAIA,UAAyB,IAA7B;AACA,aAAO,IAAP,EAAa;AACX,YAAID,WAAW,aAAGK,YAAH,CAAgB,KAAKhB,WAArB,EAAkC,MAAlC,CAAf;AACAY,kBAAU,KAAKR,SAAL,CAAeS,SAAf,CAAyBF,QAAzB,CAAV;AACA,YAAIC,YAAY,IAAhB,EAAsB;AACtB;AACD;AACD;AACA,+BAAUA,YAAY,IAAtB;AACA;AACA,mBAAGG,aAAH,CAAiB,KAAKf,WAAtB,EAAmC,EAAnC;AACA,aAAOY,OAAP;AACD;;AAED;;;;qCACgC;AAC9B,UAAID,WAAW,aAAGK,YAAH,CAAgB,KAAKhB,WAArB,EAAkC,MAAlC,CAAf;AACA,UAAIY,UAAU,KAAKR,SAAL,CAAeS,SAAf,CAAyBF,QAAzB,CAAd;AACA,aAAOC,OAAP;AACD;;AAED;;;;iCACaD,Q,EAAkB;AAC7B,mBAAGI,aAAH,CAAiB,KAAKZ,YAAtB,EAAoC,KAAKC,SAAL,CAAea,OAAf,CAAuBN,QAAvB,CAApC;AACD;;;kCAEa;AACZ,mBAAGI,aAAH,CAAiB,KAAKf,WAAtB,EAAmC,EAAnC;AACD;;;mCAEc;AACb,mBAAGe,aAAH,CAAiB,KAAKZ,YAAtB,EAAoC,EAApC;AACD","file":"FileIOWrapper.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport fs from \"fs\";\nimport path from \"path\";\nimport { MessagePackager } from \"./MessagePackager.js\";\nimport invariant from \"../../invariant.js\";\n\nexport class FileIOWrapper {\n constructor(isAdapter: boolean, inFilePath: string, outFilePath: string) {\n // the paths are expected to be relative to Prepack top level directory\n this._inFilePath = path.join(__dirname, \"../../../\", inFilePath);\n this._outFilePath = path.join(__dirname, \"../../../\", outFilePath);\n this._packager = new MessagePackager(isAdapter);\n this._isAdapter = isAdapter;\n }\n _inFilePath: string;\n _outFilePath: string;\n _packager: MessagePackager;\n _isAdapter: boolean;\n\n // Read in a message from the input asynchronously\n readIn(errorHandler: (err: ?ErrnoError) => void, messageProcessor: (message: string) => void) {\n fs.readFile(this._inFilePath, { encoding: \"utf8\" }, (err: ?ErrnoError, contents: string) => {\n if (err) {\n errorHandler(err);\n return;\n }\n let message = this._packager.unpackage(contents);\n if (message === null) {\n this.readIn(errorHandler, messageProcessor);\n return;\n }\n //clear the file\n fs.writeFileSync(this._inFilePath, \"\");\n //process the message\n messageProcessor(message);\n });\n }\n\n // Read in a message from the input synchronously\n readInSync(): string {\n let message: null | string = null;\n while (true) {\n let contents = fs.readFileSync(this._inFilePath, \"utf8\");\n message = this._packager.unpackage(contents);\n if (message === null) continue;\n break;\n }\n // loop should not break when message is still null\n invariant(message !== null);\n //clear the file\n fs.writeFileSync(this._inFilePath, \"\");\n return message;\n }\n\n // Read in a message from the input synchronously only once\n readInSyncOnce(): null | string {\n let contents = fs.readFileSync(this._inFilePath, \"utf8\");\n let message = this._packager.unpackage(contents);\n return message;\n }\n\n // Write out a message to the output synchronously\n writeOutSync(contents: string) {\n fs.writeFileSync(this._outFilePath, this._packager.package(contents));\n }\n\n clearInFile() {\n fs.writeFileSync(this._inFilePath, \"\");\n }\n\n clearOutFile() {\n fs.writeFileSync(this._outFilePath, \"\");\n }\n}\n"]}
|
||||
469
build/node_modules/prepack/lib/debugger/channel/MessageMarshaller.js
generated
vendored
Normal file
469
build/node_modules/prepack/lib/debugger/channel/MessageMarshaller.js
generated
vendored
Normal file
@@ -0,0 +1,469 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.MessageMarshaller = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _DebugMessage = require("./DebugMessage.js");
|
||||
|
||||
var _invariant = require("./../../invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _DebuggerError = require("./../DebuggerError.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var MessageMarshaller = exports.MessageMarshaller = function () {
|
||||
function MessageMarshaller() {
|
||||
_classCallCheck(this, MessageMarshaller);
|
||||
|
||||
this._lastRunRequestID = 0;
|
||||
}
|
||||
|
||||
_createClass(MessageMarshaller, [{
|
||||
key: "marshallBreakpointAcknowledge",
|
||||
value: function marshallBreakpointAcknowledge(requestID, messageType, breakpoints) {
|
||||
return requestID + " " + messageType + " " + JSON.stringify(breakpoints);
|
||||
}
|
||||
}, {
|
||||
key: "marshallBreakpointStopped",
|
||||
value: function marshallBreakpointStopped(args) {
|
||||
return this._lastRunRequestID + " " + _DebugMessage.DebugMessage.BREAKPOINT_STOPPED_RESPONSE + " " + args.filePath + " " + args.line + " " + args.column;
|
||||
}
|
||||
}, {
|
||||
key: "marshallPrepackFinish",
|
||||
value: function marshallPrepackFinish() {
|
||||
return this._lastRunRequestID + " " + _DebugMessage.DebugMessage.PREPACK_FINISH_RESPONSE;
|
||||
}
|
||||
}, {
|
||||
key: "marshallDebuggerStart",
|
||||
value: function marshallDebuggerStart(requestID) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.DEBUGGER_ATTACHED;
|
||||
}
|
||||
}, {
|
||||
key: "marshallContinueRequest",
|
||||
value: function marshallContinueRequest(requestID) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.PREPACK_RUN_COMMAND;
|
||||
}
|
||||
}, {
|
||||
key: "marshallSetBreakpointsRequest",
|
||||
value: function marshallSetBreakpointsRequest(requestID, breakpoints) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.BREAKPOINT_ADD_COMMAND + " " + JSON.stringify(breakpoints);
|
||||
}
|
||||
}, {
|
||||
key: "marshallStackFramesRequest",
|
||||
value: function marshallStackFramesRequest(requestID) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.STACKFRAMES_COMMAND;
|
||||
}
|
||||
}, {
|
||||
key: "marshallStackFramesResponse",
|
||||
value: function marshallStackFramesResponse(requestID, stackframes) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.STACKFRAMES_RESPONSE + " " + JSON.stringify(stackframes);
|
||||
}
|
||||
}, {
|
||||
key: "marshallScopesRequest",
|
||||
value: function marshallScopesRequest(requestID, frameId) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.SCOPES_COMMAND + " " + frameId;
|
||||
}
|
||||
}, {
|
||||
key: "marshallScopesResponse",
|
||||
value: function marshallScopesResponse(requestID, scopes) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.SCOPES_RESPONSE + " " + JSON.stringify(scopes);
|
||||
}
|
||||
}, {
|
||||
key: "marshallVariablesRequest",
|
||||
value: function marshallVariablesRequest(requestID, variablesReference) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.VARIABLES_COMMAND + " " + variablesReference;
|
||||
}
|
||||
}, {
|
||||
key: "marshallVariablesResponse",
|
||||
value: function marshallVariablesResponse(requestID, variables) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.VARIABLES_RESPONSE + " " + JSON.stringify(variables);
|
||||
}
|
||||
}, {
|
||||
key: "unmarshallRequest",
|
||||
value: function unmarshallRequest(message) {
|
||||
var parts = message.split(" ");
|
||||
// each request must have a length and a command
|
||||
(0, _invariant2.default)(parts.length >= 2, "Request is not well formed");
|
||||
// unique ID for each request
|
||||
var requestID = parseInt(parts[0], 10);
|
||||
(0, _invariant2.default)(!isNaN(requestID), "Request ID must be a number");
|
||||
var command = parts[1];
|
||||
var args = void 0;
|
||||
switch (command) {
|
||||
case _DebugMessage.DebugMessage.PREPACK_RUN_COMMAND:
|
||||
this._lastRunRequestID = requestID;
|
||||
var runArgs = {
|
||||
kind: "run"
|
||||
};
|
||||
args = runArgs;
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.BREAKPOINT_ADD_COMMAND:
|
||||
args = this._unmarshallBreakpointsArguments(requestID, parts.slice(2).join(" "));
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.STACKFRAMES_COMMAND:
|
||||
var stackFrameArgs = {
|
||||
kind: "stackframe"
|
||||
};
|
||||
args = stackFrameArgs;
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.SCOPES_COMMAND:
|
||||
args = this._unmarshallScopesArguments(requestID, parts[2]);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.VARIABLES_COMMAND:
|
||||
args = this._unmarshallVariablesArguments(requestID, parts[2]);
|
||||
break;
|
||||
default:
|
||||
throw new _DebuggerError.DebuggerError("Invalid command", "Invalid command from adapter: " + command);
|
||||
}
|
||||
(0, _invariant2.default)(args !== undefined);
|
||||
var result = {
|
||||
id: requestID,
|
||||
command: command,
|
||||
arguments: args
|
||||
};
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "unmarshallResponse",
|
||||
value: function unmarshallResponse(message) {
|
||||
var parts = message.split(" ");
|
||||
var requestID = parseInt(parts[0], 10);
|
||||
(0, _invariant2.default)(!isNaN(requestID));
|
||||
var messageType = parts[1];
|
||||
var dbgResponse = void 0;
|
||||
if (messageType === _DebugMessage.DebugMessage.PREPACK_READY_RESPONSE) {
|
||||
dbgResponse = this._unmarshallReadyResponse(requestID);
|
||||
} else if (messageType === _DebugMessage.DebugMessage.BREAKPOINT_ADD_ACKNOWLEDGE) {
|
||||
dbgResponse = this._unmarshallBreakpointsAddResponse(requestID, parts.slice(2).join(" "));
|
||||
} else if (messageType === _DebugMessage.DebugMessage.BREAKPOINT_STOPPED_RESPONSE) {
|
||||
dbgResponse = this._unmarshallBreakpointStoppedResponse(requestID, parts.slice(2));
|
||||
} else if (messageType === _DebugMessage.DebugMessage.STACKFRAMES_RESPONSE) {
|
||||
dbgResponse = this._unmarshallStackframesResponse(requestID, parts.slice(2).join(" "));
|
||||
} else if (messageType === _DebugMessage.DebugMessage.SCOPES_RESPONSE) {
|
||||
dbgResponse = this._unmarshallScopesResponse(requestID, parts.slice(2).join(" "));
|
||||
} else if (messageType === _DebugMessage.DebugMessage.VARIABLES_RESPONSE) {
|
||||
dbgResponse = this._unmarshallVariablesResponse(requestID, parts.slice(2).join(" "));
|
||||
} else if (messageType === _DebugMessage.DebugMessage.PREPACK_FINISH_RESPONSE) {
|
||||
dbgResponse = this._unmarshallFinishResponse(requestID);
|
||||
} else {
|
||||
(0, _invariant2.default)(false, "Unexpected response type");
|
||||
}
|
||||
return dbgResponse;
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallBreakpointsArguments",
|
||||
value: function _unmarshallBreakpointsArguments(requestID, breakpointsString) {
|
||||
try {
|
||||
var breakpoints = JSON.parse(breakpointsString);
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = breakpoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var breakpoint = _step.value;
|
||||
|
||||
(0, _invariant2.default)(breakpoint.hasOwnProperty("filePath"), "breakpoint missing filePath property");
|
||||
(0, _invariant2.default)(breakpoint.hasOwnProperty("line"), "breakpoint missing line property");
|
||||
(0, _invariant2.default)(breakpoint.hasOwnProperty("column"), "breakpoint missing column property");
|
||||
(0, _invariant2.default)(!isNaN(breakpoint.line));
|
||||
(0, _invariant2.default)(!isNaN(breakpoint.column));
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var result = {
|
||||
kind: "breakpoint",
|
||||
breakpoints: breakpoints
|
||||
};
|
||||
return result;
|
||||
} catch (e) {
|
||||
throw new _DebuggerError.DebuggerError("Invalid command", e.message);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallScopesArguments",
|
||||
value: function _unmarshallScopesArguments(requestID, frameIdString) {
|
||||
var frameId = parseInt(frameIdString, 10);
|
||||
(0, _invariant2.default)(!isNaN(frameId));
|
||||
var result = {
|
||||
kind: "scopes",
|
||||
frameId: frameId
|
||||
};
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallVariablesArguments",
|
||||
value: function _unmarshallVariablesArguments(requestID, varRefString) {
|
||||
var varRef = parseInt(varRefString, 10);
|
||||
(0, _invariant2.default)(!isNaN(varRef));
|
||||
var result = {
|
||||
kind: "variables",
|
||||
variablesReference: varRef
|
||||
};
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallStackframesResponse",
|
||||
value: function _unmarshallStackframesResponse(requestID, responseBody) {
|
||||
try {
|
||||
var frames = JSON.parse(responseBody);
|
||||
(0, _invariant2.default)(Array.isArray(frames), "Stack frames is not an array");
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator2 = frames[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
||||
var frame = _step2.value;
|
||||
|
||||
(0, _invariant2.default)(frame.hasOwnProperty("id"), "Stack frame is missing id");
|
||||
(0, _invariant2.default)(frame.hasOwnProperty("fileName"), "Stack frame is missing filename");
|
||||
(0, _invariant2.default)(frame.hasOwnProperty("line"), "Stack frame is missing line number");
|
||||
(0, _invariant2.default)(frame.hasOwnProperty("column"), "Stack frame is missing column number");
|
||||
(0, _invariant2.default)(frame.hasOwnProperty("functionName"), "Stack frame is missing function name");
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var result = {
|
||||
kind: "stackframe",
|
||||
stackframes: frames
|
||||
};
|
||||
var dbgResponse = {
|
||||
id: requestID,
|
||||
result: result
|
||||
};
|
||||
return dbgResponse;
|
||||
} catch (e) {
|
||||
throw new _DebuggerError.DebuggerError("Invalid response", e.message);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallScopesResponse",
|
||||
value: function _unmarshallScopesResponse(requestID, responseBody) {
|
||||
try {
|
||||
var scopes = JSON.parse(responseBody);
|
||||
(0, _invariant2.default)(Array.isArray(scopes), "Scopes is not an array");
|
||||
var _iteratorNormalCompletion3 = true;
|
||||
var _didIteratorError3 = false;
|
||||
var _iteratorError3 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator3 = scopes[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
||||
var scope = _step3.value;
|
||||
|
||||
(0, _invariant2.default)(scope.hasOwnProperty("name"), "Scope is missing name");
|
||||
(0, _invariant2.default)(scope.hasOwnProperty("variablesReference"), "Scope is missing variablesReference");
|
||||
(0, _invariant2.default)(scope.hasOwnProperty("expensive"), "Scope is missing expensive");
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError3 = true;
|
||||
_iteratorError3 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
||||
_iterator3.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError3) {
|
||||
throw _iteratorError3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var result = {
|
||||
kind: "scopes",
|
||||
scopes: scopes
|
||||
};
|
||||
var dbgResponse = {
|
||||
id: requestID,
|
||||
result: result
|
||||
};
|
||||
return dbgResponse;
|
||||
} catch (e) {
|
||||
throw new _DebuggerError.DebuggerError("Invalid response", e.message);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallVariablesResponse",
|
||||
value: function _unmarshallVariablesResponse(requestID, responseBody) {
|
||||
try {
|
||||
var variables = JSON.parse(responseBody);
|
||||
(0, _invariant2.default)(Array.isArray(variables), "Variables is not an array");
|
||||
var _iteratorNormalCompletion4 = true;
|
||||
var _didIteratorError4 = false;
|
||||
var _iteratorError4 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator4 = variables[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
||||
var variable = _step4.value;
|
||||
|
||||
(0, _invariant2.default)(variable.hasOwnProperty("name"));
|
||||
(0, _invariant2.default)(variable.hasOwnProperty("value"));
|
||||
(0, _invariant2.default)(variable.hasOwnProperty("variablesReference"));
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError4 = true;
|
||||
_iteratorError4 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion4 && _iterator4.return) {
|
||||
_iterator4.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError4) {
|
||||
throw _iteratorError4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var result = {
|
||||
kind: "variables",
|
||||
variables: variables
|
||||
};
|
||||
var dbgResponse = {
|
||||
id: requestID,
|
||||
result: result
|
||||
};
|
||||
return dbgResponse;
|
||||
} catch (e) {
|
||||
throw new _DebuggerError.DebuggerError("Invalid response", e.message);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallBreakpointsAddResponse",
|
||||
value: function _unmarshallBreakpointsAddResponse(requestID, breakpointsString) {
|
||||
try {
|
||||
var breakpoints = JSON.parse(breakpointsString);
|
||||
var _iteratorNormalCompletion5 = true;
|
||||
var _didIteratorError5 = false;
|
||||
var _iteratorError5 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator5 = breakpoints[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
||||
var breakpoint = _step5.value;
|
||||
|
||||
(0, _invariant2.default)(breakpoint.hasOwnProperty("filePath"), "breakpoint missing filePath property");
|
||||
(0, _invariant2.default)(breakpoint.hasOwnProperty("line"), "breakpoint missing line property");
|
||||
(0, _invariant2.default)(breakpoint.hasOwnProperty("column"), "breakpoint missing column property");
|
||||
(0, _invariant2.default)(!isNaN(breakpoint.line));
|
||||
(0, _invariant2.default)(!isNaN(breakpoint.column));
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError5 = true;
|
||||
_iteratorError5 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion5 && _iterator5.return) {
|
||||
_iterator5.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError5) {
|
||||
throw _iteratorError5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var result = {
|
||||
kind: "breakpoint-add",
|
||||
breakpoints: breakpoints
|
||||
};
|
||||
var dbgResponse = {
|
||||
id: requestID,
|
||||
result: result
|
||||
};
|
||||
return dbgResponse;
|
||||
} catch (e) {
|
||||
throw new _DebuggerError.DebuggerError("Invalid response", e.message);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallBreakpointStoppedResponse",
|
||||
value: function _unmarshallBreakpointStoppedResponse(requestID, parts) {
|
||||
(0, _invariant2.default)(parts.length === 3, "Incorrect number of arguments in breakpoint stopped response");
|
||||
var filePath = parts[0];
|
||||
var line = parseInt(parts[1], 10);
|
||||
(0, _invariant2.default)(!isNaN(line), "Invalid line number");
|
||||
var column = parseInt(parts[2], 10);
|
||||
(0, _invariant2.default)(!isNaN(column), "Invalid column number");
|
||||
var result = {
|
||||
kind: "breakpoint-stopped",
|
||||
filePath: filePath,
|
||||
line: line,
|
||||
column: column
|
||||
};
|
||||
var dbgResponse = {
|
||||
id: requestID,
|
||||
result: result
|
||||
};
|
||||
return dbgResponse;
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallReadyResponse",
|
||||
value: function _unmarshallReadyResponse(requestID) {
|
||||
var result = {
|
||||
kind: "ready"
|
||||
};
|
||||
var dbgResponse = {
|
||||
id: requestID,
|
||||
result: result
|
||||
};
|
||||
return dbgResponse;
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallFinishResponse",
|
||||
value: function _unmarshallFinishResponse(requestID) {
|
||||
var result = {
|
||||
kind: "finish"
|
||||
};
|
||||
var dbgResponse = {
|
||||
id: requestID,
|
||||
result: result
|
||||
};
|
||||
return dbgResponse;
|
||||
}
|
||||
}]);
|
||||
|
||||
return MessageMarshaller;
|
||||
}();
|
||||
//# sourceMappingURL=MessageMarshaller.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/channel/MessageMarshaller.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/channel/MessageMarshaller.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
78
build/node_modules/prepack/lib/debugger/channel/MessagePackager.js
generated
vendored
Normal file
78
build/node_modules/prepack/lib/debugger/channel/MessagePackager.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.MessagePackager = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _invariant = require("../../invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var LENGTH_SEPARATOR = "--";
|
||||
|
||||
// Package a message sent or unpackage a message received
|
||||
|
||||
var MessagePackager = exports.MessagePackager = function () {
|
||||
function MessagePackager(isAdapter) {
|
||||
_classCallCheck(this, MessagePackager);
|
||||
|
||||
this._isAdapter = isAdapter;
|
||||
}
|
||||
|
||||
_createClass(MessagePackager, [{
|
||||
key: "package",
|
||||
|
||||
|
||||
// package a message to be sent
|
||||
value: function _package(contents) {
|
||||
// format: <length>--<contents>
|
||||
return contents.length + LENGTH_SEPARATOR + contents;
|
||||
}
|
||||
|
||||
// unpackage a message received, verify it, and return it
|
||||
// returns null if no message or the message is only partially read
|
||||
// errors if the message violates the format
|
||||
|
||||
}, {
|
||||
key: "unpackage",
|
||||
value: function unpackage(contents) {
|
||||
// format: <length>--<contents>
|
||||
var separatorIndex = contents.indexOf(LENGTH_SEPARATOR);
|
||||
// if the separator is not written in yet --> partial read
|
||||
if (separatorIndex === -1) {
|
||||
return null;
|
||||
}
|
||||
var messageLength = parseInt(contents.slice(0, separatorIndex), 10);
|
||||
// if the part before the separator is not a valid length, it is a
|
||||
// violation of protocol
|
||||
(0, _invariant2.default)(!isNaN(messageLength));
|
||||
var startIndex = separatorIndex + LENGTH_SEPARATOR.length;
|
||||
var endIndex = startIndex + messageLength;
|
||||
// there should only be one message in the contents at a time
|
||||
(0, _invariant2.default)(contents.length <= startIndex + messageLength);
|
||||
// if we didn't read the whole message yet --> partial read
|
||||
if (contents.length < endIndex) {
|
||||
return null;
|
||||
}
|
||||
var message = contents.slice(startIndex, endIndex);
|
||||
return message;
|
||||
}
|
||||
}]);
|
||||
|
||||
return MessagePackager;
|
||||
}();
|
||||
//# sourceMappingURL=MessagePackager.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/channel/MessagePackager.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/channel/MessagePackager.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/debugger/channel/MessagePackager.js"],"names":["LENGTH_SEPARATOR","MessagePackager","isAdapter","_isAdapter","contents","length","separatorIndex","indexOf","messageLength","parseInt","slice","isNaN","startIndex","endIndex","message"],"mappings":";;;;;;;qjBAAA;;;;;;;;;AAWA;;;;;;;;AAEA,IAAMA,mBAAmB,IAAzB;;AAEA;;IACaC,e,WAAAA,e;AACX,2BAAYC,SAAZ,EAAgC;AAAA;;AAC9B,SAAKC,UAAL,GAAkBD,SAAlB;AACD;;;;;;AAGD;6BACQE,Q,EAA0B;AAChC;AACA,aAAOA,SAASC,MAAT,GAAkBL,gBAAlB,GAAqCI,QAA5C;AACD;;AAED;AACA;AACA;;;;8BACUA,Q,EAAiC;AACzC;AACA,UAAIE,iBAAiBF,SAASG,OAAT,CAAiBP,gBAAjB,CAArB;AACA;AACA,UAAIM,mBAAmB,CAAC,CAAxB,EAA2B;AACzB,eAAO,IAAP;AACD;AACD,UAAIE,gBAAgBC,SAASL,SAASM,KAAT,CAAe,CAAf,EAAkBJ,cAAlB,CAAT,EAA4C,EAA5C,CAApB;AACA;AACA;AACA,+BAAU,CAACK,MAAMH,aAAN,CAAX;AACA,UAAII,aAAaN,iBAAiBN,iBAAiBK,MAAnD;AACA,UAAIQ,WAAWD,aAAaJ,aAA5B;AACA;AACA,+BAAUJ,SAASC,MAAT,IAAmBO,aAAaJ,aAA1C;AACA;AACA,UAAIJ,SAASC,MAAT,GAAkBQ,QAAtB,EAAgC;AAC9B,eAAO,IAAP;AACD;AACD,UAAIC,UAAUV,SAASM,KAAT,CAAeE,UAAf,EAA2BC,QAA3B,CAAd;AACA,aAAOC,OAAP;AACD","file":"MessagePackager.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport invariant from \"../../invariant.js\";\n\nconst LENGTH_SEPARATOR = \"--\";\n\n// Package a message sent or unpackage a message received\nexport class MessagePackager {\n constructor(isAdapter: boolean) {\n this._isAdapter = isAdapter;\n }\n _isAdapter: boolean;\n\n // package a message to be sent\n package(contents: string): string {\n // format: <length>--<contents>\n return contents.length + LENGTH_SEPARATOR + contents;\n }\n\n // unpackage a message received, verify it, and return it\n // returns null if no message or the message is only partially read\n // errors if the message violates the format\n unpackage(contents: string): null | string {\n // format: <length>--<contents>\n let separatorIndex = contents.indexOf(LENGTH_SEPARATOR);\n // if the separator is not written in yet --> partial read\n if (separatorIndex === -1) {\n return null;\n }\n let messageLength = parseInt(contents.slice(0, separatorIndex), 10);\n // if the part before the separator is not a valid length, it is a\n // violation of protocol\n invariant(!isNaN(messageLength));\n let startIndex = separatorIndex + LENGTH_SEPARATOR.length;\n let endIndex = startIndex + messageLength;\n // there should only be one message in the contents at a time\n invariant(contents.length <= startIndex + messageLength);\n // if we didn't read the whole message yet --> partial read\n if (contents.length < endIndex) {\n return null;\n }\n let message = contents.slice(startIndex, endIndex);\n return message;\n }\n}\n"]}
|
||||
25
build/node_modules/prepack/lib/debugger/common/DebuggerConstants.js
generated
vendored
Normal file
25
build/node_modules/prepack/lib/debugger/common/DebuggerConstants.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
/**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var DebuggerConstants = exports.DebuggerConstants = function DebuggerConstants() {
|
||||
_classCallCheck(this, DebuggerConstants);
|
||||
};
|
||||
|
||||
DebuggerConstants.DEFAULT_REQUEST_ID = 0;
|
||||
DebuggerConstants.PREPACK_THREAD_ID = 1;
|
||||
DebuggerConstants.CLI_CLIENTID = "Prepack-Debugger-CLI";
|
||||
//# sourceMappingURL=DebuggerConstants.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/common/DebuggerConstants.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/common/DebuggerConstants.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/debugger/common/DebuggerConstants.js"],"names":["DebuggerConstants","DEFAULT_REQUEST_ID","PREPACK_THREAD_ID","CLI_CLIENTID"],"mappings":";;;;;;;;AAAA;;;;;;;;;IAWaA,iB,WAAAA,iB;;;;AAAAA,iB,CAIJC,kB,GAA6B,C;AAJzBD,iB,CASJE,iB,GAA4B,C;AATxBF,iB,CAYJG,Y,GAAuB,sB","file":"DebuggerConstants.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nexport class DebuggerConstants {\n // request ID used between the debug adapter and Prepack when there is no\n // corresponding command from the UI. Currently, this is only used on starting\n // up Prepack\n static DEFAULT_REQUEST_ID: number = 0;\n\n // some requests/responses require a thread ID according to vscode protocol\n // since Prepack only has 1 thread, we use this constant where a thread ID\n // is required\n static PREPACK_THREAD_ID: number = 1;\n\n // clientID used in initialize requests by the CLI\n static CLI_CLIENTID: string = \"Prepack-Debugger-CLI\";\n}\n"]}
|
||||
24
build/node_modules/prepack/lib/debugger/common/DebuggerError.js
generated
vendored
Normal file
24
build/node_modules/prepack/lib/debugger/common/DebuggerError.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var DebuggerError = exports.DebuggerError = function DebuggerError(errorType, message) {
|
||||
_classCallCheck(this, DebuggerError);
|
||||
|
||||
this.errorType = errorType;
|
||||
this.message = message;
|
||||
}; /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
// More error types will be added as needed
|
||||
//# sourceMappingURL=DebuggerError.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/common/DebuggerError.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/common/DebuggerError.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/debugger/common/DebuggerError.js"],"names":["DebuggerError","errorType","message"],"mappings":";;;;;;;;IAcaA,a,WAAAA,a,GACX,uBAAYC,SAAZ,EAA0CC,OAA1C,EAA2D;AAAA;;AACzD,OAAKD,SAAL,GAAiBA,SAAjB;AACA,OAAKC,OAAL,GAAeA,OAAf;AACD,C,EAlBH;;;;;;;;;AAWA","file":"DebuggerError.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\n// More error types will be added as needed\nexport type DebuggerErrorType = \"Invalid command\" | \"Invalid response\";\n\nexport class DebuggerError {\n constructor(errorType: DebuggerErrorType, message: string) {\n this.errorType = errorType;\n this.message = message;\n }\n errorType: DebuggerErrorType;\n message: string;\n}\n"]}
|
||||
47
build/node_modules/prepack/lib/debugger/common/channel/DebugMessage.js
generated
vendored
Normal file
47
build/node_modules/prepack/lib/debugger/common/channel/DebugMessage.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
/**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
//A collection of messages used between Prepack and the debug adapter
|
||||
var DebugMessage = exports.DebugMessage = function DebugMessage() {
|
||||
_classCallCheck(this, DebugMessage);
|
||||
};
|
||||
|
||||
DebugMessage.DEBUGGER_ATTACHED = "DebuggerAttached";
|
||||
DebugMessage.PREPACK_RUN_COMMAND = "PrepackRun";
|
||||
DebugMessage.BREAKPOINT_ADD_COMMAND = "Breakpoint-add-command";
|
||||
DebugMessage.BREAKPOINT_REMOVE_COMMAND = "Breakpoint-remove-command";
|
||||
DebugMessage.BREAKPOINT_ENABLE_COMMAND = "Breakpoint-enable-command";
|
||||
DebugMessage.BREAKPOINT_DISABLE_COMMAND = "Breakpoint-disable-command";
|
||||
DebugMessage.STACKFRAMES_COMMAND = "Stackframes-command";
|
||||
DebugMessage.SCOPES_COMMAND = "Scopes-command";
|
||||
DebugMessage.VARIABLES_COMMAND = "Variables-command";
|
||||
DebugMessage.STEPINTO_COMMAND = "StepInto-command";
|
||||
DebugMessage.STEPOVER_COMMAND = "StepOver-command";
|
||||
DebugMessage.EVALUATE_COMMAND = "Evaluate-command";
|
||||
DebugMessage.PREPACK_READY_RESPONSE = "PrepackReady";
|
||||
DebugMessage.PREPACK_FINISH_RESPONSE = "PrepackFinish";
|
||||
DebugMessage.STOPPED_RESPONSE = "Stopped-response";
|
||||
DebugMessage.STACKFRAMES_RESPONSE = "Stackframes-response";
|
||||
DebugMessage.SCOPES_RESPONSE = "Scopes-response";
|
||||
DebugMessage.VARIABLES_RESPONSE = "Variables-response";
|
||||
DebugMessage.STEPINTO_RESPONSE = "StepInto-response";
|
||||
DebugMessage.EVALUATE_RESPONSE = "Evaluate-response";
|
||||
DebugMessage.BREAKPOINT_ADD_ACKNOWLEDGE = "Breakpoint-add-acknowledge";
|
||||
DebugMessage.BREAKPOINT_REMOVE_ACKNOWLEDGE = "Breakpoint-remove-acknowledge";
|
||||
DebugMessage.BREAKPOINT_ENABLE_ACKNOWLEDGE = "Breakpoint-enable-acknowledge";
|
||||
DebugMessage.BREAKPOINT_DISABLE_ACKNOWLEDGE = "Breakpoint-disable-acknowledge";
|
||||
//# sourceMappingURL=DebugMessage.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/common/channel/DebugMessage.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/common/channel/DebugMessage.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/debugger/common/channel/DebugMessage.js"],"names":["DebugMessage","DEBUGGER_ATTACHED","PREPACK_RUN_COMMAND","BREAKPOINT_ADD_COMMAND","BREAKPOINT_REMOVE_COMMAND","BREAKPOINT_ENABLE_COMMAND","BREAKPOINT_DISABLE_COMMAND","STACKFRAMES_COMMAND","SCOPES_COMMAND","VARIABLES_COMMAND","STEPINTO_COMMAND","STEPOVER_COMMAND","EVALUATE_COMMAND","PREPACK_READY_RESPONSE","PREPACK_FINISH_RESPONSE","STOPPED_RESPONSE","STACKFRAMES_RESPONSE","SCOPES_RESPONSE","VARIABLES_RESPONSE","STEPINTO_RESPONSE","EVALUATE_RESPONSE","BREAKPOINT_ADD_ACKNOWLEDGE","BREAKPOINT_REMOVE_ACKNOWLEDGE","BREAKPOINT_ENABLE_ACKNOWLEDGE","BREAKPOINT_DISABLE_ACKNOWLEDGE"],"mappings":";;;;;;;;AAAA;;;;;;;;;AAWA;IACaA,Y,WAAAA,Y;;;;AAAAA,Y,CAGJC,iB,GAA4B,kB;AAHxBD,Y,CAKJE,mB,GAA8B,Y;AAL1BF,Y,CAOJG,sB,GAAiC,wB;AAP7BH,Y,CASJI,yB,GAAoC,2B;AAThCJ,Y,CAWJK,yB,GAAoC,2B;AAXhCL,Y,CAaJM,0B,GAAqC,4B;AAbjCN,Y,CAeJO,mB,GAA8B,qB;AAf1BP,Y,CAiBJQ,c,GAAyB,gB;AAjBrBR,Y,CAmBJS,iB,GAA4B,mB;AAnBxBT,Y,CAqBJU,gB,GAA2B,kB;AArBvBV,Y,CAuBJW,gB,GAA2B,kB;AAvBvBX,Y,CAyBJY,gB,GAA2B,kB;AAzBvBZ,Y,CA6BJa,sB,GAAiC,c;AA7B7Bb,Y,CA+BJc,uB,GAAkC,e;AA/B9Bd,Y,CAiCJe,gB,GAA2B,kB;AAjCvBf,Y,CAmCJgB,oB,GAA+B,sB;AAnC3BhB,Y,CAqCJiB,e,GAA0B,iB;AArCtBjB,Y,CAuCJkB,kB,GAA6B,oB;AAvCzBlB,Y,CAyCJmB,iB,GAA4B,mB;AAzCxBnB,Y,CA2CJoB,iB,GAA4B,mB;AA3CxBpB,Y,CA+CJqB,0B,GAAqC,4B;AA/CjCrB,Y,CAiDJsB,6B,GAAwC,+B;AAjDpCtB,Y,CAmDJuB,6B,GAAwC,+B;AAnDpCvB,Y,CAqDJwB,8B,GAAyC,gC","file":"DebugMessage.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\n//A collection of messages used between Prepack and the debug adapter\nexport class DebugMessage {\n /* Messages from adapter to Prepack */\n // Tell Prepack a debugger is present\n static DEBUGGER_ATTACHED: string = \"DebuggerAttached\";\n // Command Prepack to keep running\n static PREPACK_RUN_COMMAND: string = \"PrepackRun\";\n // Command to set a breakpoint\n static BREAKPOINT_ADD_COMMAND: string = \"Breakpoint-add-command\";\n // Command to remove a breakpoint\n static BREAKPOINT_REMOVE_COMMAND: string = \"Breakpoint-remove-command\";\n // Command to enable a breakpoint\n static BREAKPOINT_ENABLE_COMMAND: string = \"Breakpoint-enable-command\";\n // Command to disable a breakpoint\n static BREAKPOINT_DISABLE_COMMAND: string = \"Breakpoint-disable-command\";\n // Command to fetch stack frames\n static STACKFRAMES_COMMAND: string = \"Stackframes-command\";\n // Command to fetch scopes\n static SCOPES_COMMAND: string = \"Scopes-command\";\n // Command to fetch variables\n static VARIABLES_COMMAND: string = \"Variables-command\";\n // Command to step into a function\n static STEPINTO_COMMAND: string = \"StepInto-command\";\n // Command to step over a function\n static STEPOVER_COMMAND: string = \"StepOver-command\";\n // Command to evaluate an expression\n static EVALUATE_COMMAND: string = \"Evaluate-command\";\n\n /* Messages from Prepack to adapter with requested information */\n // Respond to the adapter that Prepack is ready\n static PREPACK_READY_RESPONSE: string = \"PrepackReady\";\n // Respond to the adapter that Prepack is finished\n static PREPACK_FINISH_RESPONSE: string = \"PrepackFinish\";\n // Respond to the adapter that Prepack has stopped\n static STOPPED_RESPONSE: string = \"Stopped-response\";\n // Respond to the adapter with the request stackframes\n static STACKFRAMES_RESPONSE: string = \"Stackframes-response\";\n // Respond to the adapter with the requested scopes\n static SCOPES_RESPONSE: string = \"Scopes-response\";\n // Respond to the adapter with the requested variables\n static VARIABLES_RESPONSE: string = \"Variables-response\";\n // Respond to the adapter with the stepped in location\n static STEPINTO_RESPONSE: string = \"StepInto-response\";\n // Respond to the adapter with the evaluation results\n static EVALUATE_RESPONSE: string = \"Evaluate-response\";\n\n /* Messages from Prepack to adapter to acknowledge having received the request */\n // Acknowledgement for setting a breakpoint\n static BREAKPOINT_ADD_ACKNOWLEDGE: string = \"Breakpoint-add-acknowledge\";\n // Acknowledgement for removing a breakpoint\n static BREAKPOINT_REMOVE_ACKNOWLEDGE: string = \"Breakpoint-remove-acknowledge\";\n // Acknowledgement for enabling a breakpoint\n static BREAKPOINT_ENABLE_ACKNOWLEDGE: string = \"Breakpoint-enable-acknowledge\";\n // Acknoledgement for disabling a breakpoint\n static BREAKPOINT_DISABLE_ACKNOWLEDGE: string = \"Breakpoint-disable-acknowledge\";\n}\n"]}
|
||||
118
build/node_modules/prepack/lib/debugger/common/channel/FileIOWrapper.js
generated
vendored
Normal file
118
build/node_modules/prepack/lib/debugger/common/channel/FileIOWrapper.js
generated
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.FileIOWrapper = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _fs = require("fs");
|
||||
|
||||
var _fs2 = _interopRequireDefault(_fs);
|
||||
|
||||
var _MessagePackager = require("./MessagePackager.js");
|
||||
|
||||
var _invariant = require("../invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var FileIOWrapper = exports.FileIOWrapper = function () {
|
||||
function FileIOWrapper(isAdapter, inFilePath, outFilePath) {
|
||||
_classCallCheck(this, FileIOWrapper);
|
||||
|
||||
this._inFilePath = inFilePath;
|
||||
this._outFilePath = outFilePath;
|
||||
if (!_fs2.default.existsSync(this._inFilePath)) _fs2.default.openSync(this._inFilePath, "w");
|
||||
if (!_fs2.default.existsSync(this._outFilePath)) _fs2.default.openSync(this._outFilePath, "w");
|
||||
this._packager = new _MessagePackager.MessagePackager(isAdapter);
|
||||
this._isAdapter = isAdapter;
|
||||
}
|
||||
|
||||
_createClass(FileIOWrapper, [{
|
||||
key: "readIn",
|
||||
|
||||
|
||||
// Read in a message from the input asynchronously
|
||||
value: function readIn(errorHandler, messageProcessor) {
|
||||
var _this = this;
|
||||
|
||||
_fs2.default.readFile(this._inFilePath, { encoding: "utf8" }, function (err, contents) {
|
||||
if (err) {
|
||||
errorHandler(err);
|
||||
return;
|
||||
}
|
||||
var message = _this._packager.unpackage(contents);
|
||||
if (message === null) {
|
||||
_this.readIn(errorHandler, messageProcessor);
|
||||
return;
|
||||
}
|
||||
//clear the file
|
||||
_fs2.default.writeFileSync(_this._inFilePath, "");
|
||||
//process the message
|
||||
messageProcessor(message);
|
||||
});
|
||||
}
|
||||
|
||||
// Read in a message from the input synchronously
|
||||
|
||||
}, {
|
||||
key: "readInSync",
|
||||
value: function readInSync() {
|
||||
var message = null;
|
||||
while (true) {
|
||||
var contents = _fs2.default.readFileSync(this._inFilePath, "utf8");
|
||||
message = this._packager.unpackage(contents);
|
||||
if (message === null) continue;
|
||||
break;
|
||||
}
|
||||
// loop should not break when message is still null
|
||||
(0, _invariant2.default)(message !== null);
|
||||
//clear the file
|
||||
_fs2.default.writeFileSync(this._inFilePath, "");
|
||||
return message;
|
||||
}
|
||||
|
||||
// Read in a message from the input synchronously only once
|
||||
|
||||
}, {
|
||||
key: "readInSyncOnce",
|
||||
value: function readInSyncOnce() {
|
||||
var contents = _fs2.default.readFileSync(this._inFilePath, "utf8");
|
||||
var message = this._packager.unpackage(contents);
|
||||
return message;
|
||||
}
|
||||
|
||||
// Write out a message to the output synchronously
|
||||
|
||||
}, {
|
||||
key: "writeOutSync",
|
||||
value: function writeOutSync(contents) {
|
||||
_fs2.default.writeFileSync(this._outFilePath, this._packager.package(contents));
|
||||
}
|
||||
}, {
|
||||
key: "clearInFile",
|
||||
value: function clearInFile() {
|
||||
_fs2.default.writeFileSync(this._inFilePath, "");
|
||||
}
|
||||
}, {
|
||||
key: "clearOutFile",
|
||||
value: function clearOutFile() {
|
||||
_fs2.default.writeFileSync(this._outFilePath, "");
|
||||
}
|
||||
}]);
|
||||
|
||||
return FileIOWrapper;
|
||||
}();
|
||||
//# sourceMappingURL=FileIOWrapper.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/common/channel/FileIOWrapper.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/common/channel/FileIOWrapper.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/debugger/common/channel/FileIOWrapper.js"],"names":["FileIOWrapper","isAdapter","inFilePath","outFilePath","_inFilePath","_outFilePath","existsSync","openSync","_packager","_isAdapter","errorHandler","messageProcessor","readFile","encoding","err","contents","message","unpackage","readIn","writeFileSync","readFileSync","package"],"mappings":";;;;;;;qjBAAA;;;;;;;;;AAWA;;;;AACA;;AACA;;;;;;;;IAEaA,a,WAAAA,a;AACX,yBAAYC,SAAZ,EAAgCC,UAAhC,EAAoDC,WAApD,EAAyE;AAAA;;AACvE,SAAKC,WAAL,GAAmBF,UAAnB;AACA,SAAKG,YAAL,GAAoBF,WAApB;AACA,QAAI,CAAC,aAAGG,UAAH,CAAc,KAAKF,WAAnB,CAAL,EAAsC,aAAGG,QAAH,CAAY,KAAKH,WAAjB,EAA8B,GAA9B;AACtC,QAAI,CAAC,aAAGE,UAAH,CAAc,KAAKD,YAAnB,CAAL,EAAuC,aAAGE,QAAH,CAAY,KAAKF,YAAjB,EAA+B,GAA/B;AACvC,SAAKG,SAAL,GAAiB,qCAAoBP,SAApB,CAAjB;AACA,SAAKQ,UAAL,GAAkBR,SAAlB;AACD;;;;;;AAMD;2BACOS,Y,EAA0CC,gB,EAA6C;AAAA;;AAC5F,mBAAGC,QAAH,CAAY,KAAKR,WAAjB,EAA8B,EAAES,UAAU,MAAZ,EAA9B,EAAoD,UAACC,GAAD,EAAmBC,QAAnB,EAAwC;AAC1F,YAAID,GAAJ,EAAS;AACPJ,uBAAaI,GAAb;AACA;AACD;AACD,YAAIE,UAAU,MAAKR,SAAL,CAAeS,SAAf,CAAyBF,QAAzB,CAAd;AACA,YAAIC,YAAY,IAAhB,EAAsB;AACpB,gBAAKE,MAAL,CAAYR,YAAZ,EAA0BC,gBAA1B;AACA;AACD;AACD;AACA,qBAAGQ,aAAH,CAAiB,MAAKf,WAAtB,EAAmC,EAAnC;AACA;AACAO,yBAAiBK,OAAjB;AACD,OAdD;AAeD;;AAED;;;;iCACqB;AACnB,UAAIA,UAAyB,IAA7B;AACA,aAAO,IAAP,EAAa;AACX,YAAID,WAAW,aAAGK,YAAH,CAAgB,KAAKhB,WAArB,EAAkC,MAAlC,CAAf;AACAY,kBAAU,KAAKR,SAAL,CAAeS,SAAf,CAAyBF,QAAzB,CAAV;AACA,YAAIC,YAAY,IAAhB,EAAsB;AACtB;AACD;AACD;AACA,+BAAUA,YAAY,IAAtB;AACA;AACA,mBAAGG,aAAH,CAAiB,KAAKf,WAAtB,EAAmC,EAAnC;AACA,aAAOY,OAAP;AACD;;AAED;;;;qCACgC;AAC9B,UAAID,WAAW,aAAGK,YAAH,CAAgB,KAAKhB,WAArB,EAAkC,MAAlC,CAAf;AACA,UAAIY,UAAU,KAAKR,SAAL,CAAeS,SAAf,CAAyBF,QAAzB,CAAd;AACA,aAAOC,OAAP;AACD;;AAED;;;;iCACaD,Q,EAAkB;AAC7B,mBAAGI,aAAH,CAAiB,KAAKd,YAAtB,EAAoC,KAAKG,SAAL,CAAea,OAAf,CAAuBN,QAAvB,CAApC;AACD;;;kCAEa;AACZ,mBAAGI,aAAH,CAAiB,KAAKf,WAAtB,EAAmC,EAAnC;AACD;;;mCAEc;AACb,mBAAGe,aAAH,CAAiB,KAAKd,YAAtB,EAAoC,EAApC;AACD","file":"FileIOWrapper.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport fs from \"fs\";\nimport { MessagePackager } from \"./MessagePackager.js\";\nimport invariant from \"../invariant.js\";\n\nexport class FileIOWrapper {\n constructor(isAdapter: boolean, inFilePath: string, outFilePath: string) {\n this._inFilePath = inFilePath;\n this._outFilePath = outFilePath;\n if (!fs.existsSync(this._inFilePath)) fs.openSync(this._inFilePath, \"w\");\n if (!fs.existsSync(this._outFilePath)) fs.openSync(this._outFilePath, \"w\");\n this._packager = new MessagePackager(isAdapter);\n this._isAdapter = isAdapter;\n }\n _inFilePath: string;\n _outFilePath: string;\n _packager: MessagePackager;\n _isAdapter: boolean;\n\n // Read in a message from the input asynchronously\n readIn(errorHandler: (err: ?ErrnoError) => void, messageProcessor: (message: string) => void) {\n fs.readFile(this._inFilePath, { encoding: \"utf8\" }, (err: ?ErrnoError, contents: string) => {\n if (err) {\n errorHandler(err);\n return;\n }\n let message = this._packager.unpackage(contents);\n if (message === null) {\n this.readIn(errorHandler, messageProcessor);\n return;\n }\n //clear the file\n fs.writeFileSync(this._inFilePath, \"\");\n //process the message\n messageProcessor(message);\n });\n }\n\n // Read in a message from the input synchronously\n readInSync(): string {\n let message: null | string = null;\n while (true) {\n let contents = fs.readFileSync(this._inFilePath, \"utf8\");\n message = this._packager.unpackage(contents);\n if (message === null) continue;\n break;\n }\n // loop should not break when message is still null\n invariant(message !== null);\n //clear the file\n fs.writeFileSync(this._inFilePath, \"\");\n return message;\n }\n\n // Read in a message from the input synchronously only once\n readInSyncOnce(): null | string {\n let contents = fs.readFileSync(this._inFilePath, \"utf8\");\n let message = this._packager.unpackage(contents);\n return message;\n }\n\n // Write out a message to the output synchronously\n writeOutSync(contents: string) {\n fs.writeFileSync(this._outFilePath, this._packager.package(contents));\n }\n\n clearInFile() {\n fs.writeFileSync(this._inFilePath, \"\");\n }\n\n clearOutFile() {\n fs.writeFileSync(this._outFilePath, \"\");\n }\n}\n"]}
|
||||
486
build/node_modules/prepack/lib/debugger/common/channel/MessageMarshaller.js
generated
vendored
Normal file
486
build/node_modules/prepack/lib/debugger/common/channel/MessageMarshaller.js
generated
vendored
Normal file
@@ -0,0 +1,486 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.MessageMarshaller = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _DebugMessage = require("./DebugMessage.js");
|
||||
|
||||
var _invariant = require("./../invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _DebuggerError = require("./../DebuggerError.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var MessageMarshaller = exports.MessageMarshaller = function () {
|
||||
function MessageMarshaller() {
|
||||
_classCallCheck(this, MessageMarshaller);
|
||||
|
||||
this._lastRunRequestID = 0;
|
||||
}
|
||||
|
||||
_createClass(MessageMarshaller, [{
|
||||
key: "marshallBreakpointAcknowledge",
|
||||
value: function marshallBreakpointAcknowledge(requestID, messageType, breakpoints) {
|
||||
return requestID + " " + messageType + " " + JSON.stringify(breakpoints);
|
||||
}
|
||||
}, {
|
||||
key: "marshallStoppedResponse",
|
||||
value: function marshallStoppedResponse(reason, filePath, line, column) {
|
||||
var result = {
|
||||
kind: "stopped",
|
||||
reason: reason,
|
||||
filePath: filePath,
|
||||
line: line,
|
||||
column: column
|
||||
};
|
||||
return this._lastRunRequestID + " " + _DebugMessage.DebugMessage.STOPPED_RESPONSE + " " + JSON.stringify(result);
|
||||
}
|
||||
}, {
|
||||
key: "marshallDebuggerStart",
|
||||
value: function marshallDebuggerStart(requestID) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.DEBUGGER_ATTACHED;
|
||||
}
|
||||
}, {
|
||||
key: "marshallContinueRequest",
|
||||
value: function marshallContinueRequest(requestID) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.PREPACK_RUN_COMMAND;
|
||||
}
|
||||
}, {
|
||||
key: "marshallSetBreakpointsRequest",
|
||||
value: function marshallSetBreakpointsRequest(requestID, breakpoints) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.BREAKPOINT_ADD_COMMAND + " " + JSON.stringify(breakpoints);
|
||||
}
|
||||
}, {
|
||||
key: "marshallStackFramesRequest",
|
||||
value: function marshallStackFramesRequest(requestID) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.STACKFRAMES_COMMAND;
|
||||
}
|
||||
}, {
|
||||
key: "marshallStackFramesResponse",
|
||||
value: function marshallStackFramesResponse(requestID, stackframes) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.STACKFRAMES_RESPONSE + " " + JSON.stringify(stackframes);
|
||||
}
|
||||
}, {
|
||||
key: "marshallScopesRequest",
|
||||
value: function marshallScopesRequest(requestID, frameId) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.SCOPES_COMMAND + " " + frameId;
|
||||
}
|
||||
}, {
|
||||
key: "marshallScopesResponse",
|
||||
value: function marshallScopesResponse(requestID, scopes) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.SCOPES_RESPONSE + " " + JSON.stringify(scopes);
|
||||
}
|
||||
}, {
|
||||
key: "marshallVariablesRequest",
|
||||
value: function marshallVariablesRequest(requestID, variablesReference) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.VARIABLES_COMMAND + " " + variablesReference;
|
||||
}
|
||||
}, {
|
||||
key: "marshallVariablesResponse",
|
||||
value: function marshallVariablesResponse(requestID, variables) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.VARIABLES_RESPONSE + " " + JSON.stringify(variables);
|
||||
}
|
||||
}, {
|
||||
key: "marshallStepIntoRequest",
|
||||
value: function marshallStepIntoRequest(requestID) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.STEPINTO_COMMAND;
|
||||
}
|
||||
}, {
|
||||
key: "marshallStepOverRequest",
|
||||
value: function marshallStepOverRequest(requestID) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.STEPOVER_COMMAND;
|
||||
}
|
||||
}, {
|
||||
key: "marshallEvaluateRequest",
|
||||
value: function marshallEvaluateRequest(requestID, frameId, expression) {
|
||||
var evalArgs = {
|
||||
kind: "evaluate",
|
||||
expression: expression
|
||||
};
|
||||
if (frameId !== undefined) {
|
||||
evalArgs.frameId = frameId;
|
||||
}
|
||||
return requestID + " " + _DebugMessage.DebugMessage.EVALUATE_COMMAND + " " + JSON.stringify(evalArgs);
|
||||
}
|
||||
}, {
|
||||
key: "marshallEvaluateResponse",
|
||||
value: function marshallEvaluateResponse(requestID, evalResult) {
|
||||
return requestID + " " + _DebugMessage.DebugMessage.EVALUATE_RESPONSE + " " + JSON.stringify(evalResult);
|
||||
}
|
||||
}, {
|
||||
key: "unmarshallRequest",
|
||||
value: function unmarshallRequest(message) {
|
||||
var parts = message.split(" ");
|
||||
// each request must have a length and a command
|
||||
(0, _invariant2.default)(parts.length >= 2, "Request is not well formed");
|
||||
// unique ID for each request
|
||||
var requestID = parseInt(parts[0], 10);
|
||||
(0, _invariant2.default)(!isNaN(requestID), "Request ID must be a number");
|
||||
var command = parts[1];
|
||||
var args = void 0;
|
||||
switch (command) {
|
||||
case _DebugMessage.DebugMessage.PREPACK_RUN_COMMAND:
|
||||
this._lastRunRequestID = requestID;
|
||||
var runArgs = {
|
||||
kind: "run"
|
||||
};
|
||||
args = runArgs;
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.BREAKPOINT_ADD_COMMAND:
|
||||
args = this._unmarshallBreakpointsArguments(requestID, parts.slice(2).join(" "));
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.STACKFRAMES_COMMAND:
|
||||
var stackFrameArgs = {
|
||||
kind: "stackframe"
|
||||
};
|
||||
args = stackFrameArgs;
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.SCOPES_COMMAND:
|
||||
args = this._unmarshallScopesArguments(requestID, parts[2]);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.VARIABLES_COMMAND:
|
||||
args = this._unmarshallVariablesArguments(requestID, parts[2]);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.STEPINTO_COMMAND:
|
||||
this._lastRunRequestID = requestID;
|
||||
var stepIntoArgs = {
|
||||
kind: "stepInto"
|
||||
};
|
||||
args = stepIntoArgs;
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.STEPOVER_COMMAND:
|
||||
this._lastRunRequestID = requestID;
|
||||
var stepOverArgs = {
|
||||
kind: "stepOver"
|
||||
};
|
||||
args = stepOverArgs;
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.EVALUATE_COMMAND:
|
||||
args = this._unmarshallEvaluateArguments(requestID, parts.slice(2).join(" "));
|
||||
break;
|
||||
default:
|
||||
throw new _DebuggerError.DebuggerError("Invalid command", "Invalid command from adapter: " + command);
|
||||
}
|
||||
(0, _invariant2.default)(args !== undefined);
|
||||
var result = {
|
||||
id: requestID,
|
||||
command: command,
|
||||
arguments: args
|
||||
};
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallBreakpointsArguments",
|
||||
value: function _unmarshallBreakpointsArguments(requestID, responseString) {
|
||||
var breakpoints = JSON.parse(responseString);
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = breakpoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var breakpoint = _step.value;
|
||||
|
||||
(0, _invariant2.default)(breakpoint.hasOwnProperty("filePath"), "breakpoint missing filePath property");
|
||||
(0, _invariant2.default)(breakpoint.hasOwnProperty("line"), "breakpoint missing line property");
|
||||
(0, _invariant2.default)(breakpoint.hasOwnProperty("column"), "breakpoint missing column property");
|
||||
(0, _invariant2.default)(!isNaN(breakpoint.line));
|
||||
(0, _invariant2.default)(!isNaN(breakpoint.column));
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var result = {
|
||||
kind: "breakpoint",
|
||||
breakpoints: breakpoints
|
||||
};
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallScopesArguments",
|
||||
value: function _unmarshallScopesArguments(requestID, responseString) {
|
||||
var frameId = parseInt(responseString, 10);
|
||||
(0, _invariant2.default)(!isNaN(frameId));
|
||||
var result = {
|
||||
kind: "scopes",
|
||||
frameId: frameId
|
||||
};
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallVariablesArguments",
|
||||
value: function _unmarshallVariablesArguments(requestID, responseString) {
|
||||
var varRef = parseInt(responseString, 10);
|
||||
(0, _invariant2.default)(!isNaN(varRef));
|
||||
var result = {
|
||||
kind: "variables",
|
||||
variablesReference: varRef
|
||||
};
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallEvaluateArguments",
|
||||
value: function _unmarshallEvaluateArguments(requestID, responseString) {
|
||||
var evalArgs = JSON.parse(responseString);
|
||||
(0, _invariant2.default)(evalArgs.hasOwnProperty("kind"), "Evaluate arguments missing kind field");
|
||||
(0, _invariant2.default)(evalArgs.hasOwnProperty("expression"), "Evaluate arguments missing expression field");
|
||||
if (evalArgs.hasOwnProperty("frameId")) (0, _invariant2.default)(!isNaN(evalArgs.frameId));
|
||||
return evalArgs;
|
||||
}
|
||||
}, {
|
||||
key: "unmarshallResponse",
|
||||
value: function unmarshallResponse(message) {
|
||||
try {
|
||||
var parts = message.split(" ");
|
||||
var requestID = parseInt(parts[0], 10);
|
||||
(0, _invariant2.default)(!isNaN(requestID));
|
||||
var messageType = parts[1];
|
||||
var dbgResult = void 0;
|
||||
var resultString = parts.slice(2).join(" ");
|
||||
if (messageType === _DebugMessage.DebugMessage.PREPACK_READY_RESPONSE) {
|
||||
dbgResult = this._unmarshallReadyResult();
|
||||
} else if (messageType === _DebugMessage.DebugMessage.BREAKPOINT_ADD_ACKNOWLEDGE) {
|
||||
dbgResult = this._unmarshallBreakpointsAddResult(resultString);
|
||||
} else if (messageType === _DebugMessage.DebugMessage.STOPPED_RESPONSE) {
|
||||
dbgResult = this._unmarshallStoppedResult(resultString);
|
||||
} else if (messageType === _DebugMessage.DebugMessage.STACKFRAMES_RESPONSE) {
|
||||
dbgResult = this._unmarshallStackframesResult(resultString);
|
||||
} else if (messageType === _DebugMessage.DebugMessage.SCOPES_RESPONSE) {
|
||||
dbgResult = this._unmarshallScopesResult(resultString);
|
||||
} else if (messageType === _DebugMessage.DebugMessage.VARIABLES_RESPONSE) {
|
||||
dbgResult = this._unmarshallVariablesResult(resultString);
|
||||
} else if (messageType === _DebugMessage.DebugMessage.EVALUATE_RESPONSE) {
|
||||
dbgResult = this._unmarshallEvaluateResult(resultString);
|
||||
} else {
|
||||
(0, _invariant2.default)(false, "Unexpected response type");
|
||||
}
|
||||
|
||||
var dbgResponse = {
|
||||
id: requestID,
|
||||
result: dbgResult
|
||||
};
|
||||
return dbgResponse;
|
||||
} catch (e) {
|
||||
throw new _DebuggerError.DebuggerError("Invalid command", e.message);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallStackframesResult",
|
||||
value: function _unmarshallStackframesResult(resultString) {
|
||||
var frames = JSON.parse(resultString);
|
||||
(0, _invariant2.default)(Array.isArray(frames), "Stack frames is not an array");
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator2 = frames[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
||||
var frame = _step2.value;
|
||||
|
||||
(0, _invariant2.default)(frame.hasOwnProperty("id"), "Stack frame is missing id");
|
||||
(0, _invariant2.default)(frame.hasOwnProperty("fileName"), "Stack frame is missing filename");
|
||||
(0, _invariant2.default)(frame.hasOwnProperty("line"), "Stack frame is missing line number");
|
||||
(0, _invariant2.default)(frame.hasOwnProperty("column"), "Stack frame is missing column number");
|
||||
(0, _invariant2.default)(frame.hasOwnProperty("functionName"), "Stack frame is missing function name");
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var result = {
|
||||
kind: "stackframe",
|
||||
stackframes: frames
|
||||
};
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallScopesResult",
|
||||
value: function _unmarshallScopesResult(resultString) {
|
||||
var scopes = JSON.parse(resultString);
|
||||
(0, _invariant2.default)(Array.isArray(scopes), "Scopes is not an array");
|
||||
var _iteratorNormalCompletion3 = true;
|
||||
var _didIteratorError3 = false;
|
||||
var _iteratorError3 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator3 = scopes[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
||||
var scope = _step3.value;
|
||||
|
||||
(0, _invariant2.default)(scope.hasOwnProperty("name"), "Scope is missing name");
|
||||
(0, _invariant2.default)(scope.hasOwnProperty("variablesReference"), "Scope is missing variablesReference");
|
||||
(0, _invariant2.default)(scope.hasOwnProperty("expensive"), "Scope is missing expensive");
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError3 = true;
|
||||
_iteratorError3 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
||||
_iterator3.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError3) {
|
||||
throw _iteratorError3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var result = {
|
||||
kind: "scopes",
|
||||
scopes: scopes
|
||||
};
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallVariablesResult",
|
||||
value: function _unmarshallVariablesResult(resultString) {
|
||||
var variables = JSON.parse(resultString);
|
||||
(0, _invariant2.default)(Array.isArray(variables), "Variables is not an array");
|
||||
var _iteratorNormalCompletion4 = true;
|
||||
var _didIteratorError4 = false;
|
||||
var _iteratorError4 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator4 = variables[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
||||
var variable = _step4.value;
|
||||
|
||||
(0, _invariant2.default)(variable.hasOwnProperty("name"));
|
||||
(0, _invariant2.default)(variable.hasOwnProperty("value"));
|
||||
(0, _invariant2.default)(variable.hasOwnProperty("variablesReference"));
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError4 = true;
|
||||
_iteratorError4 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion4 && _iterator4.return) {
|
||||
_iterator4.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError4) {
|
||||
throw _iteratorError4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var result = {
|
||||
kind: "variables",
|
||||
variables: variables
|
||||
};
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallEvaluateResult",
|
||||
value: function _unmarshallEvaluateResult(resultString) {
|
||||
var evalResult = JSON.parse(resultString);
|
||||
(0, _invariant2.default)(evalResult.hasOwnProperty("kind"), "eval result missing kind property");
|
||||
(0, _invariant2.default)(evalResult.kind === "evaluate", "eval result is the wrong kind");
|
||||
(0, _invariant2.default)(evalResult.hasOwnProperty("displayValue", "eval result missing display value property"));
|
||||
(0, _invariant2.default)(evalResult.hasOwnProperty("type", "eval result missing type property"));
|
||||
(0, _invariant2.default)(evalResult.hasOwnProperty("variablesReference", "eval result missing variablesReference property"));
|
||||
return evalResult;
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallBreakpointsAddResult",
|
||||
value: function _unmarshallBreakpointsAddResult(resultString) {
|
||||
var breakpoints = JSON.parse(resultString);
|
||||
(0, _invariant2.default)(Array.isArray(breakpoints));
|
||||
var _iteratorNormalCompletion5 = true;
|
||||
var _didIteratorError5 = false;
|
||||
var _iteratorError5 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator5 = breakpoints[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
||||
var breakpoint = _step5.value;
|
||||
|
||||
(0, _invariant2.default)(breakpoint.hasOwnProperty("filePath"), "breakpoint missing filePath property");
|
||||
(0, _invariant2.default)(breakpoint.hasOwnProperty("line"), "breakpoint missing line property");
|
||||
(0, _invariant2.default)(breakpoint.hasOwnProperty("column"), "breakpoint missing column property");
|
||||
(0, _invariant2.default)(!isNaN(breakpoint.line));
|
||||
(0, _invariant2.default)(!isNaN(breakpoint.column));
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError5 = true;
|
||||
_iteratorError5 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion5 && _iterator5.return) {
|
||||
_iterator5.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError5) {
|
||||
throw _iteratorError5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var result = {
|
||||
kind: "breakpoint-add",
|
||||
breakpoints: breakpoints
|
||||
};
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallStoppedResult",
|
||||
value: function _unmarshallStoppedResult(resultString) {
|
||||
var result = JSON.parse(resultString);
|
||||
(0, _invariant2.default)(result.kind === "stopped");
|
||||
(0, _invariant2.default)(result.hasOwnProperty("reason"));
|
||||
(0, _invariant2.default)(result.hasOwnProperty("filePath"));
|
||||
(0, _invariant2.default)(result.hasOwnProperty("line"));
|
||||
(0, _invariant2.default)(!isNaN(result.line));
|
||||
(0, _invariant2.default)(result.hasOwnProperty("column"));
|
||||
(0, _invariant2.default)(!isNaN(result.column));
|
||||
return result;
|
||||
}
|
||||
}, {
|
||||
key: "_unmarshallReadyResult",
|
||||
value: function _unmarshallReadyResult() {
|
||||
var result = {
|
||||
kind: "ready"
|
||||
};
|
||||
return result;
|
||||
}
|
||||
}]);
|
||||
|
||||
return MessageMarshaller;
|
||||
}();
|
||||
//# sourceMappingURL=MessageMarshaller.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/common/channel/MessageMarshaller.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/common/channel/MessageMarshaller.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
78
build/node_modules/prepack/lib/debugger/common/channel/MessagePackager.js
generated
vendored
Normal file
78
build/node_modules/prepack/lib/debugger/common/channel/MessagePackager.js
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.MessagePackager = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _invariant = require("../invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var LENGTH_SEPARATOR = "--";
|
||||
|
||||
// Package a message sent or unpackage a message received
|
||||
|
||||
var MessagePackager = exports.MessagePackager = function () {
|
||||
function MessagePackager(isAdapter) {
|
||||
_classCallCheck(this, MessagePackager);
|
||||
|
||||
this._isAdapter = isAdapter;
|
||||
}
|
||||
|
||||
_createClass(MessagePackager, [{
|
||||
key: "package",
|
||||
|
||||
|
||||
// package a message to be sent
|
||||
value: function _package(contents) {
|
||||
// format: <length>--<contents>
|
||||
return contents.length + LENGTH_SEPARATOR + contents;
|
||||
}
|
||||
|
||||
// unpackage a message received, verify it, and return it
|
||||
// returns null if no message or the message is only partially read
|
||||
// errors if the message violates the format
|
||||
|
||||
}, {
|
||||
key: "unpackage",
|
||||
value: function unpackage(contents) {
|
||||
// format: <length>--<contents>
|
||||
var separatorIndex = contents.indexOf(LENGTH_SEPARATOR);
|
||||
// if the separator is not written in yet --> partial read
|
||||
if (separatorIndex === -1) {
|
||||
return null;
|
||||
}
|
||||
var messageLength = parseInt(contents.slice(0, separatorIndex), 10);
|
||||
// if the part before the separator is not a valid length, it is a
|
||||
// violation of protocol
|
||||
(0, _invariant2.default)(!isNaN(messageLength));
|
||||
var startIndex = separatorIndex + LENGTH_SEPARATOR.length;
|
||||
var endIndex = startIndex + messageLength;
|
||||
// there should only be one message in the contents at a time
|
||||
(0, _invariant2.default)(contents.length <= startIndex + messageLength);
|
||||
// if we didn't read the whole message yet --> partial read
|
||||
if (contents.length < endIndex) {
|
||||
return null;
|
||||
}
|
||||
var message = contents.slice(startIndex, endIndex);
|
||||
return message;
|
||||
}
|
||||
}]);
|
||||
|
||||
return MessagePackager;
|
||||
}();
|
||||
//# sourceMappingURL=MessagePackager.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/common/channel/MessagePackager.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/common/channel/MessagePackager.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../src/debugger/common/channel/MessagePackager.js"],"names":["LENGTH_SEPARATOR","MessagePackager","isAdapter","_isAdapter","contents","length","separatorIndex","indexOf","messageLength","parseInt","slice","isNaN","startIndex","endIndex","message"],"mappings":";;;;;;;qjBAAA;;;;;;;;;AAWA;;;;;;;;AAEA,IAAMA,mBAAmB,IAAzB;;AAEA;;IACaC,e,WAAAA,e;AACX,2BAAYC,SAAZ,EAAgC;AAAA;;AAC9B,SAAKC,UAAL,GAAkBD,SAAlB;AACD;;;;;;AAGD;6BACQE,Q,EAA0B;AAChC;AACA,aAAOA,SAASC,MAAT,GAAkBL,gBAAlB,GAAqCI,QAA5C;AACD;;AAED;AACA;AACA;;;;8BACUA,Q,EAAiC;AACzC;AACA,UAAIE,iBAAiBF,SAASG,OAAT,CAAiBP,gBAAjB,CAArB;AACA;AACA,UAAIM,mBAAmB,CAAC,CAAxB,EAA2B;AACzB,eAAO,IAAP;AACD;AACD,UAAIE,gBAAgBC,SAASL,SAASM,KAAT,CAAe,CAAf,EAAkBJ,cAAlB,CAAT,EAA4C,EAA5C,CAApB;AACA;AACA;AACA,+BAAU,CAACK,MAAMH,aAAN,CAAX;AACA,UAAII,aAAaN,iBAAiBN,iBAAiBK,MAAnD;AACA,UAAIQ,WAAWD,aAAaJ,aAA5B;AACA;AACA,+BAAUJ,SAASC,MAAT,IAAmBO,aAAaJ,aAA1C;AACA;AACA,UAAIJ,SAASC,MAAT,GAAkBQ,QAAtB,EAAgC;AAC9B,eAAO,IAAP;AACD;AACD,UAAIC,UAAUV,SAASM,KAAT,CAAeE,UAAf,EAA2BC,QAA3B,CAAd;AACA,aAAOC,OAAP;AACD","file":"MessagePackager.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport invariant from \"../invariant.js\";\n\nconst LENGTH_SEPARATOR = \"--\";\n\n// Package a message sent or unpackage a message received\nexport class MessagePackager {\n constructor(isAdapter: boolean) {\n this._isAdapter = isAdapter;\n }\n _isAdapter: boolean;\n\n // package a message to be sent\n package(contents: string): string {\n // format: <length>--<contents>\n return contents.length + LENGTH_SEPARATOR + contents;\n }\n\n // unpackage a message received, verify it, and return it\n // returns null if no message or the message is only partially read\n // errors if the message violates the format\n unpackage(contents: string): null | string {\n // format: <length>--<contents>\n let separatorIndex = contents.indexOf(LENGTH_SEPARATOR);\n // if the separator is not written in yet --> partial read\n if (separatorIndex === -1) {\n return null;\n }\n let messageLength = parseInt(contents.slice(0, separatorIndex), 10);\n // if the part before the separator is not a valid length, it is a\n // violation of protocol\n invariant(!isNaN(messageLength));\n let startIndex = separatorIndex + LENGTH_SEPARATOR.length;\n let endIndex = startIndex + messageLength;\n // there should only be one message in the contents at a time\n invariant(contents.length <= startIndex + messageLength);\n // if we didn't read the whole message yet --> partial read\n if (contents.length < endIndex) {\n return null;\n }\n let message = contents.slice(startIndex, endIndex);\n return message;\n }\n}\n"]}
|
||||
23
build/node_modules/prepack/lib/debugger/common/invariant.js
generated
vendored
Normal file
23
build/node_modules/prepack/lib/debugger/common/invariant.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = invariant;
|
||||
/**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
function invariant(condition, format) {
|
||||
if (condition) return;
|
||||
|
||||
var error = new Error(format);
|
||||
error.name = "Invariant Violation";
|
||||
throw error;
|
||||
}
|
||||
//# sourceMappingURL=invariant.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/common/invariant.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/common/invariant.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/debugger/common/invariant.js"],"names":["invariant","condition","format","error","Error","name"],"mappings":";;;;;kBAWwBA,S;AAXxB;;;;;;;;;AAWe,SAASA,SAAT,CAAmBC,SAAnB,EAAmCC,MAAnC,EAAyD;AACtE,MAAID,SAAJ,EAAe;;AAEf,MAAIE,QAAQ,IAAIC,KAAJ,CAAUF,MAAV,CAAZ;AACAC,QAAME,IAAN,GAAa,qBAAb;AACA,QAAMF,KAAN;AACD","file":"invariant.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nexport default function invariant(condition: any, format: string): void {\n if (condition) return;\n\n let error = new Error(format);\n error.name = \"Invariant Violation\";\n throw error;\n}\n"]}
|
||||
8
build/node_modules/prepack/lib/debugger/common/types.js
generated
vendored
Normal file
8
build/node_modules/prepack/lib/debugger/common/types.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
var _vscodeDebugprotocol = require("vscode-debugprotocol");
|
||||
|
||||
var DebugProtocol = _interopRequireWildcard(_vscodeDebugprotocol);
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/common/types.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/common/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/debugger/common/types.js"],"names":["DebugProtocol"],"mappings":";;AAWA;;IAAYA,a","file":"types.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport * as DebugProtocol from \"vscode-debugprotocol\";\n\nexport type DebuggerRequest = {\n id: number,\n command: string,\n arguments: DebuggerRequestArguments,\n};\n\nexport type DebuggerRequestArguments =\n | BreakpointsArguments\n | RunArguments\n | StackframeArguments\n | ScopesArguments\n | VariablesArguments\n | StepIntoArguments\n | StepOverArguments\n | EvaluateArguments;\n\nexport type PrepackLaunchArguments = {\n kind: \"launch\",\n prepackRuntime: string,\n prepackArguments: Array<string>,\n sourceFile: string,\n debugInFilePath: string,\n debugOutFilePath: string,\n outputCallback: Buffer => void,\n exitCallback: () => void,\n};\n\nexport type Breakpoint = {\n filePath: string,\n line: number,\n column: number,\n};\n\nexport type BreakpointsArguments = {\n kind: \"breakpoint\",\n breakpoints: Array<Breakpoint>,\n};\n\nexport type RunArguments = {\n kind: \"run\",\n};\n\nexport type StackframeArguments = {\n kind: \"stackframe\",\n};\n\nexport type Stackframe = {\n id: number,\n fileName: string,\n line: number,\n column: number,\n functionName: string,\n};\n\nexport type ScopesArguments = {\n kind: \"scopes\",\n frameId: number,\n};\n\nexport type VariablesArguments = {\n kind: \"variables\",\n variablesReference: number,\n};\n\nexport type StepIntoArguments = {\n kind: \"stepInto\",\n};\n\nexport type StepOverArguments = {\n kind: \"stepOver\",\n};\n\nexport type EvaluateArguments = {\n kind: \"evaluate\",\n frameId?: number,\n expression: string,\n};\n\nexport type DebuggerResponse = {\n id: number,\n result: DebuggerResponseResult,\n};\n\nexport type DebuggerResponseResult =\n | ReadyResult\n | StackframeResult\n | BreakpointsAddResult\n | StoppedResult\n | ScopesResult\n | VariablesResult\n | EvaluateResult;\n\nexport type ReadyResult = {\n kind: \"ready\",\n};\n\nexport type StackframeResult = {\n kind: \"stackframe\",\n stackframes: Array<Stackframe>,\n};\n\nexport type BreakpointsAddResult = {\n kind: \"breakpoint-add\",\n breakpoints: Array<Breakpoint>,\n};\n\nexport type StoppedResult = {\n kind: \"stopped\",\n reason: StoppedReason,\n filePath: string,\n line: number,\n column: number,\n};\nexport type Scope = {\n name: string,\n variablesReference: number,\n expensive: boolean,\n};\n\nexport type ScopesResult = {\n kind: \"scopes\",\n scopes: Array<Scope>,\n};\n\nexport type Variable = {\n name: string,\n value: string,\n variablesReference: number,\n};\n\nexport type VariablesResult = {\n kind: \"variables\",\n variables: Array<Variable>,\n};\n\nexport type EvaluateResult = {\n kind: \"evaluate\",\n displayValue: string,\n type: string,\n variablesReference: number,\n};\n\nexport interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArguments {\n noDebug?: boolean,\n sourceFile: string,\n prepackRuntime: string,\n prepackArguments: Array<string>,\n}\n\nexport type SteppingType = \"Step Into\" | \"Step Over\";\nexport type StoppedReason = \"Entry\" | \"Breakpoint\" | SteppingType;\n\nexport type SourceData = {\n filePath: string,\n line: number,\n column: number,\n};\n"]}
|
||||
77
build/node_modules/prepack/lib/debugger/mock-ui/DataHandler.js
generated
vendored
Normal file
77
build/node_modules/prepack/lib/debugger/mock-ui/DataHandler.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
/**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
//separator for messages according to the protocol
|
||||
var TWO_CRLF = "\r\n\r\n";
|
||||
|
||||
var DataHandler = exports.DataHandler = function () {
|
||||
function DataHandler() {
|
||||
_classCallCheck(this, DataHandler);
|
||||
|
||||
this._rawData = new Buffer(0);
|
||||
this._contentLength = -1;
|
||||
}
|
||||
|
||||
_createClass(DataHandler, [{
|
||||
key: "handleData",
|
||||
value: function handleData(data, messageProcessor) {
|
||||
this._rawData = Buffer.concat([this._rawData, data]);
|
||||
// the following code parses a message according to the protocol.
|
||||
while (this._rawData.length > 0) {
|
||||
// if we know what length we are expecting
|
||||
if (this._contentLength >= 0) {
|
||||
// we have enough data to check for the expected message
|
||||
if (this._rawData.byteLength >= this._contentLength) {
|
||||
// first get the expected message
|
||||
var _message = this._rawData.toString("utf8", 0, this._contentLength);
|
||||
// reduce the buffer by the message we got
|
||||
this._rawData = this._rawData.slice(this._contentLength);
|
||||
// reset the content length to ensure it is extracted for the next message
|
||||
this._contentLength = -1;
|
||||
// process the message
|
||||
messageProcessor(_message);
|
||||
continue; // there may be more complete messages to process
|
||||
}
|
||||
} else {
|
||||
// if we don't know the length to expect, we need to extract it first
|
||||
var idx = this._rawData.indexOf(TWO_CRLF);
|
||||
if (idx !== -1) {
|
||||
var header = this._rawData.toString("utf8", 0, idx);
|
||||
var lines = header.split("\r\n");
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
var pair = lines[i].split(/: +/);
|
||||
if (pair[0] === "Content-Length") {
|
||||
this._contentLength = parseInt(pair[1], 10);
|
||||
// reset the contentlength if it is invalid
|
||||
if (isNaN(this._contentLength)) this._contentLength = -1;
|
||||
}
|
||||
}
|
||||
this._rawData = this._rawData.slice(idx + TWO_CRLF.length);
|
||||
continue;
|
||||
}
|
||||
// if we don't find the length we fall through and break
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return DataHandler;
|
||||
}();
|
||||
//# sourceMappingURL=DataHandler.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/mock-ui/DataHandler.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/mock-ui/DataHandler.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/debugger/mock-ui/DataHandler.js"],"names":["TWO_CRLF","DataHandler","_rawData","Buffer","_contentLength","data","messageProcessor","concat","length","byteLength","message","toString","slice","idx","indexOf","header","lines","split","i","pair","parseInt","isNaN"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;AAWA;AACA,IAAMA,WAAW,UAAjB;;IAEaC,W,WAAAA,W;AACX,yBAAc;AAAA;;AACZ,SAAKC,QAAL,GAAgB,IAAIC,MAAJ,CAAW,CAAX,CAAhB;AACA,SAAKC,cAAL,GAAsB,CAAC,CAAvB;AACD;;;;+BAIUC,I,EAAcC,gB,EAAmD;AAC1E,WAAKJ,QAAL,GAAgBC,OAAOI,MAAP,CAAc,CAAC,KAAKL,QAAN,EAAgBG,IAAhB,CAAd,CAAhB;AACA;AACA,aAAO,KAAKH,QAAL,CAAcM,MAAd,GAAuB,CAA9B,EAAiC;AAC/B;AACA,YAAI,KAAKJ,cAAL,IAAuB,CAA3B,EAA8B;AAC5B;AACA,cAAI,KAAKF,QAAL,CAAcO,UAAd,IAA4B,KAAKL,cAArC,EAAqD;AACnD;AACA,gBAAIM,WAAU,KAAKR,QAAL,CAAcS,QAAd,CAAuB,MAAvB,EAA+B,CAA/B,EAAkC,KAAKP,cAAvC,CAAd;AACA;AACA,iBAAKF,QAAL,GAAgB,KAAKA,QAAL,CAAcU,KAAd,CAAoB,KAAKR,cAAzB,CAAhB;AACA;AACA,iBAAKA,cAAL,GAAsB,CAAC,CAAvB;AACA;AACAE,6BAAiBI,QAAjB;AACA,qBATmD,CASzC;AACX;AACF,SAbD,MAaO;AACL;AACA,cAAIG,MAAM,KAAKX,QAAL,CAAcY,OAAd,CAAsBd,QAAtB,CAAV;AACA,cAAIa,QAAQ,CAAC,CAAb,EAAgB;AACd,gBAAIE,SAAS,KAAKb,QAAL,CAAcS,QAAd,CAAuB,MAAvB,EAA+B,CAA/B,EAAkCE,GAAlC,CAAb;AACA,gBAAIG,QAAQD,OAAOE,KAAP,CAAa,MAAb,CAAZ;AACA,iBAAK,IAAIC,IAAI,CAAb,EAAgBA,IAAIF,MAAMR,MAA1B,EAAkCU,GAAlC,EAAuC;AACrC,kBAAIC,OAAOH,MAAME,CAAN,EAASD,KAAT,CAAe,KAAf,CAAX;AACA,kBAAIE,KAAK,CAAL,MAAY,gBAAhB,EAAkC;AAChC,qBAAKf,cAAL,GAAsBgB,SAASD,KAAK,CAAL,CAAT,EAAkB,EAAlB,CAAtB;AACA;AACA,oBAAIE,MAAM,KAAKjB,cAAX,CAAJ,EAAgC,KAAKA,cAAL,GAAsB,CAAC,CAAvB;AACjC;AACF;AACD,iBAAKF,QAAL,GAAgB,KAAKA,QAAL,CAAcU,KAAd,CAAoBC,MAAMb,SAASQ,MAAnC,CAAhB;AACA;AACD;AACD;AACD;AACD;AACD;AACF","file":"DataHandler.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\n//separator for messages according to the protocol\nconst TWO_CRLF = \"\\r\\n\\r\\n\";\n\nexport class DataHandler {\n constructor() {\n this._rawData = new Buffer(0);\n this._contentLength = -1;\n }\n _rawData: Buffer;\n _contentLength: number;\n\n handleData(data: Buffer, messageProcessor: (message: string) => void): void {\n this._rawData = Buffer.concat([this._rawData, data]);\n // the following code parses a message according to the protocol.\n while (this._rawData.length > 0) {\n // if we know what length we are expecting\n if (this._contentLength >= 0) {\n // we have enough data to check for the expected message\n if (this._rawData.byteLength >= this._contentLength) {\n // first get the expected message\n let message = this._rawData.toString(\"utf8\", 0, this._contentLength);\n // reduce the buffer by the message we got\n this._rawData = this._rawData.slice(this._contentLength);\n // reset the content length to ensure it is extracted for the next message\n this._contentLength = -1;\n // process the message\n messageProcessor(message);\n continue; // there may be more complete messages to process\n }\n } else {\n // if we don't know the length to expect, we need to extract it first\n let idx = this._rawData.indexOf(TWO_CRLF);\n if (idx !== -1) {\n let header = this._rawData.toString(\"utf8\", 0, idx);\n let lines = header.split(\"\\r\\n\");\n for (let i = 0; i < lines.length; i++) {\n let pair = lines[i].split(/: +/);\n if (pair[0] === \"Content-Length\") {\n this._contentLength = parseInt(pair[1], 10);\n // reset the contentlength if it is invalid\n if (isNaN(this._contentLength)) this._contentLength = -1;\n }\n }\n this._rawData = this._rawData.slice(idx + TWO_CRLF.length);\n continue;\n }\n // if we don't find the length we fall through and break\n }\n break;\n }\n }\n}\n"]}
|
||||
685
build/node_modules/prepack/lib/debugger/mock-ui/UISession.js
generated
vendored
Normal file
685
build/node_modules/prepack/lib/debugger/mock-ui/UISession.js
generated
vendored
Normal file
@@ -0,0 +1,685 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.UISession = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _readline = require("readline");
|
||||
|
||||
var _readline2 = _interopRequireDefault(_readline);
|
||||
|
||||
var _child_process = require("child_process");
|
||||
|
||||
var _child_process2 = _interopRequireDefault(_child_process);
|
||||
|
||||
var _vscodeDebugprotocol = require("vscode-debugprotocol");
|
||||
|
||||
var DebugProtocol = _interopRequireWildcard(_vscodeDebugprotocol);
|
||||
|
||||
var _DataHandler = require("./DataHandler.js");
|
||||
|
||||
var _DebuggerConstants = require("./../common/DebuggerConstants");
|
||||
|
||||
var _types = require("./../common/types.js");
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
//separator for messages according to the protocol
|
||||
var TWO_CRLF = "\r\n\r\n";
|
||||
|
||||
/* Represents one debugging session in the CLI.
|
||||
* Read in user input from the command line, parses the input into commands,
|
||||
* sends the commands to the adapter and process any responses
|
||||
*/
|
||||
|
||||
var UISession = exports.UISession = function () {
|
||||
function UISession(proc, args) {
|
||||
_classCallCheck(this, UISession);
|
||||
|
||||
this._proc = proc;
|
||||
this._adapterPath = args.adapterPath;
|
||||
this._prepackRuntime = args.prepackRuntime;
|
||||
this._sourceFile = args.sourceFile;
|
||||
this._prepackArguments = args.prepackArguments;
|
||||
this._sequenceNum = 1;
|
||||
this._invalidCount = 0;
|
||||
this._dataHandler = new _DataHandler.DataHandler();
|
||||
this._prepackWaiting = false;
|
||||
this._prepackLaunched = false;
|
||||
}
|
||||
// the parent (i.e. ui) process
|
||||
|
||||
//path to the debug adapter
|
||||
|
||||
// the child (i.e. adapter) process
|
||||
|
||||
|
||||
// id number for each message sent
|
||||
|
||||
// interface to read in input from the CLI client
|
||||
|
||||
// number of invalid commands
|
||||
|
||||
// Prepack runtime command (e.g. lib/prepack-cli.js)
|
||||
|
||||
// input source file to Prepack
|
||||
|
||||
// arguments to start Prepack with
|
||||
|
||||
// handler for any received messages
|
||||
|
||||
// flag whether Prepack is waiting for a command
|
||||
|
||||
// flag whether Prepack has been launched
|
||||
|
||||
|
||||
_createClass(UISession, [{
|
||||
key: "_startAdapter",
|
||||
value: function _startAdapter() {
|
||||
var _this = this;
|
||||
|
||||
var adapterArgs = [this._adapterPath];
|
||||
this._adapterProcess = _child_process2.default.spawn("node", adapterArgs);
|
||||
this._proc.on("exit", function () {
|
||||
_this.shutdown();
|
||||
});
|
||||
this._proc.on("SIGINT", function () {
|
||||
_this.shutdown();
|
||||
});
|
||||
this._adapterProcess.stdout.on("data", function (data) {
|
||||
//handle the received data
|
||||
_this._dataHandler.handleData(data, _this._processMessage.bind(_this));
|
||||
});
|
||||
this._adapterProcess.stderr.on("data", function (data) {
|
||||
console.error(data.toString());
|
||||
_this.shutdown();
|
||||
});
|
||||
}
|
||||
|
||||
// called from data handler to process a received message
|
||||
|
||||
}, {
|
||||
key: "_processMessage",
|
||||
value: function _processMessage(message) {
|
||||
var _this2 = this;
|
||||
|
||||
try {
|
||||
var msg = JSON.parse(message);
|
||||
if (msg.type === "event") {
|
||||
this._processEvent(msg);
|
||||
} else if (msg.type === "response") {
|
||||
this._processResponse(msg);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
console.error("Invalid message: " + message.slice(0, 1000));
|
||||
}
|
||||
//ask the user for the next command
|
||||
if (this._prepackLaunched && this._prepackWaiting) {
|
||||
this._reader.question("(dbg) ", function (input) {
|
||||
_this2._dispatch(input);
|
||||
});
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_processEvent",
|
||||
value: function _processEvent(event) {
|
||||
if (event.event === "initialized") {
|
||||
// the adapter is ready to accept any persisted debug information
|
||||
// (e.g. persisted breakpoints from previous sessions). the CLI
|
||||
var configDoneArgs = {};
|
||||
this._sendConfigDoneRequest(configDoneArgs);
|
||||
} else if (event.event === "output") {
|
||||
this._uiOutput("Prepack output:\n" + event.body.output);
|
||||
} else if (event.event === "terminated") {
|
||||
this._uiOutput("Prepack exited! Shutting down...");
|
||||
this.shutdown();
|
||||
} else if (event.event === "stopped") {
|
||||
this._prepackWaiting = true;
|
||||
if (event.body) {
|
||||
this._uiOutput(event.body.reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_processResponse",
|
||||
value: function _processResponse(response) {
|
||||
if (response.command === "initialize") {
|
||||
this._processInitializeResponse(response);
|
||||
} else if (response.command === "launch") {
|
||||
this._processLaunchResponse(response);
|
||||
} else if (response.command === "threads") {
|
||||
this._processThreadsResponse(response);
|
||||
} else if (response.command === "stackTrace") {
|
||||
//flow doesn't have type refinement for interfaces, so must do a cast here
|
||||
this._processStackTraceResponse(response);
|
||||
} else if (response.command === "scopes") {
|
||||
this._processScopesResponse(response);
|
||||
} else if (response.command === "variables") {
|
||||
this._processVariablesResponse(response);
|
||||
} else if (response.command === "evaluate") {
|
||||
this._processEvaluateResponse(response);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_processScopesResponse",
|
||||
value: function _processScopesResponse(response) {
|
||||
var scopes = response.body.scopes;
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = scopes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var scope = _step.value;
|
||||
|
||||
this._uiOutput(scope.name + " " + scope.variablesReference);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_processInitializeResponse",
|
||||
value: function _processInitializeResponse(response) {
|
||||
var launchArgs = {
|
||||
prepackRuntime: this._prepackRuntime,
|
||||
sourceFile: this._sourceFile,
|
||||
prepackArguments: this._prepackArguments
|
||||
};
|
||||
this._sendLaunchRequest(launchArgs);
|
||||
}
|
||||
}, {
|
||||
key: "_processLaunchResponse",
|
||||
value: function _processLaunchResponse(response) {
|
||||
var _this3 = this;
|
||||
|
||||
this._uiOutput("Prepack is ready");
|
||||
this._prepackLaunched = true;
|
||||
this._prepackWaiting = true;
|
||||
// start reading requests from the user
|
||||
this._reader.question("(dbg) ", function (input) {
|
||||
_this3._dispatch(input);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "_processStackTraceResponse",
|
||||
value: function _processStackTraceResponse(response) {
|
||||
var frames = response.body.stackFrames;
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator2 = frames[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
||||
var frame = _step2.value;
|
||||
|
||||
if (frame.source && frame.source.path) {
|
||||
this._uiOutput(frame.id + ": " + frame.name + " " + frame.source.path + " " + frame.line + ":" + frame.column);
|
||||
} else {
|
||||
this._uiOutput(frame.id + ": " + frame.name + " unknown source");
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_processThreadsResponse",
|
||||
value: function _processThreadsResponse(response) {
|
||||
var _iteratorNormalCompletion3 = true;
|
||||
var _didIteratorError3 = false;
|
||||
var _iteratorError3 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator3 = response.body.threads[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
||||
var thread = _step3.value;
|
||||
|
||||
this._uiOutput(thread.id + ": " + thread.name);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError3 = true;
|
||||
_iteratorError3 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
||||
_iterator3.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError3) {
|
||||
throw _iteratorError3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_processVariablesResponse",
|
||||
value: function _processVariablesResponse(response) {
|
||||
var _iteratorNormalCompletion4 = true;
|
||||
var _didIteratorError4 = false;
|
||||
var _iteratorError4 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator4 = response.body.variables[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
||||
var variable = _step4.value;
|
||||
|
||||
if (variable.variablesReference === 0) {
|
||||
// 0 means there are not more nested variables to return
|
||||
this._uiOutput(variable.name + ": " + variable.value);
|
||||
} else {
|
||||
this._uiOutput(variable.name + ": " + variable.value + " " + variable.variablesReference);
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError4 = true;
|
||||
_iteratorError4 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion4 && _iterator4.return) {
|
||||
_iterator4.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError4) {
|
||||
throw _iteratorError4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_processEvaluateResponse",
|
||||
value: function _processEvaluateResponse(response) {
|
||||
var evalInfo = response.body;
|
||||
this._uiOutput("Type: " + (evalInfo.type || "unknown"));
|
||||
this._uiOutput(evalInfo.result);
|
||||
this._uiOutput("Variables Reference: " + evalInfo.variablesReference);
|
||||
}
|
||||
|
||||
// execute a command if it is valid
|
||||
// returns whether the command was valid
|
||||
|
||||
}, {
|
||||
key: "_executeCommand",
|
||||
value: function _executeCommand(input) {
|
||||
var parts = input.split(" ");
|
||||
var command = parts[0];
|
||||
|
||||
// for testing purposes, init and configDone are made into user commands
|
||||
// they can be done from the adapter without user input
|
||||
|
||||
switch (command) {
|
||||
case "run":
|
||||
// format: run
|
||||
if (parts.length !== 1) return false;
|
||||
var continueArgs = {
|
||||
// Prepack will only have 1 thread, this argument will be ignored
|
||||
threadId: _DebuggerConstants.DebuggerConstants.PREPACK_THREAD_ID
|
||||
};
|
||||
this._sendContinueRequest(continueArgs);
|
||||
break;
|
||||
case "breakpoint":
|
||||
// format: breakpoint add <filePath> <line> ?<column>
|
||||
if (parts.length !== 4 && parts.length !== 5) return false;
|
||||
if (parts[1] === "add") {
|
||||
var filePath = parts[2];
|
||||
var line = parseInt(parts[3], 10);
|
||||
if (isNaN(line)) return false;
|
||||
var column = 0;
|
||||
if (parts.length === 5) {
|
||||
column = parseInt(parts[4], 10);
|
||||
if (isNaN(column)) return false;
|
||||
}
|
||||
this._sendBreakpointRequest(filePath, line, column);
|
||||
}
|
||||
break;
|
||||
case "stackframes":
|
||||
// format: stackFrames
|
||||
var stackFrameArgs = {
|
||||
// Prepack will only have 1 thread, this argument will be ignored
|
||||
threadId: _DebuggerConstants.DebuggerConstants.PREPACK_THREAD_ID
|
||||
};
|
||||
this._sendStackFramesRequest(stackFrameArgs);
|
||||
break;
|
||||
case "threads":
|
||||
if (parts.length !== 1) return false;
|
||||
this._sendThreadsRequest();
|
||||
break;
|
||||
case "scopes":
|
||||
if (parts.length !== 2) return false;
|
||||
var frameId = parseInt(parts[1], 10);
|
||||
if (isNaN(frameId)) return false;
|
||||
var scopesArgs = {
|
||||
frameId: frameId
|
||||
};
|
||||
this._sendScopesRequest(scopesArgs);
|
||||
break;
|
||||
case "variables":
|
||||
if (parts.length !== 2) return false;
|
||||
var varRef = parseInt(parts[1], 10);
|
||||
if (isNaN(varRef)) return false;
|
||||
var variableArgs = {
|
||||
variablesReference: varRef
|
||||
};
|
||||
this._sendVariablesRequest(variableArgs);
|
||||
break;
|
||||
case "stepInto":
|
||||
if (parts.length !== 1) return false;
|
||||
var stepIntoArgs = {
|
||||
threadId: _DebuggerConstants.DebuggerConstants.PREPACK_THREAD_ID
|
||||
};
|
||||
this._sendStepIntoRequest(stepIntoArgs);
|
||||
break;
|
||||
case "stepOver":
|
||||
if (parts.length !== 1) return false;
|
||||
var stepOverArgs = {
|
||||
threadId: _DebuggerConstants.DebuggerConstants.PREPACK_THREAD_ID
|
||||
};
|
||||
this._sendStepOverRequest(stepOverArgs);
|
||||
break;
|
||||
case "eval":
|
||||
if (parts.length < 2) return false;
|
||||
var evalFrameId = parseInt(parts[1], 10);
|
||||
if (isNaN(evalFrameId)) {
|
||||
var expression = parts.slice(1).join(" ");
|
||||
var evaluateArgs = {
|
||||
expression: expression
|
||||
};
|
||||
this._sendEvaluateRequest(evaluateArgs);
|
||||
} else {
|
||||
var _expression = parts.slice(2).join(" ");
|
||||
var _evaluateArgs = {
|
||||
expression: _expression,
|
||||
frameId: evalFrameId
|
||||
};
|
||||
this._sendEvaluateRequest(_evaluateArgs);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// invalid command
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// parses the user input into a command and executes it
|
||||
|
||||
}, {
|
||||
key: "_dispatch",
|
||||
value: function _dispatch(input) {
|
||||
var _this4 = this;
|
||||
|
||||
if (input === "exit") {
|
||||
this.shutdown();
|
||||
}
|
||||
var success = this._executeCommand(input);
|
||||
if (!success) {
|
||||
// input was invalid
|
||||
this._invalidCount++;
|
||||
//prevent stack overflow from recursion
|
||||
if (this._invalidCount >= 10) {
|
||||
console.error("Too many invalid commands, shutting down...");
|
||||
this.shutdown();
|
||||
}
|
||||
console.error("Invalid command: " + input);
|
||||
this._reader.question("(dbg) ", function (line) {
|
||||
_this4._dispatch(line);
|
||||
});
|
||||
}
|
||||
//reset the invalid command counter
|
||||
this._invalidCount = 0;
|
||||
}
|
||||
|
||||
// tell the adapter about some configuration details
|
||||
|
||||
}, {
|
||||
key: "_sendInitializeRequest",
|
||||
value: function _sendInitializeRequest(args) {
|
||||
var message = {
|
||||
type: "request",
|
||||
seq: this._sequenceNum,
|
||||
command: "initialize",
|
||||
arguments: args
|
||||
};
|
||||
var json = JSON.stringify(message);
|
||||
this._packageAndSend(json);
|
||||
}
|
||||
|
||||
// tell the adapter to start Prepack
|
||||
|
||||
}, {
|
||||
key: "_sendLaunchRequest",
|
||||
value: function _sendLaunchRequest(args) {
|
||||
var message = {
|
||||
type: "request",
|
||||
seq: this._sequenceNum,
|
||||
command: "launch",
|
||||
arguments: args
|
||||
};
|
||||
var json = JSON.stringify(message);
|
||||
this._packageAndSend(json);
|
||||
}
|
||||
|
||||
// tell the adapter that configuration is done so it can expect other commands
|
||||
|
||||
}, {
|
||||
key: "_sendConfigDoneRequest",
|
||||
value: function _sendConfigDoneRequest(args) {
|
||||
var message = {
|
||||
type: "request",
|
||||
seq: this._sequenceNum,
|
||||
command: "configurationDone",
|
||||
arguments: args
|
||||
};
|
||||
var json = JSON.stringify(message);
|
||||
this._packageAndSend(json);
|
||||
}
|
||||
|
||||
// tell the adapter to continue running Prepack
|
||||
|
||||
}, {
|
||||
key: "_sendContinueRequest",
|
||||
value: function _sendContinueRequest(args) {
|
||||
var message = {
|
||||
type: "request",
|
||||
seq: this._sequenceNum,
|
||||
command: "continue",
|
||||
arguments: args
|
||||
};
|
||||
var json = JSON.stringify(message);
|
||||
this._packageAndSend(json);
|
||||
this._prepackWaiting = false;
|
||||
}
|
||||
}, {
|
||||
key: "_sendBreakpointRequest",
|
||||
value: function _sendBreakpointRequest(filePath, line) {
|
||||
var column = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
|
||||
var source = {
|
||||
path: filePath
|
||||
};
|
||||
var breakpoint = {
|
||||
line: line,
|
||||
column: column
|
||||
};
|
||||
var args = {
|
||||
source: source,
|
||||
breakpoints: [breakpoint]
|
||||
};
|
||||
var message = {
|
||||
type: "request",
|
||||
seq: this._sequenceNum,
|
||||
command: "setBreakpoints",
|
||||
arguments: args
|
||||
};
|
||||
var json = JSON.stringify(message);
|
||||
this._packageAndSend(json);
|
||||
}
|
||||
}, {
|
||||
key: "_sendStackFramesRequest",
|
||||
value: function _sendStackFramesRequest(args) {
|
||||
var message = {
|
||||
type: "request",
|
||||
seq: this._sequenceNum,
|
||||
command: "stackTrace",
|
||||
arguments: args
|
||||
};
|
||||
var json = JSON.stringify(message);
|
||||
this._packageAndSend(json);
|
||||
}
|
||||
}, {
|
||||
key: "_sendThreadsRequest",
|
||||
value: function _sendThreadsRequest() {
|
||||
var message = {
|
||||
type: "request",
|
||||
seq: this._sequenceNum,
|
||||
command: "threads"
|
||||
};
|
||||
var json = JSON.stringify(message);
|
||||
this._packageAndSend(json);
|
||||
}
|
||||
}, {
|
||||
key: "_sendScopesRequest",
|
||||
value: function _sendScopesRequest(args) {
|
||||
var message = {
|
||||
type: "request",
|
||||
seq: this._sequenceNum,
|
||||
command: "scopes",
|
||||
arguments: args
|
||||
};
|
||||
var json = JSON.stringify(message);
|
||||
this._packageAndSend(json);
|
||||
}
|
||||
}, {
|
||||
key: "_sendVariablesRequest",
|
||||
value: function _sendVariablesRequest(args) {
|
||||
var message = {
|
||||
type: "request",
|
||||
seq: this._sequenceNum,
|
||||
command: "variables",
|
||||
arguments: args
|
||||
};
|
||||
var json = JSON.stringify(message);
|
||||
this._packageAndSend(json);
|
||||
}
|
||||
}, {
|
||||
key: "_sendStepIntoRequest",
|
||||
value: function _sendStepIntoRequest(args) {
|
||||
var message = {
|
||||
type: "request",
|
||||
seq: this._sequenceNum,
|
||||
command: "stepIn",
|
||||
arguments: args
|
||||
};
|
||||
var json = JSON.stringify(message);
|
||||
this._packageAndSend(json);
|
||||
}
|
||||
}, {
|
||||
key: "_sendStepOverRequest",
|
||||
value: function _sendStepOverRequest(args) {
|
||||
var message = {
|
||||
type: "request",
|
||||
seq: this._sequenceNum,
|
||||
command: "next",
|
||||
arguments: args
|
||||
};
|
||||
var json = JSON.stringify(message);
|
||||
this._packageAndSend(json);
|
||||
}
|
||||
}, {
|
||||
key: "_sendEvaluateRequest",
|
||||
value: function _sendEvaluateRequest(args) {
|
||||
var message = {
|
||||
type: "request",
|
||||
seq: this._sequenceNum,
|
||||
command: "evaluate",
|
||||
arguments: args
|
||||
};
|
||||
var json = JSON.stringify(message);
|
||||
this._packageAndSend(json);
|
||||
}
|
||||
|
||||
// write out a message to the adapter on stdout
|
||||
|
||||
}, {
|
||||
key: "_packageAndSend",
|
||||
value: function _packageAndSend(message) {
|
||||
// format: Content-Length: <length> separator <message>
|
||||
this._adapterProcess.stdin.write("Content-Length: " + Buffer.byteLength(message, "utf8") + TWO_CRLF + message, "utf8");
|
||||
this._sequenceNum++;
|
||||
}
|
||||
}, {
|
||||
key: "_uiOutput",
|
||||
value: function _uiOutput(message) {
|
||||
console.log(message);
|
||||
}
|
||||
}, {
|
||||
key: "serve",
|
||||
value: function serve() {
|
||||
this._uiOutput("Debugger is starting up Prepack...");
|
||||
// Set up the adapter connection
|
||||
this._startAdapter();
|
||||
|
||||
// send an initialize request to the adapter to fetch some configuration details
|
||||
var initArgs = {
|
||||
// a unique name for each UI (e.g Nuclide, VSCode, CLI)
|
||||
clientID: _DebuggerConstants.DebuggerConstants.CLI_CLIENTID,
|
||||
// a unique name for each adapter
|
||||
adapterID: "Prepack-Debugger-Adapter",
|
||||
linesStartAt1: true,
|
||||
columnsStartAt1: true,
|
||||
supportsVariableType: true,
|
||||
supportsVariablePaging: false,
|
||||
supportsRunInTerminalRequest: false,
|
||||
pathFormat: "path"
|
||||
};
|
||||
this._sendInitializeRequest(initArgs);
|
||||
|
||||
this._reader = _readline2.default.createInterface({ input: this._proc.stdin, output: this._proc.stdout });
|
||||
}
|
||||
}, {
|
||||
key: "shutdown",
|
||||
value: function shutdown() {
|
||||
this._reader.close();
|
||||
this._adapterProcess.kill();
|
||||
this._proc.exit(0);
|
||||
}
|
||||
}]);
|
||||
|
||||
return UISession;
|
||||
}();
|
||||
//# sourceMappingURL=UISession.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/mock-ui/UISession.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/mock-ui/UISession.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
77
build/node_modules/prepack/lib/debugger/mock-ui/debugger-cli.js
generated
vendored
Normal file
77
build/node_modules/prepack/lib/debugger/mock-ui/debugger-cli.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
|
||||
var _UISession = require("./UISession.js");
|
||||
|
||||
/* The entry point to start up the debugger CLI
|
||||
* Reads in command line arguments and starts up a UISession
|
||||
*/
|
||||
|
||||
function run(process, console) {
|
||||
var args = readCLIArguments(process, console);
|
||||
var session = new _UISession.UISession(process, args);
|
||||
try {
|
||||
session.serve();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
session.shutdown();
|
||||
}
|
||||
} /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
function readCLIArguments(process, console) {
|
||||
var adapterPath = "";
|
||||
var prepackRuntime = "";
|
||||
var prepackArguments = [];
|
||||
var sourceFile = "";
|
||||
|
||||
var args = Array.from(process.argv);
|
||||
args.splice(0, 2);
|
||||
//read in the arguments
|
||||
while (args.length > 0) {
|
||||
var arg = args.shift();
|
||||
if (!arg.startsWith("--")) {
|
||||
console.error("Invalid argument: " + arg);
|
||||
process.exit(1);
|
||||
}
|
||||
arg = arg.slice(2);
|
||||
if (arg === "adapterPath") {
|
||||
adapterPath = args.shift();
|
||||
} else if (arg === "prepackRuntime") {
|
||||
prepackRuntime = args.shift();
|
||||
} else if (arg === "prepackArguments") {
|
||||
prepackArguments = args.shift().split(" ");
|
||||
} else if (arg === "sourceFile") {
|
||||
sourceFile = args.shift();
|
||||
} else {
|
||||
console.error("Unknown argument: " + arg);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (adapterPath.length === 0) {
|
||||
console.error("No path to the debug adapter provided!");
|
||||
process.exit(1);
|
||||
}
|
||||
if (prepackRuntime.length === 0) {
|
||||
console.error("No Prepack runtime given to start Prepack");
|
||||
process.exit(1);
|
||||
}
|
||||
if (sourceFile.length === 0) {
|
||||
console.error("No source code input file provided");
|
||||
}
|
||||
var result = {
|
||||
adapterPath: adapterPath,
|
||||
prepackRuntime: prepackRuntime,
|
||||
prepackArguments: prepackArguments,
|
||||
sourceFile: sourceFile
|
||||
};
|
||||
return result;
|
||||
}
|
||||
run(process, console);
|
||||
//# sourceMappingURL=debugger-cli.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/mock-ui/debugger-cli.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/mock-ui/debugger-cli.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/debugger/mock-ui/debugger-cli.js"],"names":["run","process","console","args","readCLIArguments","session","serve","e","error","shutdown","adapterPath","prepackRuntime","prepackArguments","sourceFile","Array","from","argv","splice","length","arg","shift","startsWith","exit","slice","split","result"],"mappings":";;AAWA;;AAEA;;;;AAIA,SAASA,GAAT,CAAaC,OAAb,EAAsBC,OAAtB,EAA+B;AAC7B,MAAIC,OAAOC,iBAAiBH,OAAjB,EAA0BC,OAA1B,CAAX;AACA,MAAIG,UAAU,yBAAcJ,OAAd,EAAuBE,IAAvB,CAAd;AACA,MAAI;AACFE,YAAQC,KAAR;AACD,GAFD,CAEE,OAAOC,CAAP,EAAU;AACVL,YAAQM,KAAR,CAAcD,CAAd;AACAF,YAAQI,QAAR;AACD;AACF,C,CA1BD;;;;;;;;;AA4BA,SAASL,gBAAT,CAA0BH,OAA1B,EAAmCC,OAAnC,EAAkE;AAChE,MAAIQ,cAAc,EAAlB;AACA,MAAIC,iBAAiB,EAArB;AACA,MAAIC,mBAAmB,EAAvB;AACA,MAAIC,aAAa,EAAjB;;AAEA,MAAIV,OAAOW,MAAMC,IAAN,CAAWd,QAAQe,IAAnB,CAAX;AACAb,OAAKc,MAAL,CAAY,CAAZ,EAAe,CAAf;AACA;AACA,SAAOd,KAAKe,MAAL,GAAc,CAArB,EAAwB;AACtB,QAAIC,MAAMhB,KAAKiB,KAAL,EAAV;AACA,QAAI,CAACD,IAAIE,UAAJ,CAAe,IAAf,CAAL,EAA2B;AACzBnB,cAAQM,KAAR,CAAc,uBAAuBW,GAArC;AACAlB,cAAQqB,IAAR,CAAa,CAAb;AACD;AACDH,UAAMA,IAAII,KAAJ,CAAU,CAAV,CAAN;AACA,QAAIJ,QAAQ,aAAZ,EAA2B;AACzBT,oBAAcP,KAAKiB,KAAL,EAAd;AACD,KAFD,MAEO,IAAID,QAAQ,gBAAZ,EAA8B;AACnCR,uBAAiBR,KAAKiB,KAAL,EAAjB;AACD,KAFM,MAEA,IAAID,QAAQ,kBAAZ,EAAgC;AACrCP,yBAAmBT,KAAKiB,KAAL,GAAaI,KAAb,CAAmB,GAAnB,CAAnB;AACD,KAFM,MAEA,IAAIL,QAAQ,YAAZ,EAA0B;AAC/BN,mBAAaV,KAAKiB,KAAL,EAAb;AACD,KAFM,MAEA;AACLlB,cAAQM,KAAR,CAAc,uBAAuBW,GAArC;AACAlB,cAAQqB,IAAR,CAAa,CAAb;AACD;AACF;;AAED,MAAIZ,YAAYQ,MAAZ,KAAuB,CAA3B,EAA8B;AAC5BhB,YAAQM,KAAR,CAAc,wCAAd;AACAP,YAAQqB,IAAR,CAAa,CAAb;AACD;AACD,MAAIX,eAAeO,MAAf,KAA0B,CAA9B,EAAiC;AAC/BhB,YAAQM,KAAR,CAAc,2CAAd;AACAP,YAAQqB,IAAR,CAAa,CAAb;AACD;AACD,MAAIT,WAAWK,MAAX,KAAsB,CAA1B,EAA6B;AAC3BhB,YAAQM,KAAR,CAAc,oCAAd;AACD;AACD,MAAIiB,SAA+B;AACjCf,iBAAaA,WADoB;AAEjCC,oBAAgBA,cAFiB;AAGjCC,sBAAkBA,gBAHe;AAIjCC,gBAAYA;AAJqB,GAAnC;AAMA,SAAOY,MAAP;AACD;AACDzB,IAAIC,OAAJ,EAAaC,OAAb","file":"debugger-cli.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport { UISession } from \"./UISession.js\";\nimport type { DebuggerCLIArguments } from \"./UISession.js\";\n/* The entry point to start up the debugger CLI\n * Reads in command line arguments and starts up a UISession\n*/\n\nfunction run(process, console) {\n let args = readCLIArguments(process, console);\n let session = new UISession(process, args);\n try {\n session.serve();\n } catch (e) {\n console.error(e);\n session.shutdown();\n }\n}\n\nfunction readCLIArguments(process, console): DebuggerCLIArguments {\n let adapterPath = \"\";\n let prepackRuntime = \"\";\n let prepackArguments = [];\n let sourceFile = \"\";\n\n let args = Array.from(process.argv);\n args.splice(0, 2);\n //read in the arguments\n while (args.length > 0) {\n let arg = args.shift();\n if (!arg.startsWith(\"--\")) {\n console.error(\"Invalid argument: \" + arg);\n process.exit(1);\n }\n arg = arg.slice(2);\n if (arg === \"adapterPath\") {\n adapterPath = args.shift();\n } else if (arg === \"prepackRuntime\") {\n prepackRuntime = args.shift();\n } else if (arg === \"prepackArguments\") {\n prepackArguments = args.shift().split(\" \");\n } else if (arg === \"sourceFile\") {\n sourceFile = args.shift();\n } else {\n console.error(\"Unknown argument: \" + arg);\n process.exit(1);\n }\n }\n\n if (adapterPath.length === 0) {\n console.error(\"No path to the debug adapter provided!\");\n process.exit(1);\n }\n if (prepackRuntime.length === 0) {\n console.error(\"No Prepack runtime given to start Prepack\");\n process.exit(1);\n }\n if (sourceFile.length === 0) {\n console.error(\"No source code input file provided\");\n }\n let result: DebuggerCLIArguments = {\n adapterPath: adapterPath,\n prepackRuntime: prepackRuntime,\n prepackArguments: prepackArguments,\n sourceFile: sourceFile,\n };\n return result;\n}\nrun(process, console);\n"]}
|
||||
34
build/node_modules/prepack/lib/debugger/server/Breakpoint.js
generated
vendored
Normal file
34
build/node_modules/prepack/lib/debugger/server/Breakpoint.js
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
/**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var Breakpoint = exports.Breakpoint = function Breakpoint(filePath, line) {
|
||||
var column = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
var temporary = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
||||
var enabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
||||
|
||||
_classCallCheck(this, Breakpoint);
|
||||
|
||||
this.filePath = filePath;
|
||||
this.line = line;
|
||||
this.temporary = temporary;
|
||||
this.enabled = enabled;
|
||||
this.column = column;
|
||||
}
|
||||
|
||||
//real breakpoint set by client or temporary one set by debugger
|
||||
;
|
||||
//# sourceMappingURL=Breakpoint.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/server/Breakpoint.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/server/Breakpoint.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/debugger/server/Breakpoint.js"],"names":["Breakpoint","filePath","line","column","temporary","enabled"],"mappings":";;;;;;;;AAAA;;;;;;;;;IAWaA,U,WAAAA,U,GACX,oBAAYC,QAAZ,EAA8BC,IAA9B,EAAqH;AAAA,MAAzEC,MAAyE,uEAAxD,CAAwD;AAAA,MAArDC,SAAqD,uEAAhC,KAAgC;AAAA,MAAzBC,OAAyB,uEAAN,IAAM;;AAAA;;AACnH,OAAKJ,QAAL,GAAgBA,QAAhB;AACA,OAAKC,IAAL,GAAYA,IAAZ;AACA,OAAKE,SAAL,GAAiBA,SAAjB;AACA,OAAKC,OAAL,GAAeA,OAAf;AACA,OAAKF,MAAL,GAAcA,MAAd;AACD;;AAKD","file":"Breakpoint.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nexport class Breakpoint {\n constructor(filePath: string, line: number, column: number = 0, temporary: boolean = false, enabled: boolean = true) {\n this.filePath = filePath;\n this.line = line;\n this.temporary = temporary;\n this.enabled = enabled;\n this.column = column;\n }\n filePath: string;\n line: number;\n column: number;\n\n //real breakpoint set by client or temporary one set by debugger\n temporary: boolean;\n enabled: boolean;\n}\n"]}
|
||||
152
build/node_modules/prepack/lib/debugger/server/BreakpointManager.js
generated
vendored
Normal file
152
build/node_modules/prepack/lib/debugger/server/BreakpointManager.js
generated
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.BreakpointManager = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _PerFileBreakpointMap = require("./PerFileBreakpointMap.js");
|
||||
|
||||
var _Breakpoint = require("./Breakpoint.js");
|
||||
|
||||
var _babelTypes = require("babel-types");
|
||||
|
||||
var _is = require("./../../methods/is.js");
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
// Storing BreakpointStores for all source files
|
||||
var BreakpointManager = exports.BreakpointManager = function () {
|
||||
function BreakpointManager() {
|
||||
_classCallCheck(this, BreakpointManager);
|
||||
|
||||
this._breakpointMaps = new Map();
|
||||
}
|
||||
|
||||
_createClass(BreakpointManager, [{
|
||||
key: "getStoppableBreakpoint",
|
||||
value: function getStoppableBreakpoint(ast) {
|
||||
if (!(0, _is.IsStatement)(ast)) return;
|
||||
if (ast.loc && ast.loc.source) {
|
||||
var location = ast.loc;
|
||||
var filePath = location.source;
|
||||
if (filePath === null) return;
|
||||
var lineNum = location.start.line;
|
||||
var colNum = location.start.column;
|
||||
// Check whether there is a breakpoint we need to stop on here
|
||||
var breakpoint = this._findStoppableBreakpoint(filePath, lineNum, colNum);
|
||||
if (breakpoint === null) return;
|
||||
return breakpoint;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to find a breakpoint at the given location and check if we should stop on it
|
||||
|
||||
}, {
|
||||
key: "_findStoppableBreakpoint",
|
||||
value: function _findStoppableBreakpoint(filePath, lineNum, colNum) {
|
||||
var breakpoint = this.getBreakpoint(filePath, lineNum, colNum);
|
||||
if (breakpoint && breakpoint.enabled) {
|
||||
return breakpoint;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}, {
|
||||
key: "addBreakpointMulti",
|
||||
value: function addBreakpointMulti(breakpoints) {
|
||||
this._doBreakpointsAction(breakpoints, this._addBreakpoint.bind(this));
|
||||
}
|
||||
}, {
|
||||
key: "_addBreakpoint",
|
||||
value: function _addBreakpoint(bp) {
|
||||
var breakpointMap = this._breakpointMaps.get(bp.filePath);
|
||||
if (!breakpointMap) {
|
||||
breakpointMap = new _PerFileBreakpointMap.PerFileBreakpointMap(bp.filePath);
|
||||
this._breakpointMaps.set(bp.filePath, breakpointMap);
|
||||
}
|
||||
breakpointMap.addBreakpoint(bp.line, bp.column);
|
||||
}
|
||||
}, {
|
||||
key: "getBreakpoint",
|
||||
value: function getBreakpoint(filePath, lineNum) {
|
||||
var columnNum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
||||
|
||||
var breakpointMap = this._breakpointMaps.get(filePath);
|
||||
if (breakpointMap) return breakpointMap.getBreakpoint(lineNum, columnNum);
|
||||
return undefined;
|
||||
}
|
||||
}, {
|
||||
key: "removeBreakpointMulti",
|
||||
value: function removeBreakpointMulti(breakpoints) {
|
||||
this._doBreakpointsAction(breakpoints, this._removeBreakpoint.bind(this));
|
||||
}
|
||||
}, {
|
||||
key: "_removeBreakpoint",
|
||||
value: function _removeBreakpoint(bp) {
|
||||
var breakpointMap = this._breakpointMaps.get(bp.filePath);
|
||||
if (breakpointMap) breakpointMap.removeBreakpoint(bp.line, bp.column);
|
||||
}
|
||||
}, {
|
||||
key: "enableBreakpointMulti",
|
||||
value: function enableBreakpointMulti(breakpoints) {
|
||||
this._doBreakpointsAction(breakpoints, this._enableBreakpoint.bind(this));
|
||||
}
|
||||
}, {
|
||||
key: "_enableBreakpoint",
|
||||
value: function _enableBreakpoint(bp) {
|
||||
var breakpointMap = this._breakpointMaps.get(bp.filePath);
|
||||
if (breakpointMap) breakpointMap.enableBreakpoint(bp.line, bp.column);
|
||||
}
|
||||
}, {
|
||||
key: "disableBreakpointMulti",
|
||||
value: function disableBreakpointMulti(breakpoints) {
|
||||
this._doBreakpointsAction(breakpoints, this._disableBreakpoint.bind(this));
|
||||
}
|
||||
}, {
|
||||
key: "_disableBreakpoint",
|
||||
value: function _disableBreakpoint(bp) {
|
||||
var breakpointMap = this._breakpointMaps.get(bp.filePath);
|
||||
if (breakpointMap) breakpointMap.disableBreakpoint(bp.line, bp.column);
|
||||
}
|
||||
}, {
|
||||
key: "_doBreakpointsAction",
|
||||
value: function _doBreakpointsAction(breakpoints, action) {
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = breakpoints[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var bp = _step.value;
|
||||
|
||||
action(bp);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
||||
return BreakpointManager;
|
||||
}();
|
||||
//# sourceMappingURL=BreakpointManager.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/server/BreakpointManager.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/server/BreakpointManager.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
303
build/node_modules/prepack/lib/debugger/server/Debugger.js
generated
vendored
Normal file
303
build/node_modules/prepack/lib/debugger/server/Debugger.js
generated
vendored
Normal file
@@ -0,0 +1,303 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DebugServer = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _BreakpointManager = require("./BreakpointManager.js");
|
||||
|
||||
var _invariant = require("../common/invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _DebugMessage = require("./../common/channel/DebugMessage.js");
|
||||
|
||||
var _DebuggerError = require("./../common/DebuggerError.js");
|
||||
|
||||
var _realm = require("./../../realm.js");
|
||||
|
||||
var _VariableManager = require("./VariableManager.js");
|
||||
|
||||
var _SteppingManager = require("./SteppingManager.js");
|
||||
|
||||
var _StopEventManager = require("./StopEventManager.js");
|
||||
|
||||
var _environment = require("./../../environment.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var DebugServer = exports.DebugServer = function () {
|
||||
function DebugServer(channel, realm) {
|
||||
_classCallCheck(this, DebugServer);
|
||||
|
||||
this._channel = channel;
|
||||
this._realm = realm;
|
||||
this._breakpointManager = new _BreakpointManager.BreakpointManager();
|
||||
this._variableManager = new _VariableManager.VariableManager(realm);
|
||||
this._stepManager = new _SteppingManager.SteppingManager(this._realm, /* default discard old steppers */false);
|
||||
this._stopEventManager = new _StopEventManager.StopEventManager();
|
||||
this.waitForRun(undefined);
|
||||
}
|
||||
// the collection of breakpoints
|
||||
|
||||
// the channel to communicate with the adapter
|
||||
|
||||
|
||||
_createClass(DebugServer, [{
|
||||
key: "waitForRun",
|
||||
|
||||
|
||||
/* Block until adapter says to run
|
||||
/* ast: the current ast node we are stopped on
|
||||
/* reason: the reason the debuggee is stopping
|
||||
*/
|
||||
value: function waitForRun(ast) {
|
||||
var keepRunning = false;
|
||||
var request = void 0;
|
||||
while (!keepRunning) {
|
||||
request = this._channel.readIn();
|
||||
keepRunning = this.processDebuggerCommand(request, ast);
|
||||
}
|
||||
}
|
||||
|
||||
// Checking if the debugger needs to take any action on reaching this ast node
|
||||
|
||||
}, {
|
||||
key: "checkForActions",
|
||||
value: function checkForActions(ast) {
|
||||
if (this._checkAndUpdateLastExecuted(ast)) {
|
||||
var stoppables = this._stepManager.getAndDeleteCompletedSteppers(ast);
|
||||
var breakpoint = this._breakpointManager.getStoppableBreakpoint(ast);
|
||||
if (breakpoint) stoppables.push(breakpoint);
|
||||
var reason = this._stopEventManager.getDebuggeeStopReason(ast, stoppables);
|
||||
if (reason) {
|
||||
(0, _invariant2.default)(ast.loc && ast.loc.source);
|
||||
this._channel.sendStoppedResponse(reason, ast.loc.source, ast.loc.start.line, ast.loc.start.column);
|
||||
this.waitForRun(ast);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Process a command from a debugger. Returns whether Prepack should unblock
|
||||
// if it is blocked
|
||||
|
||||
}, {
|
||||
key: "processDebuggerCommand",
|
||||
value: function processDebuggerCommand(request, ast) {
|
||||
var requestID = request.id;
|
||||
var command = request.command;
|
||||
var args = request.arguments;
|
||||
switch (command) {
|
||||
case _DebugMessage.DebugMessage.BREAKPOINT_ADD_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "breakpoint");
|
||||
this._breakpointManager.addBreakpointMulti(args.breakpoints);
|
||||
this._channel.sendBreakpointsAcknowledge(_DebugMessage.DebugMessage.BREAKPOINT_ADD_ACKNOWLEDGE, requestID, args);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.BREAKPOINT_REMOVE_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "breakpoint");
|
||||
this._breakpointManager.removeBreakpointMulti(args.breakpoints);
|
||||
this._channel.sendBreakpointsAcknowledge(_DebugMessage.DebugMessage.BREAKPOINT_REMOVE_ACKNOWLEDGE, requestID, args);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.BREAKPOINT_ENABLE_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "breakpoint");
|
||||
this._breakpointManager.enableBreakpointMulti(args.breakpoints);
|
||||
this._channel.sendBreakpointsAcknowledge(_DebugMessage.DebugMessage.BREAKPOINT_ENABLE_ACKNOWLEDGE, requestID, args);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.BREAKPOINT_DISABLE_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "breakpoint");
|
||||
this._breakpointManager.disableBreakpointMulti(args.breakpoints);
|
||||
this._channel.sendBreakpointsAcknowledge(_DebugMessage.DebugMessage.BREAKPOINT_DISABLE_ACKNOWLEDGE, requestID, args);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.PREPACK_RUN_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "run");
|
||||
this._onDebuggeeResume();
|
||||
return true;
|
||||
case _DebugMessage.DebugMessage.STACKFRAMES_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "stackframe");
|
||||
this.processStackframesCommand(requestID, args, ast);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.SCOPES_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "scopes");
|
||||
this.processScopesCommand(requestID, args);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.VARIABLES_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "variables");
|
||||
this.processVariablesCommand(requestID, args);
|
||||
break;
|
||||
case _DebugMessage.DebugMessage.STEPINTO_COMMAND:
|
||||
(0, _invariant2.default)(ast !== undefined);
|
||||
this._stepManager.processStepCommand("in", ast);
|
||||
this._onDebuggeeResume();
|
||||
return true;
|
||||
case _DebugMessage.DebugMessage.STEPOVER_COMMAND:
|
||||
(0, _invariant2.default)(ast !== undefined);
|
||||
this._stepManager.processStepCommand("over", ast);
|
||||
this._onDebuggeeResume();
|
||||
return true;
|
||||
case _DebugMessage.DebugMessage.EVALUATE_COMMAND:
|
||||
(0, _invariant2.default)(args.kind === "evaluate");
|
||||
this.processEvaluateCommand(requestID, args);
|
||||
break;
|
||||
default:
|
||||
throw new _DebuggerError.DebuggerError("Invalid command", "Invalid command from adapter: " + command);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
key: "processStackframesCommand",
|
||||
value: function processStackframesCommand(requestID, args, ast) {
|
||||
var frameInfos = [];
|
||||
var loc = this._getFrameLocation(ast ? ast.loc : null);
|
||||
var fileName = loc.fileName;
|
||||
var line = loc.line;
|
||||
var column = loc.column;
|
||||
|
||||
// the UI displays the current frame as index 0, so we iterate backwards
|
||||
// from the current frame
|
||||
for (var i = this._realm.contextStack.length - 1; i >= 0; i--) {
|
||||
var frame = this._realm.contextStack[i];
|
||||
var functionName = "(anonymous function)";
|
||||
if (frame.function && frame.function.__originalName) {
|
||||
functionName = frame.function.__originalName;
|
||||
}
|
||||
|
||||
var frameInfo = {
|
||||
id: this._realm.contextStack.length - 1 - i,
|
||||
functionName: functionName,
|
||||
fileName: fileName,
|
||||
line: line,
|
||||
column: column
|
||||
};
|
||||
frameInfos.push(frameInfo);
|
||||
loc = this._getFrameLocation(frame.loc);
|
||||
fileName = loc.fileName;
|
||||
line = loc.line;
|
||||
column = loc.column;
|
||||
}
|
||||
this._channel.sendStackframeResponse(requestID, frameInfos);
|
||||
}
|
||||
}, {
|
||||
key: "_getFrameLocation",
|
||||
value: function _getFrameLocation(loc) {
|
||||
var fileName = "unknown";
|
||||
var line = 0;
|
||||
var column = 0;
|
||||
if (loc && loc.source) {
|
||||
fileName = loc.source;
|
||||
line = loc.start.line;
|
||||
column = loc.start.column;
|
||||
}
|
||||
return {
|
||||
fileName: fileName,
|
||||
line: line,
|
||||
column: column
|
||||
};
|
||||
}
|
||||
}, {
|
||||
key: "processScopesCommand",
|
||||
value: function processScopesCommand(requestID, args) {
|
||||
// first check that frameId is in the valid range
|
||||
if (args.frameId < 0 || args.frameId >= this._realm.contextStack.length) {
|
||||
throw new _DebuggerError.DebuggerError("Invalid command", "Invalid frame id for scopes request: " + args.frameId);
|
||||
}
|
||||
// here the frameId is in reverse order of the contextStack, ie frameId 0
|
||||
// refers to last element of contextStack
|
||||
var stackIndex = this._realm.contextStack.length - 1 - args.frameId;
|
||||
var context = this._realm.contextStack[stackIndex];
|
||||
(0, _invariant2.default)(context instanceof _realm.ExecutionContext);
|
||||
var scopes = [];
|
||||
var lexicalEnv = context.lexicalEnvironment;
|
||||
while (lexicalEnv) {
|
||||
var scope = {
|
||||
name: this._getScopeName(lexicalEnv.environmentRecord),
|
||||
// key used by UI to retrieve variables in this scope
|
||||
variablesReference: this._variableManager.getReferenceForValue(lexicalEnv),
|
||||
// the variables are easy to retrieve
|
||||
expensive: false
|
||||
};
|
||||
scopes.push(scope);
|
||||
lexicalEnv = lexicalEnv.parent;
|
||||
}
|
||||
this._channel.sendScopesResponse(requestID, scopes);
|
||||
}
|
||||
}, {
|
||||
key: "_getScopeName",
|
||||
value: function _getScopeName(envRec) {
|
||||
if (envRec instanceof _environment.GlobalEnvironmentRecord) {
|
||||
return "Global";
|
||||
} else if (envRec instanceof _environment.DeclarativeEnvironmentRecord) {
|
||||
if (envRec instanceof _environment.FunctionEnvironmentRecord) {
|
||||
return "Local: " + (envRec.$FunctionObject.__originalName || "anonymous function");
|
||||
} else {
|
||||
return "Block";
|
||||
}
|
||||
} else if (envRec instanceof _environment.ObjectEnvironmentRecord) {
|
||||
return "With";
|
||||
} else {
|
||||
(0, _invariant2.default)(false, "Invalid type of environment record");
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "processVariablesCommand",
|
||||
value: function processVariablesCommand(requestID, args) {
|
||||
var variables = this._variableManager.getVariablesByReference(args.variablesReference);
|
||||
this._channel.sendVariablesResponse(requestID, variables);
|
||||
}
|
||||
}, {
|
||||
key: "processEvaluateCommand",
|
||||
value: function processEvaluateCommand(requestID, args) {
|
||||
var evalResult = this._variableManager.evaluate(args.frameId, args.expression);
|
||||
this._channel.sendEvaluateResponse(requestID, evalResult);
|
||||
}
|
||||
|
||||
// actions that need to happen before Prepack can resume
|
||||
|
||||
}, {
|
||||
key: "_onDebuggeeResume",
|
||||
value: function _onDebuggeeResume() {
|
||||
// resets the variable manager
|
||||
this._variableManager.clean();
|
||||
}
|
||||
}, {
|
||||
key: "_checkAndUpdateLastExecuted",
|
||||
value: function _checkAndUpdateLastExecuted(ast) {
|
||||
if (ast.loc && ast.loc.source) {
|
||||
var filePath = ast.loc.source;
|
||||
var line = ast.loc.start.line;
|
||||
var column = ast.loc.start.column;
|
||||
// check if the current location is same as the last one
|
||||
if (this._lastExecuted && filePath === this._lastExecuted.filePath && line === this._lastExecuted.line && column === this._lastExecuted.column) {
|
||||
return false;
|
||||
}
|
||||
this._lastExecuted = {
|
||||
filePath: filePath,
|
||||
line: line,
|
||||
column: column
|
||||
};
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
key: "shutdown",
|
||||
value: function shutdown() {
|
||||
// clean the channel pipes
|
||||
this._channel.shutdown();
|
||||
}
|
||||
}]);
|
||||
|
||||
return DebugServer;
|
||||
}();
|
||||
//# sourceMappingURL=Debugger.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/server/Debugger.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/server/Debugger.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
107
build/node_modules/prepack/lib/debugger/server/PerFileBreakpointMap.js
generated
vendored
Normal file
107
build/node_modules/prepack/lib/debugger/server/PerFileBreakpointMap.js
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.PerFileBreakpointMap = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _Breakpoint = require("./Breakpoint.js");
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
// Storage for all the breakpoints in one source file
|
||||
// Each source file will be associated with one PerFileBreakpointMap
|
||||
var PerFileBreakpointMap = exports.PerFileBreakpointMap = function () {
|
||||
function PerFileBreakpointMap(filePath) {
|
||||
_classCallCheck(this, PerFileBreakpointMap);
|
||||
|
||||
this._filePath = filePath;
|
||||
this._breakpoints = new Map();
|
||||
}
|
||||
|
||||
//map of line:column to Breakpoint objects
|
||||
|
||||
|
||||
_createClass(PerFileBreakpointMap, [{
|
||||
key: "addBreakpoint",
|
||||
value: function addBreakpoint(line) {
|
||||
var column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
var temporary = arguments[2];
|
||||
var enabled = arguments[3];
|
||||
|
||||
var breakpoint = new _Breakpoint.Breakpoint(this._filePath, line, column, temporary, enabled);
|
||||
var key = this._getKey(line, column);
|
||||
this._breakpoints.set(key, breakpoint);
|
||||
}
|
||||
}, {
|
||||
key: "getBreakpoint",
|
||||
value: function getBreakpoint(line) {
|
||||
var column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
|
||||
//check for a column breakpoint first, then line breakpoint
|
||||
if (column !== 0) {
|
||||
var key = this._getKey(line, column);
|
||||
if (this._breakpoints.has(key)) {
|
||||
return this._breakpoints.get(key);
|
||||
} else {
|
||||
key = this._getKey(line, 0);
|
||||
if (this._breakpoints.has(key)) {
|
||||
return this._breakpoints.get(key);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var _key = this._getKey(line, 0);
|
||||
if (this._breakpoints.has(_key)) {
|
||||
return this._breakpoints.get(_key);
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}, {
|
||||
key: "removeBreakpoint",
|
||||
value: function removeBreakpoint(line) {
|
||||
var column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
|
||||
var key = this._getKey(line, column);
|
||||
if (this._breakpoints.has(key)) {
|
||||
this._breakpoints.delete(key);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "enableBreakpoint",
|
||||
value: function enableBreakpoint(line) {
|
||||
var column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
|
||||
var key = this._getKey(line, column);
|
||||
var breakpoint = this._breakpoints.get(key);
|
||||
if (breakpoint) breakpoint.enabled = true;
|
||||
}
|
||||
}, {
|
||||
key: "disableBreakpoint",
|
||||
value: function disableBreakpoint(line) {
|
||||
var column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
||||
|
||||
var key = this._getKey(line, column);
|
||||
var breakpoint = this._breakpoints.get(key);
|
||||
if (breakpoint) breakpoint.enabled = false;
|
||||
}
|
||||
}, {
|
||||
key: "_getKey",
|
||||
value: function _getKey(line, column) {
|
||||
return line + ":" + column;
|
||||
}
|
||||
}]);
|
||||
|
||||
return PerFileBreakpointMap;
|
||||
}();
|
||||
//# sourceMappingURL=PerFileBreakpointMap.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/server/PerFileBreakpointMap.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/server/PerFileBreakpointMap.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/debugger/server/PerFileBreakpointMap.js"],"names":["PerFileBreakpointMap","filePath","_filePath","_breakpoints","Map","line","column","temporary","enabled","breakpoint","key","_getKey","set","has","get","undefined","delete"],"mappings":";;;;;;;qjBAAA;;;;;;;;;AAWA;;;;AAEA;AACA;IACaA,oB,WAAAA,oB;AACX,gCAAYC,QAAZ,EAA8B;AAAA;;AAC5B,SAAKC,SAAL,GAAiBD,QAAjB;AACA,SAAKE,YAAL,GAAoB,IAAIC,GAAJ,EAApB;AACD;;AAGD;;;;;kCAGcC,I,EAA0E;AAAA,UAA5DC,MAA4D,uEAA3C,CAA2C;AAAA,UAAxCC,SAAwC;AAAA,UAAnBC,OAAmB;;AACtF,UAAIC,aAAa,2BAAe,KAAKP,SAApB,EAA+BG,IAA/B,EAAqCC,MAArC,EAA6CC,SAA7C,EAAwDC,OAAxD,CAAjB;AACA,UAAIE,MAAM,KAAKC,OAAL,CAAaN,IAAb,EAAmBC,MAAnB,CAAV;AACA,WAAKH,YAAL,CAAkBS,GAAlB,CAAsBF,GAAtB,EAA2BD,UAA3B;AACD;;;kCAEaJ,I,EAAqD;AAAA,UAAvCC,MAAuC,uEAAtB,CAAsB;;AACjE;AACA,UAAIA,WAAW,CAAf,EAAkB;AAChB,YAAII,MAAM,KAAKC,OAAL,CAAaN,IAAb,EAAmBC,MAAnB,CAAV;AACA,YAAI,KAAKH,YAAL,CAAkBU,GAAlB,CAAsBH,GAAtB,CAAJ,EAAgC;AAC9B,iBAAO,KAAKP,YAAL,CAAkBW,GAAlB,CAAsBJ,GAAtB,CAAP;AACD,SAFD,MAEO;AACLA,gBAAM,KAAKC,OAAL,CAAaN,IAAb,EAAmB,CAAnB,CAAN;AACA,cAAI,KAAKF,YAAL,CAAkBU,GAAlB,CAAsBH,GAAtB,CAAJ,EAAgC;AAC9B,mBAAO,KAAKP,YAAL,CAAkBW,GAAlB,CAAsBJ,GAAtB,CAAP;AACD;AACF;AACF,OAVD,MAUO;AACL,YAAIA,OAAM,KAAKC,OAAL,CAAaN,IAAb,EAAmB,CAAnB,CAAV;AACA,YAAI,KAAKF,YAAL,CAAkBU,GAAlB,CAAsBH,IAAtB,CAAJ,EAAgC;AAC9B,iBAAO,KAAKP,YAAL,CAAkBW,GAAlB,CAAsBJ,IAAtB,CAAP;AACD;AACF;;AAED,aAAOK,SAAP;AACD;;;qCAEgBV,I,EAAkC;AAAA,UAApBC,MAAoB,uEAAH,CAAG;;AACjD,UAAII,MAAM,KAAKC,OAAL,CAAaN,IAAb,EAAmBC,MAAnB,CAAV;AACA,UAAI,KAAKH,YAAL,CAAkBU,GAAlB,CAAsBH,GAAtB,CAAJ,EAAgC;AAC9B,aAAKP,YAAL,CAAkBa,MAAlB,CAAyBN,GAAzB;AACD;AACF;;;qCAEgBL,I,EAAkC;AAAA,UAApBC,MAAoB,uEAAH,CAAG;;AACjD,UAAII,MAAM,KAAKC,OAAL,CAAaN,IAAb,EAAmBC,MAAnB,CAAV;AACA,UAAIG,aAAa,KAAKN,YAAL,CAAkBW,GAAlB,CAAsBJ,GAAtB,CAAjB;AACA,UAAID,UAAJ,EAAgBA,WAAWD,OAAX,GAAqB,IAArB;AACjB;;;sCAEiBH,I,EAAkC;AAAA,UAApBC,MAAoB,uEAAH,CAAG;;AAClD,UAAII,MAAM,KAAKC,OAAL,CAAaN,IAAb,EAAmBC,MAAnB,CAAV;AACA,UAAIG,aAAa,KAAKN,YAAL,CAAkBW,GAAlB,CAAsBJ,GAAtB,CAAjB;AACA,UAAID,UAAJ,EAAgBA,WAAWD,OAAX,GAAqB,KAArB;AACjB;;;4BAEOH,I,EAAcC,M,EAAwB;AAC5C,aAAUD,IAAV,SAAkBC,MAAlB;AACD","file":"PerFileBreakpointMap.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport { Breakpoint } from \"./Breakpoint.js\";\n\n// Storage for all the breakpoints in one source file\n// Each source file will be associated with one PerFileBreakpointMap\nexport class PerFileBreakpointMap {\n constructor(filePath: string) {\n this._filePath = filePath;\n this._breakpoints = new Map();\n }\n _filePath: string;\n\n //map of line:column to Breakpoint objects\n _breakpoints: Map<string, Breakpoint>;\n\n addBreakpoint(line: number, column: number = 0, temporary?: boolean, enabled?: boolean) {\n let breakpoint = new Breakpoint(this._filePath, line, column, temporary, enabled);\n let key = this._getKey(line, column);\n this._breakpoints.set(key, breakpoint);\n }\n\n getBreakpoint(line: number, column: number = 0): void | Breakpoint {\n //check for a column breakpoint first, then line breakpoint\n if (column !== 0) {\n let key = this._getKey(line, column);\n if (this._breakpoints.has(key)) {\n return this._breakpoints.get(key);\n } else {\n key = this._getKey(line, 0);\n if (this._breakpoints.has(key)) {\n return this._breakpoints.get(key);\n }\n }\n } else {\n let key = this._getKey(line, 0);\n if (this._breakpoints.has(key)) {\n return this._breakpoints.get(key);\n }\n }\n\n return undefined;\n }\n\n removeBreakpoint(line: number, column: number = 0) {\n let key = this._getKey(line, column);\n if (this._breakpoints.has(key)) {\n this._breakpoints.delete(key);\n }\n }\n\n enableBreakpoint(line: number, column: number = 0) {\n let key = this._getKey(line, column);\n let breakpoint = this._breakpoints.get(key);\n if (breakpoint) breakpoint.enabled = true;\n }\n\n disableBreakpoint(line: number, column: number = 0) {\n let key = this._getKey(line, column);\n let breakpoint = this._breakpoints.get(key);\n if (breakpoint) breakpoint.enabled = false;\n }\n\n _getKey(line: number, column: number): string {\n return `${line}:${column}`;\n }\n}\n"]}
|
||||
53
build/node_modules/prepack/lib/debugger/server/ReferenceMap.js
generated
vendored
Normal file
53
build/node_modules/prepack/lib/debugger/server/ReferenceMap.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
/**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
// A map with an incrementing counter as the keys
|
||||
// Used to store references to variable collections since DebugProtocol
|
||||
// specifies fetching variable collections via unique IDs
|
||||
var ReferenceMap = exports.ReferenceMap = function () {
|
||||
function ReferenceMap() {
|
||||
_classCallCheck(this, ReferenceMap);
|
||||
|
||||
this._counter = 0;
|
||||
this._mapping = new Map();
|
||||
}
|
||||
|
||||
_createClass(ReferenceMap, [{
|
||||
key: "add",
|
||||
value: function add(value) {
|
||||
this._counter++;
|
||||
this._mapping.set(this._counter, value);
|
||||
return this._counter;
|
||||
}
|
||||
}, {
|
||||
key: "get",
|
||||
value: function get(reference) {
|
||||
return this._mapping.get(reference);
|
||||
}
|
||||
}, {
|
||||
key: "clean",
|
||||
value: function clean() {
|
||||
this._counter = 0;
|
||||
this._mapping = new Map();
|
||||
}
|
||||
}]);
|
||||
|
||||
return ReferenceMap;
|
||||
}();
|
||||
//# sourceMappingURL=ReferenceMap.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/server/ReferenceMap.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/server/ReferenceMap.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/debugger/server/ReferenceMap.js"],"names":["ReferenceMap","_counter","_mapping","Map","value","set","reference","get"],"mappings":";;;;;;;;;;AAAA;;;;;;;;;AAWA;AACA;AACA;IACaA,Y,WAAAA,Y;AACX,0BAAc;AAAA;;AACZ,SAAKC,QAAL,GAAgB,CAAhB;AACA,SAAKC,QAAL,GAAgB,IAAIC,GAAJ,EAAhB;AACD;;;;wBAIGC,K,EAAkB;AACpB,WAAKH,QAAL;AACA,WAAKC,QAAL,CAAcG,GAAd,CAAkB,KAAKJ,QAAvB,EAAiCG,KAAjC;AACA,aAAO,KAAKH,QAAZ;AACD;;;wBAEGK,S,EAA6B;AAC/B,aAAO,KAAKJ,QAAL,CAAcK,GAAd,CAAkBD,SAAlB,CAAP;AACD;;;4BAEO;AACN,WAAKL,QAAL,GAAgB,CAAhB;AACA,WAAKC,QAAL,GAAgB,IAAIC,GAAJ,EAAhB;AACD","file":"ReferenceMap.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\n// A map with an incrementing counter as the keys\n// Used to store references to variable collections since DebugProtocol\n// specifies fetching variable collections via unique IDs\nexport class ReferenceMap<T> {\n constructor() {\n this._counter = 0;\n this._mapping = new Map();\n }\n _counter: number;\n _mapping: Map<number, T>;\n\n add(value: T): number {\n this._counter++;\n this._mapping.set(this._counter, value);\n return this._counter;\n }\n\n get(reference: number): void | T {\n return this._mapping.get(reference);\n }\n\n clean() {\n this._counter = 0;\n this._mapping = new Map();\n }\n}\n"]}
|
||||
126
build/node_modules/prepack/lib/debugger/server/Stepper.js
generated
vendored
Normal file
126
build/node_modules/prepack/lib/debugger/server/Stepper.js
generated
vendored
Normal file
@@ -0,0 +1,126 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.StepOverStepper = exports.StepIntoStepper = exports.Stepper = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _is = require("./../../methods/is.js");
|
||||
|
||||
var _babelTypes = require("babel-types");
|
||||
|
||||
var _invariant = require("./../common/invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Stepper = exports.Stepper = function () {
|
||||
function Stepper(filePath, line, column) {
|
||||
_classCallCheck(this, Stepper);
|
||||
|
||||
this._stepStartData = {
|
||||
filePath: filePath,
|
||||
line: line,
|
||||
column: column
|
||||
};
|
||||
}
|
||||
|
||||
_createClass(Stepper, [{
|
||||
key: "isComplete",
|
||||
value: function isComplete(ast, currentStackSize) {
|
||||
(0, _invariant2.default)(false, "Abstract method, please override");
|
||||
}
|
||||
}, {
|
||||
key: "isAstLocationChanged",
|
||||
value: function isAstLocationChanged(ast) {
|
||||
// we should only step to statements
|
||||
if (!(0, _is.IsStatement)(ast)) return false;
|
||||
var loc = ast.loc;
|
||||
if (!loc) return false;
|
||||
var filePath = loc.source;
|
||||
var line = loc.start.line;
|
||||
var column = loc.start.column;
|
||||
if (!filePath) return false;
|
||||
if (this._stepStartData) {
|
||||
if (filePath === this._stepStartData.filePath && line === this._stepStartData.line && column === this._stepStartData.column) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Stepper;
|
||||
}();
|
||||
|
||||
var StepIntoStepper = exports.StepIntoStepper = function (_Stepper) {
|
||||
_inherits(StepIntoStepper, _Stepper);
|
||||
|
||||
function StepIntoStepper(filePath, line, column) {
|
||||
_classCallCheck(this, StepIntoStepper);
|
||||
|
||||
return _possibleConstructorReturn(this, (StepIntoStepper.__proto__ || Object.getPrototypeOf(StepIntoStepper)).call(this, filePath, line, column));
|
||||
}
|
||||
|
||||
// Override
|
||||
|
||||
|
||||
_createClass(StepIntoStepper, [{
|
||||
key: "isComplete",
|
||||
value: function isComplete(ast, currentStackSize) {
|
||||
return this.isAstLocationChanged(ast);
|
||||
}
|
||||
}]);
|
||||
|
||||
return StepIntoStepper;
|
||||
}(Stepper);
|
||||
|
||||
var StepOverStepper = exports.StepOverStepper = function (_Stepper2) {
|
||||
_inherits(StepOverStepper, _Stepper2);
|
||||
|
||||
function StepOverStepper(filePath, line, column, stackSize) {
|
||||
_classCallCheck(this, StepOverStepper);
|
||||
|
||||
var _this2 = _possibleConstructorReturn(this, (StepOverStepper.__proto__ || Object.getPrototypeOf(StepOverStepper)).call(this, filePath, line, column));
|
||||
|
||||
_this2._startStackSize = stackSize;
|
||||
return _this2;
|
||||
}
|
||||
|
||||
_createClass(StepOverStepper, [{
|
||||
key: "isComplete",
|
||||
value: function isComplete(ast, currentStackSize) {
|
||||
if (!this.isAstLocationChanged(ast)) return false;
|
||||
if (currentStackSize <= this._startStackSize) {
|
||||
// two cases here:
|
||||
// if current stack length < starting stack length, the program must have
|
||||
// hit an exception so this stepper is no longer relevant
|
||||
// if current stack length === starting stack length, the program returned
|
||||
// to the same stack depth, so a step over is complete
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}]);
|
||||
|
||||
return StepOverStepper;
|
||||
}(Stepper);
|
||||
//# sourceMappingURL=Stepper.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/server/Stepper.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/server/Stepper.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/debugger/server/Stepper.js"],"names":["Stepper","filePath","line","column","_stepStartData","ast","currentStackSize","loc","source","start","StepIntoStepper","isAstLocationChanged","StepOverStepper","stackSize","_startStackSize"],"mappings":";;;;;;;qjBAAA;;;;;;;;;AAWA;;AACA;;AACA;;;;;;;;;;;;IAEaA,O,WAAAA,O;AACX,mBAAYC,QAAZ,EAA8BC,IAA9B,EAA4CC,MAA5C,EAA4D;AAAA;;AAC1D,SAAKC,cAAL,GAAsB;AACpBH,gBAAUA,QADU;AAEpBC,YAAMA,IAFc;AAGpBC,cAAQA;AAHY,KAAtB;AAKD;;;;+BAGUE,G,EAAgBC,gB,EAAmC;AAC5D,+BAAU,KAAV,EAAiB,kCAAjB;AACD;;;yCAEoBD,G,EAAgB;AACnC;AACA,UAAI,CAAC,qBAAYA,GAAZ,CAAL,EAAuB,OAAO,KAAP;AACvB,UAAIE,MAAMF,IAAIE,GAAd;AACA,UAAI,CAACA,GAAL,EAAU,OAAO,KAAP;AACV,UAAIN,WAAWM,IAAIC,MAAnB;AACA,UAAIN,OAAOK,IAAIE,KAAJ,CAAUP,IAArB;AACA,UAAIC,SAASI,IAAIE,KAAJ,CAAUN,MAAvB;AACA,UAAI,CAACF,QAAL,EAAe,OAAO,KAAP;AACf,UAAI,KAAKG,cAAT,EAAyB;AACvB,YACEH,aAAa,KAAKG,cAAL,CAAoBH,QAAjC,IACAC,SAAS,KAAKE,cAAL,CAAoBF,IAD7B,IAEAC,WAAW,KAAKC,cAAL,CAAoBD,MAHjC,EAIE;AACA,iBAAO,KAAP;AACD;AACF,OARD,MAQO;AACL,eAAO,KAAP;AACD;AACD,aAAO,IAAP;AACD;;;;;;IAGUO,e,WAAAA,e;;;AACX,2BAAYT,QAAZ,EAA8BC,IAA9B,EAA4CC,MAA5C,EAA4D;AAAA;;AAAA,6HACpDF,QADoD,EAC1CC,IAD0C,EACpCC,MADoC;AAE3D;;AAED;;;;;+BACWE,G,EAAgBC,gB,EAAmC;AAC5D,aAAO,KAAKK,oBAAL,CAA0BN,GAA1B,CAAP;AACD;;;;EARkCL,O;;IAWxBY,e,WAAAA,e;;;AACX,2BAAYX,QAAZ,EAA8BC,IAA9B,EAA4CC,MAA5C,EAA4DU,SAA5D,EAA+E;AAAA;;AAAA,mIACvEZ,QADuE,EAC7DC,IAD6D,EACvDC,MADuD;;AAE7E,WAAKW,eAAL,GAAuBD,SAAvB;AAF6E;AAG9E;;;;+BAGUR,G,EAAgBC,gB,EAAmC;AAC5D,UAAI,CAAC,KAAKK,oBAAL,CAA0BN,GAA1B,CAAL,EAAqC,OAAO,KAAP;AACrC,UAAIC,oBAAoB,KAAKQ,eAA7B,EAA8C;AAC5C;AACA;AACA;AACA;AACA;AACA,eAAO,IAAP;AACD;AACD,aAAO,KAAP;AACD;;;;EAlBkCd,O","file":"Stepper.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\nimport type { SourceData } from \"./../common/types.js\";\nimport { IsStatement } from \"./../../methods/is.js\";\nimport { BabelNode } from \"babel-types\";\nimport invariant from \"./../common/invariant.js\";\n\nexport class Stepper {\n constructor(filePath: string, line: number, column: number) {\n this._stepStartData = {\n filePath: filePath,\n line: line,\n column: column,\n };\n }\n _stepStartData: SourceData;\n\n isComplete(ast: BabelNode, currentStackSize: number): boolean {\n invariant(false, \"Abstract method, please override\");\n }\n\n isAstLocationChanged(ast: BabelNode) {\n // we should only step to statements\n if (!IsStatement(ast)) return false;\n let loc = ast.loc;\n if (!loc) return false;\n let filePath = loc.source;\n let line = loc.start.line;\n let column = loc.start.column;\n if (!filePath) return false;\n if (this._stepStartData) {\n if (\n filePath === this._stepStartData.filePath &&\n line === this._stepStartData.line &&\n column === this._stepStartData.column\n ) {\n return false;\n }\n } else {\n return false;\n }\n return true;\n }\n}\n\nexport class StepIntoStepper extends Stepper {\n constructor(filePath: string, line: number, column: number) {\n super(filePath, line, column);\n }\n\n // Override\n isComplete(ast: BabelNode, currentStackSize: number): boolean {\n return this.isAstLocationChanged(ast);\n }\n}\n\nexport class StepOverStepper extends Stepper {\n constructor(filePath: string, line: number, column: number, stackSize: number) {\n super(filePath, line, column);\n this._startStackSize = stackSize;\n }\n _startStackSize: number;\n\n isComplete(ast: BabelNode, currentStackSize: number): boolean {\n if (!this.isAstLocationChanged(ast)) return false;\n if (currentStackSize <= this._startStackSize) {\n // two cases here:\n // if current stack length < starting stack length, the program must have\n // hit an exception so this stepper is no longer relevant\n // if current stack length === starting stack length, the program returned\n // to the same stack depth, so a step over is complete\n return true;\n }\n return false;\n }\n}\n"]}
|
||||
89
build/node_modules/prepack/lib/debugger/server/SteppingManager.js
generated
vendored
Normal file
89
build/node_modules/prepack/lib/debugger/server/SteppingManager.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.SteppingManager = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _babelTypes = require("babel-types");
|
||||
|
||||
var _invariant = require("./../common/invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _Stepper = require("./Stepper.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var SteppingManager = exports.SteppingManager = function () {
|
||||
function SteppingManager(realm, keepOldSteppers) {
|
||||
_classCallCheck(this, SteppingManager);
|
||||
|
||||
this._realm = realm;
|
||||
this._steppers = [];
|
||||
this._keepOldSteppers = false;
|
||||
if (keepOldSteppers) this._keepOldSteppers = true;
|
||||
}
|
||||
|
||||
_createClass(SteppingManager, [{
|
||||
key: "processStepCommand",
|
||||
value: function processStepCommand(kind, currentNode) {
|
||||
if (kind === "in") {
|
||||
this._processStepIn(currentNode);
|
||||
} else if (kind === "over") {
|
||||
this._processStepOver(currentNode);
|
||||
}
|
||||
// TODO: implement stepOver and stepOut
|
||||
}
|
||||
}, {
|
||||
key: "_processStepIn",
|
||||
value: function _processStepIn(ast) {
|
||||
(0, _invariant2.default)(this._stepInto === undefined);
|
||||
(0, _invariant2.default)(ast.loc && ast.loc.source);
|
||||
if (!this._keepOldSteppers) {
|
||||
this._steppers = [];
|
||||
}
|
||||
this._steppers.push(new _Stepper.StepIntoStepper(ast.loc.source, ast.loc.start.line, ast.loc.start.column));
|
||||
}
|
||||
}, {
|
||||
key: "_processStepOver",
|
||||
value: function _processStepOver(ast) {
|
||||
(0, _invariant2.default)(ast.loc && ast.loc.source);
|
||||
if (!this._keepOldSteppers) {
|
||||
this._steppers = [];
|
||||
}
|
||||
this._steppers.push(new _Stepper.StepOverStepper(ast.loc.source, ast.loc.start.line, ast.loc.start.column, this._realm.contextStack.length));
|
||||
}
|
||||
}, {
|
||||
key: "getAndDeleteCompletedSteppers",
|
||||
value: function getAndDeleteCompletedSteppers(ast) {
|
||||
(0, _invariant2.default)(ast.loc && ast.loc.source);
|
||||
var i = 0;
|
||||
var completedSteppers = [];
|
||||
while (i < this._steppers.length) {
|
||||
var stepper = this._steppers[i];
|
||||
if (stepper.isComplete(ast, this._realm.contextStack.length)) {
|
||||
completedSteppers.push(stepper);
|
||||
this._steppers.splice(i, 1);
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return completedSteppers;
|
||||
}
|
||||
}]);
|
||||
|
||||
return SteppingManager;
|
||||
}();
|
||||
//# sourceMappingURL=SteppingManager.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/server/SteppingManager.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/server/SteppingManager.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/debugger/server/SteppingManager.js"],"names":["SteppingManager","realm","keepOldSteppers","_realm","_steppers","_keepOldSteppers","kind","currentNode","_processStepIn","_processStepOver","ast","_stepInto","undefined","loc","source","push","start","line","column","contextStack","length","i","completedSteppers","stepper","isComplete","splice"],"mappings":";;;;;;;qjBAAA;;;;;;;;;AAWA;;AACA;;;;AACA;;;;;;IAIaA,e,WAAAA,e;AACX,2BAAYC,KAAZ,EAA0BC,eAA1B,EAAqD;AAAA;;AACnD,SAAKC,MAAL,GAAcF,KAAd;AACA,SAAKG,SAAL,GAAiB,EAAjB;AACA,SAAKC,gBAAL,GAAwB,KAAxB;AACA,QAAIH,eAAJ,EAAqB,KAAKG,gBAAL,GAAwB,IAAxB;AACtB;;;;uCAKkBC,I,EAA6BC,W,EAAwB;AACtE,UAAID,SAAS,IAAb,EAAmB;AACjB,aAAKE,cAAL,CAAoBD,WAApB;AACD,OAFD,MAEO,IAAID,SAAS,MAAb,EAAqB;AAC1B,aAAKG,gBAAL,CAAsBF,WAAtB;AACD;AACD;AACD;;;mCAEcG,G,EAAgB;AAC7B,+BAAU,KAAKC,SAAL,KAAmBC,SAA7B;AACA,+BAAUF,IAAIG,GAAJ,IAAWH,IAAIG,GAAJ,CAAQC,MAA7B;AACA,UAAI,CAAC,KAAKT,gBAAV,EAA4B;AAC1B,aAAKD,SAAL,GAAiB,EAAjB;AACD;AACD,WAAKA,SAAL,CAAeW,IAAf,CAAoB,6BAAoBL,IAAIG,GAAJ,CAAQC,MAA5B,EAAoCJ,IAAIG,GAAJ,CAAQG,KAAR,CAAcC,IAAlD,EAAwDP,IAAIG,GAAJ,CAAQG,KAAR,CAAcE,MAAtE,CAApB;AACD;;;qCAEgBR,G,EAAgB;AAC/B,+BAAUA,IAAIG,GAAJ,IAAWH,IAAIG,GAAJ,CAAQC,MAA7B;AACA,UAAI,CAAC,KAAKT,gBAAV,EAA4B;AAC1B,aAAKD,SAAL,GAAiB,EAAjB;AACD;AACD,WAAKA,SAAL,CAAeW,IAAf,CACE,6BAAoBL,IAAIG,GAAJ,CAAQC,MAA5B,EAAoCJ,IAAIG,GAAJ,CAAQG,KAAR,CAAcC,IAAlD,EAAwDP,IAAIG,GAAJ,CAAQG,KAAR,CAAcE,MAAtE,EAA8E,KAAKf,MAAL,CAAYgB,YAAZ,CAAyBC,MAAvG,CADF;AAGD;;;kDAE6BV,G,EAAwC;AACpE,+BAAUA,IAAIG,GAAJ,IAAWH,IAAIG,GAAJ,CAAQC,MAA7B;AACA,UAAIO,IAAI,CAAR;AACA,UAAIC,oBAA4C,EAAhD;AACA,aAAOD,IAAI,KAAKjB,SAAL,CAAegB,MAA1B,EAAkC;AAChC,YAAIG,UAAU,KAAKnB,SAAL,CAAeiB,CAAf,CAAd;AACA,YAAIE,QAAQC,UAAR,CAAmBd,GAAnB,EAAwB,KAAKP,MAAL,CAAYgB,YAAZ,CAAyBC,MAAjD,CAAJ,EAA8D;AAC5DE,4BAAkBP,IAAlB,CAAuBQ,OAAvB;AACA,eAAKnB,SAAL,CAAeqB,MAAf,CAAsBJ,CAAtB,EAAyB,CAAzB;AACD,SAHD,MAGO;AACLA;AACD;AACF;AACD,aAAOC,iBAAP;AACD","file":"SteppingManager.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport { BabelNode } from \"babel-types\";\nimport invariant from \"./../common/invariant.js\";\nimport { Stepper, StepIntoStepper, StepOverStepper } from \"./Stepper.js\";\nimport type { Realm } from \"./../../realm.js\";\nimport type { StoppableObject } from \"./StopEventManager.js\";\n\nexport class SteppingManager {\n constructor(realm: Realm, keepOldSteppers?: boolean) {\n this._realm = realm;\n this._steppers = [];\n this._keepOldSteppers = false;\n if (keepOldSteppers) this._keepOldSteppers = true;\n }\n _realm: Realm;\n _keepOldSteppers: boolean;\n _steppers: Array<Stepper>;\n\n processStepCommand(kind: \"in\" | \"over\" | \"out\", currentNode: BabelNode) {\n if (kind === \"in\") {\n this._processStepIn(currentNode);\n } else if (kind === \"over\") {\n this._processStepOver(currentNode);\n }\n // TODO: implement stepOver and stepOut\n }\n\n _processStepIn(ast: BabelNode) {\n invariant(this._stepInto === undefined);\n invariant(ast.loc && ast.loc.source);\n if (!this._keepOldSteppers) {\n this._steppers = [];\n }\n this._steppers.push(new StepIntoStepper(ast.loc.source, ast.loc.start.line, ast.loc.start.column));\n }\n\n _processStepOver(ast: BabelNode) {\n invariant(ast.loc && ast.loc.source);\n if (!this._keepOldSteppers) {\n this._steppers = [];\n }\n this._steppers.push(\n new StepOverStepper(ast.loc.source, ast.loc.start.line, ast.loc.start.column, this._realm.contextStack.length)\n );\n }\n\n getAndDeleteCompletedSteppers(ast: BabelNode): Array<StoppableObject> {\n invariant(ast.loc && ast.loc.source);\n let i = 0;\n let completedSteppers: Array<StoppableObject> = [];\n while (i < this._steppers.length) {\n let stepper = this._steppers[i];\n if (stepper.isComplete(ast, this._realm.contextStack.length)) {\n completedSteppers.push(stepper);\n this._steppers.splice(i, 1);\n } else {\n i++;\n }\n }\n return completedSteppers;\n }\n}\n"]}
|
||||
65
build/node_modules/prepack/lib/debugger/server/StopEventManager.js
generated
vendored
Normal file
65
build/node_modules/prepack/lib/debugger/server/StopEventManager.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.StopEventManager = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _invariant = require("./../common/invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _Breakpoint = require("./Breakpoint.js");
|
||||
|
||||
var _Stepper = require("./Stepper.js");
|
||||
|
||||
var _babelTypes = require("babel-types");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
// Manage whether the debuggee should stop
|
||||
// All stopping related logic is centralized here
|
||||
|
||||
var StopEventManager = exports.StopEventManager = function () {
|
||||
function StopEventManager() {
|
||||
_classCallCheck(this, StopEventManager);
|
||||
}
|
||||
|
||||
_createClass(StopEventManager, [{
|
||||
key: "getDebuggeeStopReason",
|
||||
|
||||
// stoppables is a list of objects the debuggee should be stopped on
|
||||
// (e.g. breakpoint, completed steppers). The debuggee should stop if there
|
||||
// is at least one element in the list. Currently the reason of the first element
|
||||
// is chosen as the reason sent to the UI
|
||||
value: function getDebuggeeStopReason(ast, stoppables) {
|
||||
if (stoppables.length === 0) return;
|
||||
var stoppable = stoppables[0];
|
||||
var stoppedReason = void 0;
|
||||
if (stoppable instanceof _Breakpoint.Breakpoint) {
|
||||
stoppedReason = "Breakpoint";
|
||||
} else if (stoppable instanceof _Stepper.StepIntoStepper) {
|
||||
stoppedReason = "Step Into";
|
||||
} else if (stoppable instanceof _Stepper.StepOverStepper) {
|
||||
stoppedReason = "Step Over";
|
||||
} else {
|
||||
(0, _invariant2.default)(false, "Invalid stoppable object");
|
||||
}
|
||||
return stoppedReason;
|
||||
}
|
||||
}]);
|
||||
|
||||
return StopEventManager;
|
||||
}();
|
||||
//# sourceMappingURL=StopEventManager.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/server/StopEventManager.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/server/StopEventManager.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/debugger/server/StopEventManager.js"],"names":["StopEventManager","ast","stoppables","length","stoppable","stoppedReason"],"mappings":";;;;;;;qjBAAA;;;;;;;;;AAWA;;;;AACA;;AACA;;AACA;;;;;;AAKA;AACA;;IAEaA,gB,WAAAA,gB;;;;;;;;AACX;AACA;AACA;AACA;0CACsBC,G,EAAgBC,U,EAA0D;AAC9F,UAAIA,WAAWC,MAAX,KAAsB,CAA1B,EAA6B;AAC7B,UAAIC,YAAYF,WAAW,CAAX,CAAhB;AACA,UAAIG,sBAAJ;AACA,UAAID,2CAAJ,EAAqC;AACnCC,wBAAgB,YAAhB;AACD,OAFD,MAEO,IAAID,6CAAJ,EAA0C;AAC/CC,wBAAgB,WAAhB;AACD,OAFM,MAEA,IAAID,6CAAJ,EAA0C;AAC/CC,wBAAgB,WAAhB;AACD,OAFM,MAEA;AACL,iCAAU,KAAV,EAAiB,0BAAjB;AACD;AACD,aAAOA,aAAP;AACD","file":"StopEventManager.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport invariant from \"./../common/invariant.js\";\nimport { Breakpoint } from \"./Breakpoint.js\";\nimport { Stepper, StepIntoStepper, StepOverStepper } from \"./Stepper.js\";\nimport { BabelNode } from \"babel-types\";\nimport type { StoppedReason } from \"./../common/types.js\";\n\nexport type StoppableObject = Breakpoint | Stepper;\n\n// Manage whether the debuggee should stop\n// All stopping related logic is centralized here\n\nexport class StopEventManager {\n // stoppables is a list of objects the debuggee should be stopped on\n // (e.g. breakpoint, completed steppers). The debuggee should stop if there\n // is at least one element in the list. Currently the reason of the first element\n // is chosen as the reason sent to the UI\n getDebuggeeStopReason(ast: BabelNode, stoppables: Array<StoppableObject>): void | StoppedReason {\n if (stoppables.length === 0) return;\n let stoppable = stoppables[0];\n let stoppedReason;\n if (stoppable instanceof Breakpoint) {\n stoppedReason = \"Breakpoint\";\n } else if (stoppable instanceof StepIntoStepper) {\n stoppedReason = \"Step Into\";\n } else if (stoppable instanceof StepOverStepper) {\n stoppedReason = \"Step Over\";\n } else {\n invariant(false, \"Invalid stoppable object\");\n }\n return stoppedReason;\n }\n}\n"]}
|
||||
304
build/node_modules/prepack/lib/debugger/server/VariableManager.js
generated
vendored
Normal file
304
build/node_modules/prepack/lib/debugger/server/VariableManager.js
generated
vendored
Normal file
@@ -0,0 +1,304 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.VariableManager = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _ReferenceMap = require("./ReferenceMap.js");
|
||||
|
||||
var _environment = require("./../../environment.js");
|
||||
|
||||
var _index = require("./../../values/index.js");
|
||||
|
||||
var _invariant = require("./../common/invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _is = require("./../../methods/is.js");
|
||||
|
||||
var _DebuggerError = require("./../common/DebuggerError.js");
|
||||
|
||||
var _singletons = require("./../../singletons.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
// This class manages the handling of variable requests in the debugger
|
||||
// The DebugProtocol specifies collections of variables are to be fetched using a
|
||||
// unique reference ID called a variablesReference. This class can generate new
|
||||
// variablesReferences to pass to the UI and then perform lookups for those
|
||||
// variablesReferences when they are requested.
|
||||
var VariableManager = exports.VariableManager = function () {
|
||||
function VariableManager(realm) {
|
||||
_classCallCheck(this, VariableManager);
|
||||
|
||||
this._containerCache = new Map();
|
||||
this._referenceMap = new _ReferenceMap.ReferenceMap();
|
||||
this._realm = realm;
|
||||
}
|
||||
// cache for created references
|
||||
|
||||
// map for looking up references
|
||||
|
||||
|
||||
_createClass(VariableManager, [{
|
||||
key: "getReferenceForValue",
|
||||
|
||||
|
||||
// Given a container, either returns a cached reference for that container if
|
||||
// it exists or return a new reference
|
||||
value: function getReferenceForValue(value) {
|
||||
var cachedRef = this._containerCache.get(value);
|
||||
if (cachedRef !== undefined) {
|
||||
return cachedRef;
|
||||
}
|
||||
|
||||
var varRef = this._referenceMap.add(value);
|
||||
this._containerCache.set(value, varRef);
|
||||
return varRef;
|
||||
}
|
||||
|
||||
// The entry point for retrieving a collection of variables by a reference
|
||||
|
||||
}, {
|
||||
key: "getVariablesByReference",
|
||||
value: function getVariablesByReference(reference) {
|
||||
var container = this._referenceMap.get(reference);
|
||||
if (!container) return [];
|
||||
if (container instanceof _environment.LexicalEnvironment) {
|
||||
return this._getVariablesFromEnvRecord(container.environmentRecord);
|
||||
} else if (container instanceof _index.ObjectValue) {
|
||||
return this._getVariablesFromObject(container);
|
||||
} else if (container instanceof _index.AbstractValue) {
|
||||
return this._getAbstractValueContent(container);
|
||||
} else {
|
||||
(0, _invariant2.default)(false, "Invalid variable container");
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_getVariablesFromObject",
|
||||
value: function _getVariablesFromObject(object) {
|
||||
var variables = [];
|
||||
var names = object.properties.keys();
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = names[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var name = _step.value;
|
||||
|
||||
var binding = object.properties.get(name);
|
||||
(0, _invariant2.default)(binding !== undefined);
|
||||
if (binding.descriptor) {
|
||||
if ((0, _is.IsDataDescriptor)(this._realm, binding.descriptor)) {
|
||||
var value = binding.descriptor.value;
|
||||
if (value instanceof _index.Value) {
|
||||
var variable = this._getVariableFromValue(name, value);
|
||||
variables.push(variable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return variables;
|
||||
}
|
||||
}, {
|
||||
key: "_getAbstractValueContent",
|
||||
value: function _getAbstractValueContent(value) {
|
||||
var kindVar = {
|
||||
name: "kind",
|
||||
value: value.kind || "undefined",
|
||||
variablesReference: 0
|
||||
};
|
||||
var contents = [kindVar];
|
||||
var argCount = 1;
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator2 = value.args[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
||||
var arg = _step2.value;
|
||||
|
||||
contents.push(this._getVariableFromValue("arg-" + argCount, arg));
|
||||
argCount++;
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return contents;
|
||||
}
|
||||
}, {
|
||||
key: "_getVariablesFromEnvRecord",
|
||||
value: function _getVariablesFromEnvRecord(envRecord) {
|
||||
if (envRecord instanceof _environment.DeclarativeEnvironmentRecord) {
|
||||
return this._getVariablesFromDeclarativeEnv(envRecord);
|
||||
} else if (envRecord instanceof _environment.ObjectEnvironmentRecord) {
|
||||
if (envRecord.object instanceof _index.ObjectValue) {
|
||||
return this._getVariablesFromObject(envRecord.object);
|
||||
} else if (envRecord.object instanceof _index.AbstractObjectValue) {
|
||||
// TODO: call _getVariablesFromAbstractObject when it is implemented
|
||||
return [];
|
||||
} else {
|
||||
(0, _invariant2.default)(false, "Invalid type of object environment record");
|
||||
}
|
||||
} else if (envRecord instanceof _environment.GlobalEnvironmentRecord) {
|
||||
var declVars = this._getVariablesFromEnvRecord(envRecord.$DeclarativeRecord);
|
||||
var objVars = this._getVariablesFromEnvRecord(envRecord.$ObjectRecord);
|
||||
return declVars.concat(objVars);
|
||||
} else {
|
||||
(0, _invariant2.default)(false, "Invalid type of environment record");
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_getVariablesFromDeclarativeEnv",
|
||||
value: function _getVariablesFromDeclarativeEnv(env) {
|
||||
var variables = [];
|
||||
var bindings = env.bindings;
|
||||
for (var name in bindings) {
|
||||
var binding = bindings[name];
|
||||
if (binding.value) {
|
||||
var variable = this._getVariableFromValue(name, binding.value);
|
||||
variables.push(variable);
|
||||
}
|
||||
}
|
||||
return variables;
|
||||
}
|
||||
}, {
|
||||
key: "_getVariableFromValue",
|
||||
value: function _getVariableFromValue(name, value) {
|
||||
if (value instanceof _index.ConcreteValue) {
|
||||
return this._getVariableFromConcreteValue(name, value);
|
||||
} else if (value instanceof _index.AbstractValue) {
|
||||
return this._getVariableFromAbstractValue(name, value);
|
||||
} else {
|
||||
(0, _invariant2.default)(false, "Value is neither concrete nor abstract");
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "_getVariableFromAbstractValue",
|
||||
value: function _getVariableFromAbstractValue(name, value) {
|
||||
var variable = {
|
||||
name: name,
|
||||
value: this._getAbstractValueDisplay(value),
|
||||
variablesReference: this.getReferenceForValue(value)
|
||||
};
|
||||
return variable;
|
||||
}
|
||||
}, {
|
||||
key: "_getAbstractValueDisplay",
|
||||
value: function _getAbstractValueDisplay(value) {
|
||||
if (value.intrinsicName && !value.intrinsicName.startsWith("_")) {
|
||||
return value.intrinsicName;
|
||||
}
|
||||
return "Abstract " + value.types.getType().name;
|
||||
}
|
||||
}, {
|
||||
key: "_getVariableFromConcreteValue",
|
||||
value: function _getVariableFromConcreteValue(name, value) {
|
||||
if (value instanceof _index.PrimitiveValue) {
|
||||
var variable = {
|
||||
name: name,
|
||||
value: value.toDisplayString(),
|
||||
variablesReference: 0
|
||||
};
|
||||
return variable;
|
||||
} else if (value instanceof _index.ObjectValue) {
|
||||
var _variable = {
|
||||
name: name,
|
||||
value: value.getKind(),
|
||||
variablesReference: this.getReferenceForValue(value)
|
||||
};
|
||||
return _variable;
|
||||
} else {
|
||||
(0, _invariant2.default)(false, "Concrete value must be primitive or object");
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "evaluate",
|
||||
value: function evaluate(frameId, expression) {
|
||||
var evalRealm = this._realm;
|
||||
var isDirect = false;
|
||||
var isStrict = false;
|
||||
if (frameId !== undefined) {
|
||||
if (frameId < 0 || frameId >= this._realm.contextStack.length) {
|
||||
throw new _DebuggerError.DebuggerError("Invalid command", "Invalid value for frame ID");
|
||||
}
|
||||
// frameId's are in reverse order of context stack
|
||||
var stackIndex = this._realm.contextStack.length - 1 - frameId;
|
||||
var context = this._realm.contextStack[stackIndex];
|
||||
isDirect = true;
|
||||
isStrict = true;
|
||||
evalRealm = context.realm;
|
||||
}
|
||||
|
||||
var evalString = new _index.StringValue(this._realm, expression);
|
||||
try {
|
||||
var value = _singletons.Functions.PerformEval(this._realm, evalString, evalRealm, isStrict, isDirect);
|
||||
var varInfo = this._getVariableFromValue(expression, value);
|
||||
var result = {
|
||||
kind: "evaluate",
|
||||
displayValue: varInfo.value,
|
||||
type: value.getType().name,
|
||||
variablesReference: varInfo.variablesReference
|
||||
};
|
||||
return result;
|
||||
} catch (e) {
|
||||
var _result = {
|
||||
kind: "evaluate",
|
||||
displayValue: "Failed to evaluate: " + expression,
|
||||
type: "unknown",
|
||||
variablesReference: 0
|
||||
};
|
||||
return _result;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "clean",
|
||||
value: function clean() {
|
||||
this._containerCache = new Map();
|
||||
this._referenceMap.clean();
|
||||
}
|
||||
}]);
|
||||
|
||||
return VariableManager;
|
||||
}();
|
||||
//# sourceMappingURL=VariableManager.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/server/VariableManager.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/server/VariableManager.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
127
build/node_modules/prepack/lib/debugger/server/channel/DebugChannel.js
generated
vendored
Normal file
127
build/node_modules/prepack/lib/debugger/server/channel/DebugChannel.js
generated
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.DebugChannel = undefined;
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
|
||||
* Copyright (c) 2017-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.
|
||||
*/
|
||||
|
||||
var _invariant = require("./../../common/invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _FileIOWrapper = require("./../../common/channel/FileIOWrapper.js");
|
||||
|
||||
var _DebugMessage = require("./../../common/channel/DebugMessage.js");
|
||||
|
||||
var _MessageMarshaller = require("./../../common/channel/MessageMarshaller.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
//Channel used by the DebugServer in Prepack to communicate with the debug adapter
|
||||
var DebugChannel = exports.DebugChannel = function () {
|
||||
function DebugChannel(ioWrapper) {
|
||||
_classCallCheck(this, DebugChannel);
|
||||
|
||||
this._requestReceived = false;
|
||||
this._ioWrapper = ioWrapper;
|
||||
this._marshaller = new _MessageMarshaller.MessageMarshaller();
|
||||
}
|
||||
|
||||
_createClass(DebugChannel, [{
|
||||
key: "debuggerIsAttached",
|
||||
|
||||
|
||||
/*
|
||||
/* Only called in the beginning to check if a debugger is attached
|
||||
*/
|
||||
value: function debuggerIsAttached() {
|
||||
var message = this._ioWrapper.readInSyncOnce();
|
||||
if (message === null) return false;
|
||||
var parts = message.split(" ");
|
||||
var requestID = parseInt(parts[0], 10);
|
||||
(0, _invariant2.default)(!isNaN(requestID), "Request ID must be a number");
|
||||
var command = parts[1];
|
||||
if (command === _DebugMessage.DebugMessage.DEBUGGER_ATTACHED) {
|
||||
this._requestReceived = true;
|
||||
this._ioWrapper.clearInFile();
|
||||
this.writeOut(requestID + " " + _DebugMessage.DebugMessage.PREPACK_READY_RESPONSE);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Reads in a request from the debug adapter
|
||||
/* The caller is responsible for sending a response with the appropriate
|
||||
/* contents at the right time.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "readIn",
|
||||
value: function readIn() {
|
||||
var message = this._ioWrapper.readInSync();
|
||||
this._requestReceived = true;
|
||||
return this._marshaller.unmarshallRequest(message);
|
||||
}
|
||||
|
||||
// Write out a response to the debug adapter
|
||||
|
||||
}, {
|
||||
key: "writeOut",
|
||||
value: function writeOut(contents) {
|
||||
//Prepack only writes back to the debug adapter in response to a request
|
||||
(0, _invariant2.default)(this._requestReceived, "Prepack writing message without being requested: " + contents);
|
||||
this._ioWrapper.writeOutSync(contents);
|
||||
this._requestReceived = false;
|
||||
}
|
||||
}, {
|
||||
key: "sendBreakpointsAcknowledge",
|
||||
value: function sendBreakpointsAcknowledge(messageType, requestID, args) {
|
||||
this.writeOut(this._marshaller.marshallBreakpointAcknowledge(requestID, messageType, args.breakpoints));
|
||||
}
|
||||
}, {
|
||||
key: "sendStoppedResponse",
|
||||
value: function sendStoppedResponse(reason, filePath, line, column) {
|
||||
this.writeOut(this._marshaller.marshallStoppedResponse(reason, filePath, line, column));
|
||||
}
|
||||
}, {
|
||||
key: "sendStackframeResponse",
|
||||
value: function sendStackframeResponse(requestID, stackframes) {
|
||||
this.writeOut(this._marshaller.marshallStackFramesResponse(requestID, stackframes));
|
||||
}
|
||||
}, {
|
||||
key: "sendScopesResponse",
|
||||
value: function sendScopesResponse(requestID, scopes) {
|
||||
this.writeOut(this._marshaller.marshallScopesResponse(requestID, scopes));
|
||||
}
|
||||
}, {
|
||||
key: "sendVariablesResponse",
|
||||
value: function sendVariablesResponse(requestID, variables) {
|
||||
this.writeOut(this._marshaller.marshallVariablesResponse(requestID, variables));
|
||||
}
|
||||
}, {
|
||||
key: "sendEvaluateResponse",
|
||||
value: function sendEvaluateResponse(requestID, evalResult) {
|
||||
this.writeOut(this._marshaller.marshallEvaluateResponse(requestID, evalResult));
|
||||
}
|
||||
}, {
|
||||
key: "shutdown",
|
||||
value: function shutdown() {
|
||||
this._ioWrapper.clearInFile();
|
||||
this._ioWrapper.clearOutFile();
|
||||
}
|
||||
}]);
|
||||
|
||||
return DebugChannel;
|
||||
}();
|
||||
//# sourceMappingURL=DebugChannel.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/server/channel/DebugChannel.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/server/channel/DebugChannel.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
10
build/node_modules/prepack/lib/debugger/types.js
generated
vendored
Normal file
10
build/node_modules/prepack/lib/debugger/types.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
var _vscodeDebugprotocol = require("vscode-debugprotocol");
|
||||
|
||||
var DebugProtocol = _interopRequireWildcard(_vscodeDebugprotocol);
|
||||
|
||||
var _index = require("./../values/index.js");
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
build/node_modules/prepack/lib/debugger/types.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/debugger/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/debugger/types.js"],"names":["DebugProtocol"],"mappings":";;AAYA;;IAAYA,a;;AACZ","file":"types.js","sourcesContent":["/**\n * Copyright (c) 2017-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\n/* @flow */\n\nimport type { LexicalEnvironment } from \"./../environment.js\";\nimport * as DebugProtocol from \"vscode-debugprotocol\";\nimport { ObjectValue } from \"./../values/index.js\";\n\nexport type DebuggerRequest = {\n id: number,\n command: string,\n arguments: DebuggerRequestArguments,\n};\n\nexport type DebuggerRequestArguments =\n | BreakpointsArguments\n | RunArguments\n | StackframeArguments\n | ScopesArguments\n | VariablesArguments;\n\nexport type PrepackLaunchArguments = {\n kind: \"launch\",\n prepackRuntime: string,\n prepackArguments: Array<string>,\n sourceFile: string,\n debugInFilePath: string,\n debugOutFilePath: string,\n outputCallback: Buffer => void,\n exitCallback: () => void,\n};\n\nexport type Breakpoint = {\n filePath: string,\n line: number,\n column: number,\n};\n\nexport type BreakpointsArguments = {\n kind: \"breakpoint\",\n breakpoints: Array<Breakpoint>,\n};\n\nexport type RunArguments = {\n kind: \"run\",\n};\n\nexport type StackframeArguments = {\n kind: \"stackframe\",\n};\n\nexport type Stackframe = {\n id: number,\n fileName: string,\n line: number,\n column: number,\n functionName: string,\n};\n\nexport type ScopesArguments = {\n kind: \"scopes\",\n frameId: number,\n};\n\nexport type VariablesArguments = {\n kind: \"variables\",\n variablesReference: number,\n};\n\nexport type DebuggerResponse = {\n id: number,\n result: DebuggerResponseResult,\n};\n\nexport type DebuggerResponseResult =\n | ReadyResult\n | StackframeResult\n | BreakpointsAddResult\n | BreakpointStoppedResult\n | ScopesResult\n | VariablesResult\n | FinishResult;\n\nexport type ReadyResult = {\n kind: \"ready\",\n};\n\nexport type StackframeResult = {\n kind: \"stackframe\",\n stackframes: Array<Stackframe>,\n};\n\nexport type BreakpointsAddResult = {\n kind: \"breakpoint-add\",\n breakpoints: Array<Breakpoint>,\n};\n\nexport type BreakpointStoppedResult = {\n kind: \"breakpoint-stopped\",\n filePath: string,\n line: number,\n column: number,\n};\nexport type Scope = {\n name: string,\n variablesReference: number,\n expensive: boolean,\n};\n\nexport type ScopesResult = {\n kind: \"scopes\",\n scopes: Array<Scope>,\n};\n\nexport type Variable = {\n name: string,\n value: string,\n variablesReference: number,\n};\n\nexport type VariablesResult = {\n kind: \"variables\",\n variables: Array<Variable>,\n};\n\nexport type FinishResult = {\n kind: \"finish\",\n};\n\n// any object that can contain a collection of variables\nexport type VariableContainer = LexicalEnvironment | ObjectValue;\nexport interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArguments {\n noDebug?: boolean,\n sourceFile: string,\n prepackRuntime: string,\n prepackArguments: Array<string>,\n debugInFilePath: string,\n debugOutFilePath: string,\n}\n"]}
|
||||
Reference in New Issue
Block a user