first commit
This commit is contained in:
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"]}
|
||||
Reference in New Issue
Block a user