first commit

This commit is contained in:
s.golasch
2023-08-01 13:49:46 +02:00
commit 1fc239fd54
20238 changed files with 3112246 additions and 0 deletions

View 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

File diff suppressed because one or more lines are too long