first commit
This commit is contained in:
288
build/node_modules/prepack/lib/benchmarker.js
generated
vendored
Normal file
288
build/node_modules/prepack/lib/benchmarker.js
generated
vendored
Normal file
@@ -0,0 +1,288 @@
|
||||
"use strict";
|
||||
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /**
|
||||
* 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 _index = require("./serializer/index.js");
|
||||
|
||||
var _index2 = _interopRequireDefault(_index);
|
||||
|
||||
var _construct_realm = require("./construct_realm.js");
|
||||
|
||||
var _construct_realm2 = _interopRequireDefault(_construct_realm);
|
||||
|
||||
var _globals = require("./globals.js");
|
||||
|
||||
var _globals2 = _interopRequireDefault(_globals);
|
||||
|
||||
var _invariant = require("./invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var chalk = require("chalk");
|
||||
var jsdom = require("jsdom");
|
||||
var zlib = require("zlib");
|
||||
var fs = require("fs");
|
||||
var vm = require("vm");
|
||||
|
||||
function getTime() {
|
||||
var stamp = process.hrtime();
|
||||
return (stamp[0] * 1e9 + stamp[1]) / 1e6;
|
||||
}
|
||||
|
||||
function exec(code, compatibility) {
|
||||
var sandbox = {
|
||||
setTimeout: setTimeout,
|
||||
setInterval: setInterval,
|
||||
console: {
|
||||
error: function error() {},
|
||||
log: function log(s) {
|
||||
console.log(s);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var beforeCode = "var global = this; ";
|
||||
var afterCode = "// At the end of the script, Node tries to clone the 'this' Object (global) which involves executing all getters on it.\n// To avoid executing any more code (which could affect timing), we just set all globals to undefined (hoping that doesn't take too long).\nObject.getOwnPropertyNames(global).forEach(function(name){ if (name !== \"Object\" && name !== \"global\") global[name] = undefined; });";
|
||||
|
||||
if (compatibility === "browser") {
|
||||
beforeCode += "var window = this; var self = this; ";
|
||||
var window = jsdom.jsdom({}).defaultView;
|
||||
sandbox.window = window;
|
||||
sandbox.document = window.document;
|
||||
sandbox.navigator = window.navigator;
|
||||
sandbox.location = window.location;
|
||||
}
|
||||
if (compatibility === "jsc-600-1-4-17") {
|
||||
beforeCode += "delete global.clearInterval; delete global.clearImmediate; delete global.clearTimeout; delete global.setImmediate; delete Object.assign;";
|
||||
}
|
||||
|
||||
code = beforeCode + " " + code + "; // keep newline here as code may end with comment\n" + afterCode;
|
||||
|
||||
var start = getTime();
|
||||
var script = new vm.Script(code, { cachedDataProduced: false });
|
||||
var executedStart = getTime();
|
||||
script.runInNewContext(sandbox);
|
||||
var executedEnd = getTime();
|
||||
|
||||
return {
|
||||
raw: code.length,
|
||||
gzip: zlib.gzipSync(code).length,
|
||||
executed: executedEnd - executedStart,
|
||||
compiled: executedStart - start,
|
||||
total: executedEnd - start
|
||||
};
|
||||
}
|
||||
|
||||
function line(type, code, compatibility) {
|
||||
var moreOut = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
||||
var compareStats = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : undefined;
|
||||
|
||||
var stats = exec(code, compatibility);
|
||||
|
||||
function wrapTime(key) {
|
||||
return wrap(key, function (ms) {
|
||||
return ms.toFixed(2) + "ms";
|
||||
}, "faster", "slower");
|
||||
}
|
||||
|
||||
function wrapSize(key) {
|
||||
return wrap(key, function (b) {
|
||||
var kilobytes = Math.round(b / 1000);
|
||||
if (kilobytes > 1000) {
|
||||
return (kilobytes / 1000).toFixed(2) + "MB";
|
||||
} else {
|
||||
return kilobytes + "KB";
|
||||
}
|
||||
}, "smaller", "bigger");
|
||||
}
|
||||
|
||||
function wrap(key, format, positive, negative) {
|
||||
if (compareStats) {
|
||||
var before = compareStats[key];
|
||||
var after = stats[key];
|
||||
var factor = void 0;
|
||||
|
||||
if (after < before) {
|
||||
factor = chalk.green((before / after).toFixed(2) + "x " + positive);
|
||||
} else {
|
||||
factor = chalk.red((after / before).toFixed(2) + "x " + negative);
|
||||
}
|
||||
|
||||
return format(after) + " " + factor;
|
||||
} else {
|
||||
return format(stats[key]);
|
||||
}
|
||||
}
|
||||
|
||||
var out = _extends({
|
||||
"VM Total Time": wrapTime("total"),
|
||||
"VM Compile Time": wrapTime("compiled"),
|
||||
"VM Execution Time": wrapTime("executed"),
|
||||
"Raw Code Size": wrapSize("raw"),
|
||||
"Gzip Code Size": wrapSize("gzip")
|
||||
}, moreOut);
|
||||
|
||||
console.log(chalk.bold(type));
|
||||
|
||||
for (var key in out) {
|
||||
console.log(" " + chalk.bold(key) + " " + out[key]);
|
||||
}
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
||||
function dump(name, raw) {
|
||||
var min = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : raw;
|
||||
var compatibility = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "browser";
|
||||
var outputFilename = arguments[4];
|
||||
|
||||
console.log(chalk.inverse(name));
|
||||
var beforeStats = line("Before", min, compatibility);
|
||||
|
||||
var start = Date.now();
|
||||
var realm = (0, _construct_realm2.default)({ serialize: true, compatibility: compatibility });
|
||||
(0, _globals2.default)(realm);
|
||||
var serializer = new _index2.default(realm);
|
||||
var sources = [{ filePath: name, fileContents: raw }];
|
||||
var serialized = serializer.init(sources);
|
||||
if (!serialized) {
|
||||
process.exit(1);
|
||||
(0, _invariant2.default)(false);
|
||||
}
|
||||
var code = serialized.code;
|
||||
var total = Date.now() - start;
|
||||
|
||||
if (code.length >= 1000 || outputFilename) {
|
||||
var filename = outputFilename || name + "-processed.js";
|
||||
console.log("Prepacked source code written to " + filename + ".");
|
||||
fs.writeFileSync(filename, code);
|
||||
}
|
||||
|
||||
line("After", code, compatibility, {
|
||||
"Prepack Compile Time": total + "ms"
|
||||
}, beforeStats);
|
||||
|
||||
if (code.length <= 1000 && !outputFilename) {
|
||||
console.log("+++++++++++++++++ Prepacked source code");
|
||||
console.log(code);
|
||||
console.log("=================");
|
||||
}
|
||||
}
|
||||
|
||||
var args = Array.from(process.argv);
|
||||
args.splice(0, 2);
|
||||
var inputFilename = void 0;
|
||||
var outputFilename = void 0;
|
||||
var compatibility = void 0;
|
||||
while (args.length) {
|
||||
var arg = args[0];
|
||||
args.shift();
|
||||
if (arg === "--out") {
|
||||
arg = args[0];
|
||||
args.shift();
|
||||
outputFilename = arg;
|
||||
} else if (arg === "--compatibility") {
|
||||
arg = args[0];
|
||||
args.shift();
|
||||
if (arg !== "jsc-600-1-4-17") {
|
||||
console.error("Unsupported compatibility: " + arg);
|
||||
process.exit(1);
|
||||
} else {
|
||||
compatibility = arg;
|
||||
}
|
||||
} else if (arg === "--help") {
|
||||
console.log("Usage: benchmarker.js [ --out output.js ] [ --compatibility jsc ] [ -- | input.js ]");
|
||||
} else if (!arg.startsWith("--")) {
|
||||
inputFilename = arg;
|
||||
} else {
|
||||
console.error("Unknown option: " + arg);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!inputFilename) {
|
||||
console.error("Missing input file.");
|
||||
process.exit(1);
|
||||
} else {
|
||||
var input = fs.readFileSync(inputFilename, "utf8");
|
||||
dump(inputFilename, input, input, compatibility, outputFilename);
|
||||
}
|
||||
|
||||
//dump("helloWorld", "function hello() { return 'hello'; } function world() { return 'world'; } s = hello() + ' ' + world();");
|
||||
|
||||
//dump("regex", "regex = /Facebook/i;");
|
||||
|
||||
//dump("test", "try { new WeakSet().delete.call(0, {}); } catch (e) {console.log(e);}");
|
||||
//dump("test", "e = 'abcdef'.substr(1,2); ");
|
||||
//dump("test", "var s = 'Promise'; e = s[0];");
|
||||
//dump("test", "foo = function() { return [,0]; };");
|
||||
|
||||
//dump("simple", "var foo = 5 * 5; var bar = [2, 3, 'yes']; var foo2 = null; var bar2 = undefined;");
|
||||
//dump("simple2", "function Foo() {} Foo.prototype.wow = function () {};");
|
||||
|
||||
//dump("Date.now", "Date.now");
|
||||
//dump("Date.now", "this.foo = Date.now();");
|
||||
//dump("object recursion", "var obj = { yes: 'no' }; obj.bar = obj; var foo = [obj]; obj.foobar = foo;");
|
||||
//dump("intrinsic union", "var assign = Object.assign || function () {}; var obj = assign({ foo: 1 }, { bar: 2 });");
|
||||
|
||||
/*dump(
|
||||
"fbsdk",
|
||||
fs.readFileSync(__dirname + "/../assets/fbsdk.js", "utf8")
|
||||
);*/
|
||||
|
||||
/*dump(
|
||||
"react",
|
||||
fs.readFileSync(__dirname + "/../assets/react.js", "utf8"),
|
||||
fs.readFileSync(__dirname + "/../assets/react.min.js", "utf8")
|
||||
);*/
|
||||
|
||||
/*dump(
|
||||
"immutable",
|
||||
fs.readFileSync(__dirname + "/../assets/immutable.js", "utf8"),
|
||||
fs.readFileSync(__dirname + "/../assets/immutable.min.js", "utf8")
|
||||
);*/
|
||||
|
||||
/*dump(
|
||||
"react-native-bundle",
|
||||
fs.readFileSync(__dirname + "/../../examples/react-native-bundle/bundle.js", "utf8")
|
||||
);*/
|
||||
|
||||
/*dump(
|
||||
"lodash",
|
||||
fs.readFileSync(require.resolve("lodash/lodash.js"), "utf8"),
|
||||
fs.readFileSync(require.resolve("lodash/lodash.min.js"), "utf8")
|
||||
);*/
|
||||
|
||||
/*dump(
|
||||
"underscore",
|
||||
fs.readFileSync(require.resolve("underscore"), "utf8"),
|
||||
fs.readFileSync(require.resolve("underscore/underscore-min"), "utf8")
|
||||
);
|
||||
*/
|
||||
|
||||
/*dump(
|
||||
"ember",
|
||||
fs.readFileSync("ember.prod.js", "utf8")
|
||||
);
|
||||
|
||||
dump(
|
||||
"jquery",
|
||||
fs.readFileSync(require.resolve("jquery/dist/jquery.js"), "utf8"),
|
||||
fs.readFileSync(require.resolve("jquery/dist/jquery.min.js"), "utf8")
|
||||
);
|
||||
|
||||
dump(
|
||||
"scrollin",
|
||||
fs.readFileSync("scrollin.js", "utf8")
|
||||
);
|
||||
*/
|
||||
//# sourceMappingURL=benchmarker.js.map
|
||||
1
build/node_modules/prepack/lib/benchmarker.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/benchmarker.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
204
build/node_modules/prepack/lib/completions.js
generated
vendored
Normal file
204
build/node_modules/prepack/lib/completions.js
generated
vendored
Normal file
@@ -0,0 +1,204 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.PossiblyNormalCompletion = exports.JoinedAbruptCompletions = exports.ReturnCompletion = exports.BreakCompletion = exports.ContinueCompletion = exports.ThrowCompletion = exports.AbruptCompletion = exports.NormalCompletion = exports.Completion = 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; }; }();
|
||||
|
||||
var _invariant = require("./invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _index = require("./values/index.js");
|
||||
|
||||
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"); } } /**
|
||||
* 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 Completion = exports.Completion = function Completion(value, location, target) {
|
||||
_classCallCheck(this, Completion);
|
||||
|
||||
this.value = value;
|
||||
this.target = target;
|
||||
this.location = location;
|
||||
};
|
||||
|
||||
// Normal completions are returned just like spec completions
|
||||
|
||||
|
||||
var NormalCompletion = exports.NormalCompletion = function (_Completion) {
|
||||
_inherits(NormalCompletion, _Completion);
|
||||
|
||||
function NormalCompletion() {
|
||||
_classCallCheck(this, NormalCompletion);
|
||||
|
||||
return _possibleConstructorReturn(this, (NormalCompletion.__proto__ || Object.getPrototypeOf(NormalCompletion)).apply(this, arguments));
|
||||
}
|
||||
|
||||
return NormalCompletion;
|
||||
}(Completion);
|
||||
|
||||
// Abrupt completions are thrown as exeptions, to make it a easier
|
||||
// to quickly get to the matching high level construct.
|
||||
|
||||
|
||||
var AbruptCompletion = exports.AbruptCompletion = function (_Completion2) {
|
||||
_inherits(AbruptCompletion, _Completion2);
|
||||
|
||||
function AbruptCompletion() {
|
||||
_classCallCheck(this, AbruptCompletion);
|
||||
|
||||
return _possibleConstructorReturn(this, (AbruptCompletion.__proto__ || Object.getPrototypeOf(AbruptCompletion)).apply(this, arguments));
|
||||
}
|
||||
|
||||
return AbruptCompletion;
|
||||
}(Completion);
|
||||
|
||||
var ThrowCompletion = exports.ThrowCompletion = function (_AbruptCompletion) {
|
||||
_inherits(ThrowCompletion, _AbruptCompletion);
|
||||
|
||||
function ThrowCompletion(value, location, nativeStack) {
|
||||
_classCallCheck(this, ThrowCompletion);
|
||||
|
||||
var _this3 = _possibleConstructorReturn(this, (ThrowCompletion.__proto__ || Object.getPrototypeOf(ThrowCompletion)).call(this, value, location));
|
||||
|
||||
_this3.nativeStack = nativeStack || new Error().stack;
|
||||
return _this3;
|
||||
}
|
||||
|
||||
return ThrowCompletion;
|
||||
}(AbruptCompletion);
|
||||
|
||||
var ContinueCompletion = exports.ContinueCompletion = function (_AbruptCompletion2) {
|
||||
_inherits(ContinueCompletion, _AbruptCompletion2);
|
||||
|
||||
function ContinueCompletion(value, location, target) {
|
||||
_classCallCheck(this, ContinueCompletion);
|
||||
|
||||
return _possibleConstructorReturn(this, (ContinueCompletion.__proto__ || Object.getPrototypeOf(ContinueCompletion)).call(this, value, location, target));
|
||||
}
|
||||
|
||||
return ContinueCompletion;
|
||||
}(AbruptCompletion);
|
||||
|
||||
var BreakCompletion = exports.BreakCompletion = function (_AbruptCompletion3) {
|
||||
_inherits(BreakCompletion, _AbruptCompletion3);
|
||||
|
||||
function BreakCompletion(value, location, target) {
|
||||
_classCallCheck(this, BreakCompletion);
|
||||
|
||||
return _possibleConstructorReturn(this, (BreakCompletion.__proto__ || Object.getPrototypeOf(BreakCompletion)).call(this, value, location, target));
|
||||
}
|
||||
|
||||
return BreakCompletion;
|
||||
}(AbruptCompletion);
|
||||
|
||||
var ReturnCompletion = exports.ReturnCompletion = function (_AbruptCompletion4) {
|
||||
_inherits(ReturnCompletion, _AbruptCompletion4);
|
||||
|
||||
function ReturnCompletion(value, location) {
|
||||
_classCallCheck(this, ReturnCompletion);
|
||||
|
||||
return _possibleConstructorReturn(this, (ReturnCompletion.__proto__ || Object.getPrototypeOf(ReturnCompletion)).call(this, value, location));
|
||||
}
|
||||
|
||||
return ReturnCompletion;
|
||||
}(AbruptCompletion);
|
||||
|
||||
var JoinedAbruptCompletions = exports.JoinedAbruptCompletions = function (_AbruptCompletion5) {
|
||||
_inherits(JoinedAbruptCompletions, _AbruptCompletion5);
|
||||
|
||||
function JoinedAbruptCompletions(realm, joinCondition, consequent, consequentEffects, alternate, alternateEffects) {
|
||||
_classCallCheck(this, JoinedAbruptCompletions);
|
||||
|
||||
var _this7 = _possibleConstructorReturn(this, (JoinedAbruptCompletions.__proto__ || Object.getPrototypeOf(JoinedAbruptCompletions)).call(this, realm.intrinsics.empty, consequent.location));
|
||||
|
||||
_this7.joinCondition = joinCondition;
|
||||
_this7.consequent = consequent;
|
||||
_this7.consequentEffects = consequentEffects;
|
||||
_this7.alternate = alternate;
|
||||
_this7.alternateEffects = alternateEffects;
|
||||
return _this7;
|
||||
}
|
||||
|
||||
_createClass(JoinedAbruptCompletions, [{
|
||||
key: "containsBreakOrContinue",
|
||||
value: function containsBreakOrContinue() {
|
||||
if (this.consequent instanceof BreakCompletion || this.consequent instanceof ContinueCompletion) return true;
|
||||
if (this.alternate instanceof BreakCompletion || this.alternate instanceof ContinueCompletion) return true;
|
||||
if (this.consequent instanceof JoinedAbruptCompletions) {
|
||||
if (this.consequent.containsBreakOrContinue()) return true;
|
||||
}
|
||||
if (this.alternate instanceof JoinedAbruptCompletions) {
|
||||
if (this.alternate.containsBreakOrContinue()) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}]);
|
||||
|
||||
return JoinedAbruptCompletions;
|
||||
}(AbruptCompletion);
|
||||
|
||||
// Possibly normal completions have to be treated like normal completions
|
||||
// and are thus never thrown. At the end of a try block or loop body, however,
|
||||
// action must be taken to deal with the possibly abrupt case of the completion.
|
||||
|
||||
|
||||
var PossiblyNormalCompletion = exports.PossiblyNormalCompletion = function (_NormalCompletion) {
|
||||
_inherits(PossiblyNormalCompletion, _NormalCompletion);
|
||||
|
||||
function PossiblyNormalCompletion(value, joinCondition, consequent, consequentEffects, alternate, alternateEffects, pathConditions, savedPathConditions) {
|
||||
var savedEffects = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : undefined;
|
||||
|
||||
_classCallCheck(this, PossiblyNormalCompletion);
|
||||
|
||||
(0, _invariant2.default)(consequent instanceof NormalCompletion || consequent instanceof _index.Value || alternate instanceof NormalCompletion || alternate instanceof _index.Value);
|
||||
(0, _invariant2.default)(consequent instanceof AbruptCompletion || alternate instanceof AbruptCompletion);
|
||||
(0, _invariant2.default)(value === consequent || consequent instanceof AbruptCompletion || consequent instanceof NormalCompletion && value === consequent.value);
|
||||
(0, _invariant2.default)(value === alternate || alternate instanceof AbruptCompletion || alternate instanceof NormalCompletion && value === alternate.value);
|
||||
var loc = consequent instanceof AbruptCompletion ? consequent.location : alternate instanceof Completion ? alternate.location : alternate.expressionLocation;
|
||||
|
||||
var _this8 = _possibleConstructorReturn(this, (PossiblyNormalCompletion.__proto__ || Object.getPrototypeOf(PossiblyNormalCompletion)).call(this, value, loc));
|
||||
|
||||
_this8.joinCondition = joinCondition;
|
||||
_this8.consequent = consequent;
|
||||
_this8.consequentEffects = consequentEffects;
|
||||
_this8.alternate = alternate;
|
||||
_this8.alternateEffects = alternateEffects;
|
||||
_this8.savedEffects = savedEffects;
|
||||
_this8.pathConditions = pathConditions;
|
||||
_this8.savedPathConditions = savedPathConditions;
|
||||
return _this8;
|
||||
}
|
||||
|
||||
_createClass(PossiblyNormalCompletion, [{
|
||||
key: "containsBreakOrContinue",
|
||||
value: function containsBreakOrContinue() {
|
||||
if (this.consequent instanceof BreakCompletion || this.consequent instanceof ContinueCompletion) return true;
|
||||
if (this.alternate instanceof BreakCompletion || this.alternate instanceof ContinueCompletion) return true;
|
||||
if (this.consequent instanceof JoinedAbruptCompletions || this.consequent instanceof PossiblyNormalCompletion) {
|
||||
if (this.consequent.containsBreakOrContinue()) return true;
|
||||
}
|
||||
if (this.alternate instanceof JoinedAbruptCompletions || this.alternate instanceof PossiblyNormalCompletion) {
|
||||
if (this.alternate.containsBreakOrContinue()) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}]);
|
||||
|
||||
return PossiblyNormalCompletion;
|
||||
}(NormalCompletion);
|
||||
//# sourceMappingURL=completions.js.map
|
||||
1
build/node_modules/prepack/lib/completions.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/completions.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
68
build/node_modules/prepack/lib/construct_realm.js
generated
vendored
Normal file
68
build/node_modules/prepack/lib/construct_realm.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = function () {
|
||||
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
var debugChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
||||
|
||||
(0, _initializeSingletons2.default)();
|
||||
var r = new _realm.Realm(opts);
|
||||
if (debugChannel) {
|
||||
if (debugChannel.debuggerIsAttached()) {
|
||||
r.debuggerInstance = new _Debugger.DebugServer(debugChannel, r);
|
||||
}
|
||||
}
|
||||
|
||||
var i = r.intrinsics;
|
||||
(0, _index.initialize)(i, r);
|
||||
// TODO: Find a way to let different environments initialize their own global
|
||||
// object for special magic host objects such as the window object in the DOM.
|
||||
r.$GlobalObject = new _index4.ObjectValue(r, i.ObjectPrototype, "global");
|
||||
(0, _global2.default)(r);
|
||||
for (var name in evaluators) {
|
||||
r.evaluators[name] = evaluators[name];
|
||||
}for (var _name in partialEvaluators) {
|
||||
r.partialEvaluators[_name] = partialEvaluators[_name];
|
||||
}r.simplifyAndRefineAbstractValue = _simplifier2.default.bind(null, r, false);
|
||||
r.simplifyAndRefineAbstractCondition = _simplifier2.default.bind(null, r, true);
|
||||
r.$GlobalEnv = _singletons.Environment.NewGlobalEnvironment(r, r.$GlobalObject, r.$GlobalObject);
|
||||
return r;
|
||||
};
|
||||
|
||||
var _realm = require("./realm.js");
|
||||
|
||||
var _initializeSingletons = require("./initialize-singletons.js");
|
||||
|
||||
var _initializeSingletons2 = _interopRequireDefault(_initializeSingletons);
|
||||
|
||||
var _index = require("./intrinsics/index.js");
|
||||
|
||||
var _global = require("./intrinsics/ecma262/global.js");
|
||||
|
||||
var _global2 = _interopRequireDefault(_global);
|
||||
|
||||
var _index2 = require("./evaluators/index.js");
|
||||
|
||||
var evaluators = _interopRequireWildcard(_index2);
|
||||
|
||||
var _index3 = require("./partial-evaluators/index.js");
|
||||
|
||||
var partialEvaluators = _interopRequireWildcard(_index3);
|
||||
|
||||
var _singletons = require("./singletons.js");
|
||||
|
||||
var _index4 = require("./values/index.js");
|
||||
|
||||
var _Debugger = require("./debugger/server/Debugger.js");
|
||||
|
||||
var _simplifier = require("./utils/simplifier.js");
|
||||
|
||||
var _simplifier2 = _interopRequireDefault(_simplifier);
|
||||
|
||||
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 }; }
|
||||
//# sourceMappingURL=construct_realm.js.map
|
||||
1
build/node_modules/prepack/lib/construct_realm.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/construct_realm.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/construct_realm.js"],"names":["opts","debugChannel","undefined","r","debuggerIsAttached","debuggerInstance","i","intrinsics","$GlobalObject","ObjectPrototype","name","evaluators","partialEvaluators","simplifyAndRefineAbstractValue","bind","simplifyAndRefineAbstractCondition","$GlobalEnv","NewGlobalEnvironment"],"mappings":";;;;;;kBAwBe,YAAwF;AAAA,MAA/EA,IAA+E,uEAA1D,EAA0D;AAAA,MAAtDC,YAAsD,uEAAlBC,SAAkB;;AACrG;AACA,MAAIC,IAAI,iBAAUH,IAAV,CAAR;AACA,MAAIC,YAAJ,EAAkB;AAChB,QAAIA,aAAaG,kBAAb,EAAJ,EAAuC;AACrCD,QAAEE,gBAAF,GAAqB,0BAAgBJ,YAAhB,EAA8BE,CAA9B,CAArB;AACD;AACF;;AAED,MAAIG,IAAIH,EAAEI,UAAV;AACA,yBAAqBD,CAArB,EAAwBH,CAAxB;AACA;AACA;AACAA,IAAEK,aAAF,GAAkB,wBAAgBL,CAAhB,EAAmBG,EAAEG,eAArB,EAAsC,QAAtC,CAAlB;AACA,wBAAiBN,CAAjB;AACA,OAAK,IAAIO,IAAT,IAAiBC,UAAjB;AAA6BR,MAAEQ,UAAF,CAAaD,IAAb,IAAqBC,WAAWD,IAAX,CAArB;AAA7B,GACA,KAAK,IAAIA,KAAT,IAAiBE,iBAAjB;AAAoCT,MAAES,iBAAF,CAAoBF,KAApB,IAA4BE,kBAAkBF,KAAlB,CAA5B;AAApC,GACAP,EAAEU,8BAAF,GAAmC,qBAA+BC,IAA/B,CAAoC,IAApC,EAA0CX,CAA1C,EAA6C,KAA7C,CAAnC;AACAA,IAAEY,kCAAF,GAAuC,qBAA+BD,IAA/B,CAAoC,IAApC,EAA0CX,CAA1C,EAA6C,IAA7C,CAAvC;AACAA,IAAEa,UAAF,GAAe,wBAAYC,oBAAZ,CAAiCd,CAAjC,EAAoCA,EAAEK,aAAtC,EAAqDL,EAAEK,aAAvD,CAAf;AACA,SAAOL,CAAP;AACD,C;;AAlCD;;AACA;;;;AACA;;AACA;;;;AAEA;;IAAYQ,U;;AACZ;;IAAYC,iB;;AACZ;;AACA;;AACA;;AAEA","file":"construct_realm.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 { Realm } from \"./realm.js\";\nimport initializeSingletons from \"./initialize-singletons.js\";\nimport { initialize as initializeIntrinsics } from \"./intrinsics/index.js\";\nimport initializeGlobal from \"./intrinsics/ecma262/global.js\";\nimport type { RealmOptions } from \"./options.js\";\nimport * as evaluators from \"./evaluators/index.js\";\nimport * as partialEvaluators from \"./partial-evaluators/index.js\";\nimport { Environment } from \"./singletons.js\";\nimport { ObjectValue } from \"./values/index.js\";\nimport { DebugServer } from \"./debugger/server/Debugger.js\";\nimport type { DebugChannel } from \"./debugger/server/channel/DebugChannel.js\";\nimport simplifyAndRefineAbstractValue from \"./utils/simplifier.js\";\n\nexport default function(opts: RealmOptions = {}, debugChannel: void | DebugChannel = undefined): Realm {\n initializeSingletons();\n let r = new Realm(opts);\n if (debugChannel) {\n if (debugChannel.debuggerIsAttached()) {\n r.debuggerInstance = new DebugServer(debugChannel, r);\n }\n }\n\n let i = r.intrinsics;\n initializeIntrinsics(i, r);\n // TODO: Find a way to let different environments initialize their own global\n // object for special magic host objects such as the window object in the DOM.\n r.$GlobalObject = new ObjectValue(r, i.ObjectPrototype, \"global\");\n initializeGlobal(r);\n for (let name in evaluators) r.evaluators[name] = evaluators[name];\n for (let name in partialEvaluators) r.partialEvaluators[name] = partialEvaluators[name];\n r.simplifyAndRefineAbstractValue = simplifyAndRefineAbstractValue.bind(null, r, false);\n r.simplifyAndRefineAbstractCondition = simplifyAndRefineAbstractValue.bind(null, r, true);\n r.$GlobalEnv = Environment.NewGlobalEnvironment(r, r.$GlobalObject, r.$GlobalObject);\n return r;\n}\n"]}
|
||||
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"]}
|
||||
103
build/node_modules/prepack/lib/detect_bad_deps.js
generated
vendored
Normal file
103
build/node_modules/prepack/lib/detect_bad_deps.js
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
"use strict";
|
||||
|
||||
var _madge = require("madge");
|
||||
|
||||
var _madge2 = _interopRequireDefault(_madge);
|
||||
|
||||
var _child_process = require("child_process");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
(0, _child_process.exec)("flow check --profile", function (error, stdout, stderr) {
|
||||
error;
|
||||
stdout;
|
||||
/*
|
||||
pattern format:
|
||||
...
|
||||
cycle detected among the following files:
|
||||
file1
|
||||
file2
|
||||
...
|
||||
filen
|
||||
... more flow output after unindented line
|
||||
*/
|
||||
var start = stderr.indexOf("cycle detected among the following nodes");
|
||||
var lines = stderr.substr(start).split("\n").splice(1);
|
||||
var found_ecma = false;
|
||||
var found_realm = false;
|
||||
var cycle_len = 0;
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = lines[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var line = _step.value;
|
||||
|
||||
if (!line.startsWith("\t")) break;
|
||||
cycle_len += 1;
|
||||
found_ecma = found_ecma || line.includes("/ecma262/");
|
||||
found_realm = found_realm || line.includes("/realm.js");
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (found_ecma && found_realm) {
|
||||
console.error("Invalid Dependencies: ecma262/ is in a circular dependency with realm.js");
|
||||
process.exit(1);
|
||||
}
|
||||
console.log("Biggest cycle: " + cycle_len);
|
||||
var MAX_CYCLE_LEN = 56; // NEVER EVER increase this value
|
||||
if (cycle_len > MAX_CYCLE_LEN) {
|
||||
console.error("Error: You increased cycle length from the previous high of " + MAX_CYCLE_LEN);
|
||||
console.error("This is never OK.");
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
// NB: This doesn't prevent cycles using "import type" because those are
|
||||
// erased in the lib folder but madge doesn't work with flow type imports.
|
||||
|
||||
(0, _madge2.default)("./lib/").then(function (res) {
|
||||
var deps = res.obj();
|
||||
var idx_deps = res.depends("intrinsics/index");
|
||||
if (idx_deps.length !== 1 || idx_deps[0] !== "construct_realm") {
|
||||
console.error("Invalid Dependency: Intrinsics index depends on " + idx_deps[0]);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
for (var dep in deps) {
|
||||
// Nothing in intrinsics/ecma262 depends on anything but intrinsics/index except Error and global.
|
||||
if (dep.startsWith("intrinsics/ecma262") && dep !== "intrinsics/ecma262/Error" && dep !== "intrinsics/ecma262/global") {
|
||||
var ext_deps = res.depends(dep).filter(function (depend) {
|
||||
return depend !== "intrinsics/index" && !depend.startsWith("intrinsics/ecma262");
|
||||
});
|
||||
if (ext_deps.length > 0) {
|
||||
console.error("Invalid Dependency: " + dep + " depends on " + ext_deps);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//# sourceMappingURL=detect_bad_deps.js.map
|
||||
1
build/node_modules/prepack/lib/detect_bad_deps.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/detect_bad_deps.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../scripts/detect_bad_deps.js"],"names":["error","stdout","stderr","start","indexOf","lines","substr","split","splice","found_ecma","found_realm","cycle_len","line","startsWith","includes","console","process","exit","log","MAX_CYCLE_LEN","then","deps","res","obj","idx_deps","depends","length","dep","ext_deps","filter","depend"],"mappings":";;AAWA;;;;AACA;;;;AAZA;;;;;;;;;AAcA,yBAAK,sBAAL,EAA6B,UAASA,KAAT,EAAgBC,MAAhB,EAAwBC,MAAxB,EAAgC;AAC3DF;AACAC;AACA;;;;;;;;;;AAUA,MAAIE,QAAQD,OAAOE,OAAP,CAAe,0CAAf,CAAZ;AACA,MAAIC,QAAQH,OAAOI,MAAP,CAAcH,KAAd,EAAqBI,KAArB,CAA2B,IAA3B,EAAiCC,MAAjC,CAAwC,CAAxC,CAAZ;AACA,MAAIC,aAAa,KAAjB;AACA,MAAIC,cAAc,KAAlB;AACA,MAAIC,YAAY,CAAhB;AAjB2D;AAAA;AAAA;;AAAA;AAkB3D,yBAAiBN,KAAjB,8HAAwB;AAAA,UAAfO,IAAe;;AACtB,UAAI,CAACA,KAAKC,UAAL,CAAgB,IAAhB,CAAL,EAA4B;AAC5BF,mBAAa,CAAb;AACAF,mBAAaA,cAAcG,KAAKE,QAAL,CAAc,WAAd,CAA3B;AACAJ,oBAAcA,eAAeE,KAAKE,QAAL,CAAc,WAAd,CAA7B;AACD;AAvB0D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAwB3D,MAAIL,cAAcC,WAAlB,EAA+B;AAC7BK,YAAQf,KAAR,CAAc,0EAAd;AACAgB,YAAQC,IAAR,CAAa,CAAb;AACD;AACDF,UAAQG,GAAR,CAAY,oBAAoBP,SAAhC;AACA,MAAIQ,gBAAgB,EAApB,CA7B2D,CA6BnC;AACxB,MAAIR,YAAYQ,aAAhB,EAA+B;AAC7BJ,YAAQf,KAAR,CAAc,iEAAiEmB,aAA/E;AACAJ,YAAQf,KAAR,CAAc,mBAAd;AACAgB,YAAQC,IAAR,CAAa,CAAb;AACD;AACF,CAnCD;;AAqCA;AACA;;AAEA,qBAAM,QAAN,EAAgBG,IAAhB,CAAqB,eAAO;AAC1B,MAAIC,OAAOC,IAAIC,GAAJ,EAAX;AACA,MAAIC,WAAWF,IAAIG,OAAJ,CAAY,kBAAZ,CAAf;AACA,MAAID,SAASE,MAAT,KAAoB,CAApB,IAAyBF,SAAS,CAAT,MAAgB,iBAA7C,EAAgE;AAC9DT,YAAQf,KAAR,CAAc,qDAAqDwB,SAAS,CAAT,CAAnE;AACAR,YAAQC,IAAR,CAAa,CAAb;AACD;;AAED,OAAK,IAAIU,GAAT,IAAgBN,IAAhB,EAAsB;AACpB;AACA,QACEM,IAAId,UAAJ,CAAe,oBAAf,KACAc,QAAQ,0BADR,IAEAA,QAAQ,2BAHV,EAIE;AACA,UAAIC,WAAWN,IACZG,OADY,CACJE,GADI,EAEZE,MAFY,CAEL;AAAA,eAAUC,WAAW,kBAAX,IAAiC,CAACA,OAAOjB,UAAP,CAAkB,oBAAlB,CAA5C;AAAA,OAFK,CAAf;AAGA,UAAIe,SAASF,MAAT,GAAkB,CAAtB,EAAyB;AACvBX,gBAAQf,KAAR,CAAc,yBAAyB2B,GAAzB,GAA+B,cAA/B,GAAgDC,QAA9D;AACAZ,gBAAQC,IAAR,CAAa,CAAb;AACD;AACF;AACF;AACF,CAxBD","file":"detect_bad_deps.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 madge from \"madge\";\nimport { exec } from \"child_process\";\n\nexec(\"flow check --profile\", function(error, stdout, stderr) {\n error;\n stdout;\n /*\n pattern format:\n ...\n cycle detected among the following files:\n file1\n file2\n ...\n filen\n ... more flow output after unindented line\n */\n let start = stderr.indexOf(\"cycle detected among the following nodes\");\n let lines = stderr.substr(start).split(\"\\n\").splice(1);\n let found_ecma = false;\n let found_realm = false;\n let cycle_len = 0;\n for (let line of lines) {\n if (!line.startsWith(\"\\t\")) break;\n cycle_len += 1;\n found_ecma = found_ecma || line.includes(\"/ecma262/\");\n found_realm = found_realm || line.includes(\"/realm.js\");\n }\n if (found_ecma && found_realm) {\n console.error(\"Invalid Dependencies: ecma262/ is in a circular dependency with realm.js\");\n process.exit(1);\n }\n console.log(\"Biggest cycle: \" + cycle_len);\n let MAX_CYCLE_LEN = 56; // NEVER EVER increase this value\n if (cycle_len > MAX_CYCLE_LEN) {\n console.error(\"Error: You increased cycle length from the previous high of \" + MAX_CYCLE_LEN);\n console.error(\"This is never OK.\");\n process.exit(1);\n }\n});\n\n// NB: This doesn't prevent cycles using \"import type\" because those are\n// erased in the lib folder but madge doesn't work with flow type imports.\n\nmadge(\"./lib/\").then(res => {\n let deps = res.obj();\n let idx_deps = res.depends(\"intrinsics/index\");\n if (idx_deps.length !== 1 || idx_deps[0] !== \"construct_realm\") {\n console.error(\"Invalid Dependency: Intrinsics index depends on \" + idx_deps[0]);\n process.exit(1);\n }\n\n for (let dep in deps) {\n // Nothing in intrinsics/ecma262 depends on anything but intrinsics/index except Error and global.\n if (\n dep.startsWith(\"intrinsics/ecma262\") &&\n dep !== \"intrinsics/ecma262/Error\" &&\n dep !== \"intrinsics/ecma262/global\"\n ) {\n let ext_deps = res\n .depends(dep)\n .filter(depend => depend !== \"intrinsics/index\" && !depend.startsWith(\"intrinsics/ecma262\"));\n if (ext_deps.length > 0) {\n console.error(\"Invalid Dependency: \" + dep + \" depends on \" + ext_deps);\n process.exit(1);\n }\n }\n }\n});\n"]}
|
||||
151
build/node_modules/prepack/lib/domains/TypesDomain.js
generated
vendored
Normal file
151
build/node_modules/prepack/lib/domains/TypesDomain.js
generated
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
"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; }; }(); /**
|
||||
* 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 _index = require("../values/index.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"); } }
|
||||
|
||||
/* An abstract domain for the type of value a variable might have. */
|
||||
|
||||
var TypesDomain = function () {
|
||||
function TypesDomain(type) {
|
||||
_classCallCheck(this, TypesDomain);
|
||||
|
||||
(0, _invariant2.default)(type !== _index.ConcreteValue, "Concrete values must be specific");
|
||||
this._type = type === _index.Value ? undefined : type;
|
||||
}
|
||||
|
||||
_createClass(TypesDomain, [{
|
||||
key: "getType",
|
||||
value: function getType() {
|
||||
return this._type || _index.Value;
|
||||
}
|
||||
|
||||
// return the type of the result in the case where there is no exception
|
||||
|
||||
}, {
|
||||
key: "joinWith",
|
||||
value: function joinWith(t) {
|
||||
var type = this.getType();
|
||||
if (type === t) return this;
|
||||
if (_index.Value.isTypeCompatibleWith(type, _index.FunctionValue) && _index.Value.isTypeCompatibleWith(t, _index.FunctionValue)) {
|
||||
return new TypesDomain(_index.FunctionValue);
|
||||
}
|
||||
if (_index.Value.isTypeCompatibleWith(type, _index.ObjectValue) && _index.Value.isTypeCompatibleWith(t, _index.ObjectValue)) {
|
||||
return new TypesDomain(_index.ObjectValue);
|
||||
}
|
||||
if (_index.Value.isTypeCompatibleWith(type, _index.PrimitiveValue) && _index.Value.isTypeCompatibleWith(t, _index.PrimitiveValue)) {
|
||||
return new TypesDomain(_index.PrimitiveValue);
|
||||
}
|
||||
return TypesDomain.topVal;
|
||||
}
|
||||
}], [{
|
||||
key: "binaryOp",
|
||||
value: function binaryOp(op, left, right) {
|
||||
var lType = left._type;
|
||||
var rType = right._type;
|
||||
var resultType = _index.Value;
|
||||
switch (op) {
|
||||
case "+":
|
||||
if (lType === undefined || rType === undefined) return TypesDomain.topVal;
|
||||
if (_index.Value.isTypeCompatibleWith(lType, _index.StringValue) || _index.Value.isTypeCompatibleWith(rType, _index.StringValue)) resultType = _index.StringValue;else if (_index.Value.isTypeCompatibleWith(lType, _index.NumberValue) && _index.Value.isTypeCompatibleWith(rType, _index.NumberValue)) resultType = _index.NumberValue;
|
||||
break;
|
||||
case "<":
|
||||
case ">":
|
||||
case ">=":
|
||||
case "<=":
|
||||
case "!=":
|
||||
case "==":
|
||||
case "!==":
|
||||
case "===":
|
||||
case "in":
|
||||
case "instanceof":
|
||||
resultType = _index.BooleanValue;
|
||||
break;
|
||||
case ">>>":
|
||||
case "<<":
|
||||
case ">>":
|
||||
case "&":
|
||||
case "|":
|
||||
case "^":
|
||||
case "**":
|
||||
case "%":
|
||||
case "/":
|
||||
case "*":
|
||||
case "-":
|
||||
resultType = _index.NumberValue;
|
||||
break;
|
||||
default:
|
||||
(0, _invariant2.default)(false);
|
||||
}
|
||||
return new TypesDomain(resultType);
|
||||
}
|
||||
}, {
|
||||
key: "joinValues",
|
||||
value: function joinValues(v1, v2) {
|
||||
if (v1 === undefined && v2 === undefined) return new TypesDomain(_index.UndefinedValue);
|
||||
if (v1 === undefined || v2 === undefined) return TypesDomain.topVal;
|
||||
if (v1 instanceof _index.AbstractValue) return v1.types.joinWith(v2.getType());
|
||||
if (v2 instanceof _index.AbstractValue) return v2.types.joinWith(v1.getType());
|
||||
return new TypesDomain(v1.getType()).joinWith(v2.getType());
|
||||
}
|
||||
}, {
|
||||
key: "logicalOp",
|
||||
value: function logicalOp(op, left, right) {
|
||||
return left.joinWith(right.getType());
|
||||
}
|
||||
|
||||
// return the type of the result in the case where there is no exception
|
||||
// note that the type of the operand has no influence on the type of the non exceptional result
|
||||
|
||||
}, {
|
||||
key: "unaryOp",
|
||||
value: function unaryOp(op) {
|
||||
var resultType = _index.Value;
|
||||
switch (op) {
|
||||
case "-":
|
||||
case "+":
|
||||
case "~":
|
||||
resultType = _index.NumberValue;
|
||||
break;
|
||||
case "!":
|
||||
case "delete":
|
||||
resultType = _index.BooleanValue;
|
||||
break;
|
||||
case "typeof":
|
||||
resultType = _index.StringValue;
|
||||
break;
|
||||
case "void":
|
||||
resultType = _index.UndefinedValue;
|
||||
break;
|
||||
default:
|
||||
(0, _invariant2.default)(false);
|
||||
}
|
||||
return new TypesDomain(resultType);
|
||||
}
|
||||
}]);
|
||||
|
||||
return TypesDomain;
|
||||
}();
|
||||
|
||||
TypesDomain.topVal = new TypesDomain(undefined);
|
||||
exports.default = TypesDomain;
|
||||
//# sourceMappingURL=TypesDomain.js.map
|
||||
1
build/node_modules/prepack/lib/domains/TypesDomain.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/domains/TypesDomain.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
800
build/node_modules/prepack/lib/domains/ValuesDomain.js
generated
vendored
Normal file
800
build/node_modules/prepack/lib/domains/ValuesDomain.js
generated
vendored
Normal file
@@ -0,0 +1,800 @@
|
||||
"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; }; }(); /**
|
||||
* 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 _completions = require("../completions.js");
|
||||
|
||||
var _errors = require("../errors.js");
|
||||
|
||||
var _invariant = require("../invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _index = require("../methods/index.js");
|
||||
|
||||
var _singletons = require("../singletons.js");
|
||||
|
||||
var _index2 = require("../values/index.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"); } }
|
||||
|
||||
/* An abstract domain that collects together a set of concrete values
|
||||
that might be the value of a variable at runtime.
|
||||
Initially, every variable has the value undefined.
|
||||
A property that has been weakly deleted will have more than
|
||||
one value, one of which will by the EmptyValue. */
|
||||
|
||||
var ValuesDomain = function () {
|
||||
function ValuesDomain(values) {
|
||||
_classCallCheck(this, ValuesDomain);
|
||||
|
||||
if (values instanceof _index2.ConcreteValue) {
|
||||
var valueSet = new Set();
|
||||
valueSet.add(values);
|
||||
values = valueSet;
|
||||
}
|
||||
this._elements = values;
|
||||
}
|
||||
|
||||
_createClass(ValuesDomain, [{
|
||||
key: "contains",
|
||||
value: function contains(x) {
|
||||
var elems = this._elements;
|
||||
var xelems = x._elements;
|
||||
if (elems === xelems) return true;
|
||||
if (elems === undefined) return true;
|
||||
if (xelems === undefined) return false;
|
||||
if (elems.size < xelems.size) return false;
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = xelems[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var e = _step.value;
|
||||
|
||||
if (!elems.has(e)) return false;
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "containsValue",
|
||||
value: function containsValue(x) {
|
||||
var elems = this._elements;
|
||||
if (elems === undefined) return true; // Top contains everything
|
||||
if (x instanceof _index2.AbstractValue) return this.contains(x.values);
|
||||
(0, _invariant2.default)(x instanceof _index2.ConcreteValue);
|
||||
return elems.has(x);
|
||||
}
|
||||
}, {
|
||||
key: "isTop",
|
||||
value: function isTop() {
|
||||
return this._elements === undefined;
|
||||
}
|
||||
}, {
|
||||
key: "getElements",
|
||||
value: function getElements() {
|
||||
(0, _invariant2.default)(this._elements !== undefined);
|
||||
return this._elements;
|
||||
}
|
||||
|
||||
// return a set of values that may be result of performing the given operation on each pair in the
|
||||
// Cartesian product of the value sets of the operands.
|
||||
|
||||
}, {
|
||||
key: "includesValueNotOfType",
|
||||
value: function includesValueNotOfType(type) {
|
||||
(0, _invariant2.default)(!this.isTop());
|
||||
var _iteratorNormalCompletion2 = true;
|
||||
var _didIteratorError2 = false;
|
||||
var _iteratorError2 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator2 = this.getElements()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
||||
var cval = _step2.value;
|
||||
|
||||
if (!(cval instanceof type)) return true;
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError2 = true;
|
||||
_iteratorError2 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion2 && _iterator2.return) {
|
||||
_iterator2.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError2) {
|
||||
throw _iteratorError2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
key: "includesValueOfType",
|
||||
value: function includesValueOfType(type) {
|
||||
(0, _invariant2.default)(!this.isTop());
|
||||
var _iteratorNormalCompletion3 = true;
|
||||
var _didIteratorError3 = false;
|
||||
var _iteratorError3 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator3 = this.getElements()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
||||
var cval = _step3.value;
|
||||
|
||||
if (cval instanceof type) return true;
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError3 = true;
|
||||
_iteratorError3 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion3 && _iterator3.return) {
|
||||
_iterator3.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError3) {
|
||||
throw _iteratorError3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
key: "mightBeFalse",
|
||||
value: function mightBeFalse() {
|
||||
(0, _invariant2.default)(!this.isTop());
|
||||
var _iteratorNormalCompletion4 = true;
|
||||
var _didIteratorError4 = false;
|
||||
var _iteratorError4 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator4 = this.getElements()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
||||
var cval = _step4.value;
|
||||
|
||||
if (cval.mightBeFalse()) return true;
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError4 = true;
|
||||
_iteratorError4 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion4 && _iterator4.return) {
|
||||
_iterator4.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError4) {
|
||||
throw _iteratorError4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
key: "mightNotBeFalse",
|
||||
value: function mightNotBeFalse() {
|
||||
(0, _invariant2.default)(!this.isTop());
|
||||
var _iteratorNormalCompletion5 = true;
|
||||
var _didIteratorError5 = false;
|
||||
var _iteratorError5 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator5 = this.getElements()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
||||
var cval = _step5.value;
|
||||
|
||||
if (cval.mightNotBeFalse()) return true;
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError5 = true;
|
||||
_iteratorError5 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion5 && _iterator5.return) {
|
||||
_iterator5.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError5) {
|
||||
throw _iteratorError5;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}, {
|
||||
key: "joinWith",
|
||||
value: function joinWith(y) {
|
||||
if (this.isTop()) return this;
|
||||
var union = new Set(this.getElements());
|
||||
if (y instanceof _index2.AbstractValue) {
|
||||
if (y.values.isTop()) return y.values;
|
||||
y.values.getElements().forEach(function (v) {
|
||||
return union.add(v);
|
||||
});
|
||||
} else {
|
||||
(0, _invariant2.default)(y instanceof _index2.ConcreteValue);
|
||||
union.add(y);
|
||||
}
|
||||
return new ValuesDomain(union);
|
||||
}
|
||||
}, {
|
||||
key: "meetWith",
|
||||
value: function meetWith(y) {
|
||||
var intersection = new Set();
|
||||
var elements = this._elements;
|
||||
if (y instanceof _index2.AbstractValue) {
|
||||
if (y.values.isTop()) return this;
|
||||
y.values.getElements().forEach(function (v) {
|
||||
if (elements === undefined || elements.has(v)) intersection.add(v);
|
||||
});
|
||||
} else {
|
||||
(0, _invariant2.default)(y instanceof _index2.ConcreteValue);
|
||||
if (elements === undefined || elements.has(y)) intersection.add(y);
|
||||
}
|
||||
return new ValuesDomain(intersection);
|
||||
}
|
||||
}, {
|
||||
key: "promoteEmptyToUndefined",
|
||||
value: function promoteEmptyToUndefined() {
|
||||
if (this.isTop()) return this;
|
||||
var newSet = new Set();
|
||||
var _iteratorNormalCompletion6 = true;
|
||||
var _didIteratorError6 = false;
|
||||
var _iteratorError6 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator6 = this.getElements()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) {
|
||||
var cval = _step6.value;
|
||||
|
||||
if (cval instanceof _index2.EmptyValue) newSet.add(cval.$Realm.intrinsics.undefined);else newSet.add(cval);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError6 = true;
|
||||
_iteratorError6 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion6 && _iterator6.return) {
|
||||
_iterator6.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError6) {
|
||||
throw _iteratorError6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ValuesDomain(newSet);
|
||||
}
|
||||
}], [{
|
||||
key: "binaryOp",
|
||||
value: function binaryOp(realm, op, left, right) {
|
||||
var leftElements = left._elements;
|
||||
var rightElements = right._elements;
|
||||
// Return top if left and/or right are top or if the size of the value set would get to be quite large.
|
||||
// Note: the larger the set of values, the less we know and therefore the less we get value from computing
|
||||
// all of these values. TODO #1000: probably the upper bound can be quite a bit smaller.
|
||||
if (!leftElements || !rightElements || leftElements.size > 100 || rightElements.size > 100) return ValuesDomain.topVal;
|
||||
var resultSet = new Set();
|
||||
var savedHandler = realm.errorHandler;
|
||||
var savedIsReadOnly = realm.isReadOnly;
|
||||
realm.isReadOnly = true;
|
||||
try {
|
||||
realm.errorHandler = function () {
|
||||
throw new _errors.FatalError();
|
||||
};
|
||||
var _iteratorNormalCompletion7 = true;
|
||||
var _didIteratorError7 = false;
|
||||
var _iteratorError7 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator7 = leftElements[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) {
|
||||
var leftElem = _step7.value;
|
||||
var _iteratorNormalCompletion8 = true;
|
||||
var _didIteratorError8 = false;
|
||||
var _iteratorError8 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator8 = rightElements[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) {
|
||||
var rightElem = _step8.value;
|
||||
|
||||
var result = ValuesDomain.computeBinary(realm, op, leftElem, rightElem);
|
||||
(0, _invariant2.default)(result instanceof _index2.ConcreteValue);
|
||||
resultSet.add(result);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError8 = true;
|
||||
_iteratorError8 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion8 && _iterator8.return) {
|
||||
_iterator8.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError8) {
|
||||
throw _iteratorError8;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError7 = true;
|
||||
_iteratorError7 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion7 && _iterator7.return) {
|
||||
_iterator7.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError7) {
|
||||
throw _iteratorError7;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (e instanceof _completions.AbruptCompletion) return ValuesDomain.topVal;
|
||||
} finally {
|
||||
realm.errorHandler = savedHandler;
|
||||
realm.isReadOnly = savedIsReadOnly;
|
||||
}
|
||||
return new ValuesDomain(resultSet);
|
||||
}
|
||||
|
||||
// Note that calling this can result in user code running, which can side-effect the heap.
|
||||
// If that is not the desired behavior, mark the realm as read-only for the duration of the call.
|
||||
|
||||
}, {
|
||||
key: "computeBinary",
|
||||
value: function computeBinary(realm, op, lval, rval) {
|
||||
if (op === "+") {
|
||||
// ECMA262 12.8.3 The Addition Operator
|
||||
var lprim = _singletons.To.ToPrimitiveOrAbstract(realm, lval);
|
||||
var rprim = _singletons.To.ToPrimitiveOrAbstract(realm, rval);
|
||||
|
||||
if (lprim instanceof _index2.AbstractValue || rprim instanceof _index2.AbstractValue) {
|
||||
return _index2.AbstractValue.createFromBinaryOp(realm, op, lprim, rprim);
|
||||
}
|
||||
|
||||
if (lprim instanceof _index2.StringValue || rprim instanceof _index2.StringValue) {
|
||||
var lstr = _singletons.To.ToString(realm, lprim);
|
||||
var rstr = _singletons.To.ToString(realm, rprim);
|
||||
return new _index2.StringValue(realm, lstr + rstr);
|
||||
}
|
||||
|
||||
var lnum = _singletons.To.ToNumber(realm, lprim);
|
||||
var rnum = _singletons.To.ToNumber(realm, rprim);
|
||||
return (0, _index.Add)(realm, lnum, rnum);
|
||||
} else if (op === "<" || op === ">" || op === ">=" || op === "<=") {
|
||||
// ECMA262 12.10.3
|
||||
if (op === "<") {
|
||||
var r = (0, _index.AbstractRelationalComparison)(realm, lval, rval, true);
|
||||
if (r instanceof _index2.UndefinedValue) {
|
||||
return realm.intrinsics.false;
|
||||
} else {
|
||||
return r;
|
||||
}
|
||||
} else if (op === "<=") {
|
||||
var _r = (0, _index.AbstractRelationalComparison)(realm, rval, lval, false);
|
||||
if (_r instanceof _index2.UndefinedValue || _r instanceof _index2.BooleanValue && _r.value) {
|
||||
return realm.intrinsics.false;
|
||||
} else {
|
||||
return realm.intrinsics.true;
|
||||
}
|
||||
} else if (op === ">") {
|
||||
var _r2 = (0, _index.AbstractRelationalComparison)(realm, rval, lval, false);
|
||||
if (_r2 instanceof _index2.UndefinedValue) {
|
||||
return realm.intrinsics.false;
|
||||
} else {
|
||||
return _r2;
|
||||
}
|
||||
} else if (op === ">=") {
|
||||
var _r3 = (0, _index.AbstractRelationalComparison)(realm, lval, rval, true);
|
||||
if (_r3 instanceof _index2.UndefinedValue || _r3 instanceof _index2.BooleanValue && _r3.value) {
|
||||
return realm.intrinsics.false;
|
||||
} else {
|
||||
return realm.intrinsics.true;
|
||||
}
|
||||
}
|
||||
} else if (op === ">>>") {
|
||||
// ECMA262 12.9.5.1
|
||||
var _lnum = _singletons.To.ToUint32(realm, lval);
|
||||
var _rnum = _singletons.To.ToUint32(realm, rval);
|
||||
|
||||
return new _index2.NumberValue(realm, _lnum >>> _rnum);
|
||||
} else if (op === "<<" || op === ">>") {
|
||||
var _lnum2 = _singletons.To.ToInt32(realm, lval);
|
||||
var _rnum2 = _singletons.To.ToUint32(realm, rval);
|
||||
|
||||
if (op === "<<") {
|
||||
// ECMA262 12.9.3.1
|
||||
return new _index2.NumberValue(realm, _lnum2 << _rnum2);
|
||||
} else if (op === ">>") {
|
||||
// ECMA262 12.9.4.1
|
||||
return new _index2.NumberValue(realm, _lnum2 >> _rnum2);
|
||||
}
|
||||
} else if (op === "**") {
|
||||
// ECMA262 12.6.3
|
||||
|
||||
// 5. Let base be ? ToNumber(leftValue).
|
||||
var base = _singletons.To.ToNumber(realm, lval);
|
||||
|
||||
// 6. Let exponent be ? ToNumber(rightValue).
|
||||
var exponent = _singletons.To.ToNumber(realm, rval);
|
||||
|
||||
// 7. Return the result of Applying the ** operator with base and exponent as specified in 12.7.3.4.
|
||||
return new _index2.NumberValue(realm, Math.pow(base, exponent));
|
||||
} else if (op === "%" || op === "/" || op === "*" || op === "-") {
|
||||
// ECMA262 12.7.3
|
||||
var _lnum3 = _singletons.To.ToNumberOrAbstract(realm, lval);
|
||||
var _rnum3 = _singletons.To.ToNumberOrAbstract(realm, rval);
|
||||
if (_lnum3 instanceof _index2.AbstractValue || _rnum3 instanceof _index2.AbstractValue) {
|
||||
var lnumVal = _lnum3 instanceof _index2.AbstractValue ? _lnum3 : new _index2.NumberValue(realm, _lnum3);
|
||||
var rnumVal = _rnum3 instanceof _index2.AbstractValue ? _rnum3 : new _index2.NumberValue(realm, _rnum3);
|
||||
return _index2.AbstractValue.createFromBinaryOp(realm, op, lnumVal, rnumVal);
|
||||
}
|
||||
|
||||
if (isNaN(_rnum3)) return realm.intrinsics.NaN;
|
||||
if (isNaN(_lnum3)) return realm.intrinsics.NaN;
|
||||
|
||||
if (op === "-") {
|
||||
return (0, _index.Add)(realm, _lnum3, _rnum3, true);
|
||||
} else if (op === "%") {
|
||||
// The sign of the result equals the sign of the dividend.
|
||||
// If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN.
|
||||
// If the dividend is finite and the divisor is an infinity, the result equals the dividend.
|
||||
// If the dividend is a zero and the divisor is nonzero and finite, the result is the same as the dividend.
|
||||
return new _index2.NumberValue(realm, _lnum3 % _rnum3);
|
||||
} else if (op === "/") {
|
||||
// The sign of the result is positive if both operands have the same sign, negative if the operands have different signs.
|
||||
// Division of an infinity by an infinity results in NaN.
|
||||
// Division of an infinity by a zero results in an infinity. The sign is determined by the rule already stated above.
|
||||
// Division of an infinity by a nonzero finite value results in a signed infinity. The sign is determined by the rule already stated above.
|
||||
// Division of a finite value by an infinity results in zero. The sign is determined by the rule already stated above.
|
||||
// Division of a zero by a zero results in NaN; division of zero by any other finite value results in zero, with the sign determined by the rule already stated above.
|
||||
// Division of a nonzero finite value by a zero results in a signed infinity. The sign is determined by the rule already stated above.
|
||||
return new _index2.NumberValue(realm, _lnum3 / _rnum3);
|
||||
} else if (op === "*") {
|
||||
// The sign of the result is positive if both operands have the same sign, negative if the operands have different signs.
|
||||
// Multiplication of an infinity by a zero results in NaN.
|
||||
// Multiplication of an infinity by an infinity results in an infinity. The sign is determined by the rule already stated above.
|
||||
// Multiplication of an infinity by a finite nonzero value results in a signed infinity. The sign is determined by the rule already stated above.
|
||||
return new _index2.NumberValue(realm, _lnum3 * _rnum3);
|
||||
}
|
||||
} else if (op === "!==") {
|
||||
return new _index2.BooleanValue(realm, !(0, _index.StrictEqualityComparison)(realm, lval, rval));
|
||||
} else if (op === "===") {
|
||||
return new _index2.BooleanValue(realm, (0, _index.StrictEqualityComparison)(realm, lval, rval));
|
||||
} else if (op === "!=") {
|
||||
return new _index2.BooleanValue(realm, !(0, _index.AbstractEqualityComparison)(realm, lval, rval));
|
||||
} else if (op === "==") {
|
||||
return new _index2.BooleanValue(realm, (0, _index.AbstractEqualityComparison)(realm, lval, rval));
|
||||
} else if (op === "&" || op === "|" || op === "^") {
|
||||
// ECMA262 12.12.3
|
||||
|
||||
var _lnum4 = _singletons.To.ToInt32(realm, lval);
|
||||
|
||||
// 6. Let rnum be ? ToInt32(rval).
|
||||
var _rnum4 = _singletons.To.ToInt32(realm, rval);
|
||||
|
||||
// 7. Return the result of applying the bitwise operator @ to lnum and rnum. The result is a signed 32 bit integer.
|
||||
if (op === "&") {
|
||||
return new _index2.NumberValue(realm, _lnum4 & _rnum4);
|
||||
} else if (op === "|") {
|
||||
return new _index2.NumberValue(realm, _lnum4 | _rnum4);
|
||||
} else if (op === "^") {
|
||||
return new _index2.NumberValue(realm, _lnum4 ^ _rnum4);
|
||||
}
|
||||
} else if (op === "in") {
|
||||
// ECMA262 12.10.3
|
||||
|
||||
// 5. If Type(rval) is not Object, throw a TypeError exception.
|
||||
if (!(rval instanceof _index2.ObjectValue)) {
|
||||
throw new _errors.FatalError();
|
||||
}
|
||||
|
||||
// 6. Return ? HasProperty(rval, ToPropertyKey(lval)).
|
||||
return new _index2.BooleanValue(realm, (0, _index.HasProperty)(realm, rval, _singletons.To.ToPropertyKey(realm, lval)));
|
||||
} else if (op === "instanceof") {
|
||||
// ECMA262 12.10.3
|
||||
|
||||
// 5. Return ? InstanceofOperator(lval, rval).;
|
||||
return new _index2.BooleanValue(realm, (0, _index.InstanceofOperator)(realm, lval, rval));
|
||||
}
|
||||
|
||||
(0, _invariant2.default)(false, "unimplemented " + op);
|
||||
}
|
||||
}, {
|
||||
key: "logicalOp",
|
||||
value: function logicalOp(realm, op, left, right) {
|
||||
var leftElements = left._elements;
|
||||
var rightElements = right._elements;
|
||||
// Return top if left and/or right are top or if the size of the value set would get to be quite large.
|
||||
// Note: the larger the set of values, the less we know and therefore the less we get value from computing
|
||||
// all of these values. TODO #1000: probably the upper bound can be quite a bit smaller.
|
||||
if (!leftElements || !rightElements || leftElements.size > 100 || rightElements.size > 100) return ValuesDomain.topVal;
|
||||
var resultSet = new Set();
|
||||
var savedHandler = realm.errorHandler;
|
||||
var savedIsReadOnly = realm.isReadOnly;
|
||||
realm.isReadOnly = true;
|
||||
try {
|
||||
realm.errorHandler = function () {
|
||||
throw new _errors.FatalError();
|
||||
};
|
||||
var _iteratorNormalCompletion9 = true;
|
||||
var _didIteratorError9 = false;
|
||||
var _iteratorError9 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator9 = leftElements[Symbol.iterator](), _step9; !(_iteratorNormalCompletion9 = (_step9 = _iterator9.next()).done); _iteratorNormalCompletion9 = true) {
|
||||
var leftElem = _step9.value;
|
||||
var _iteratorNormalCompletion10 = true;
|
||||
var _didIteratorError10 = false;
|
||||
var _iteratorError10 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator10 = rightElements[Symbol.iterator](), _step10; !(_iteratorNormalCompletion10 = (_step10 = _iterator10.next()).done); _iteratorNormalCompletion10 = true) {
|
||||
var rightElem = _step10.value;
|
||||
|
||||
var result = ValuesDomain.computeLogical(realm, op, leftElem, rightElem);
|
||||
(0, _invariant2.default)(result instanceof _index2.ConcreteValue);
|
||||
resultSet.add(result);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError10 = true;
|
||||
_iteratorError10 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion10 && _iterator10.return) {
|
||||
_iterator10.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError10) {
|
||||
throw _iteratorError10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError9 = true;
|
||||
_iteratorError9 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion9 && _iterator9.return) {
|
||||
_iterator9.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError9) {
|
||||
throw _iteratorError9;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (e instanceof _completions.AbruptCompletion) return ValuesDomain.topVal;
|
||||
} finally {
|
||||
realm.errorHandler = savedHandler;
|
||||
realm.isReadOnly = savedIsReadOnly;
|
||||
}
|
||||
return new ValuesDomain(resultSet);
|
||||
}
|
||||
|
||||
// Note that calling this can result in user code running, which can side-effect the heap.
|
||||
// If that is not the desired behavior, mark the realm as read-only for the duration of the call.
|
||||
|
||||
}, {
|
||||
key: "computeLogical",
|
||||
value: function computeLogical(realm, op, lval, rval) {
|
||||
var lbool = _singletons.To.ToBoolean(realm, lval);
|
||||
|
||||
if (op === "&&") {
|
||||
// ECMA262 12.13.3
|
||||
if (lbool === false) return lval;
|
||||
} else if (op === "||") {
|
||||
// ECMA262 12.13.3
|
||||
if (lbool === true) return lval;
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
// Note that calling this can result in user code running, which can side-effect the heap.
|
||||
// If that is not the desired behavior, mark the realm as read-only for the duration of the call.
|
||||
|
||||
}, {
|
||||
key: "computeUnary",
|
||||
value: function computeUnary(realm, op, value) {
|
||||
if (op === "+") {
|
||||
// ECMA262 12.5.6.1
|
||||
// 1. Let expr be the result of evaluating UnaryExpression.
|
||||
// 2. Return ? ToNumber(? GetValue(expr)).
|
||||
return new _index2.NumberValue(realm, _singletons.To.ToNumber(realm, value));
|
||||
} else if (op === "-") {
|
||||
// ECMA262 12.5.7.1
|
||||
// 1. Let expr be the result of evaluating UnaryExpression.
|
||||
// 2. Let oldValue be ? ToNumber(? GetValue(expr)).
|
||||
var oldValue = _singletons.To.ToNumber(realm, value);
|
||||
|
||||
// 3. If oldValue is NaN, return NaN.
|
||||
if (isNaN(oldValue)) {
|
||||
return realm.intrinsics.NaN;
|
||||
}
|
||||
|
||||
// 4. Return the result of negating oldValue; that is, compute a Number with the same magnitude but opposite sign.
|
||||
return new _index2.NumberValue(realm, -oldValue);
|
||||
} else if (op === "~") {
|
||||
// ECMA262 12.5.8
|
||||
// 1. Let expr be the result of evaluating UnaryExpression.
|
||||
// 2. Let oldValue be ? ToInt32(? GetValue(expr)).
|
||||
var _oldValue = _singletons.To.ToInt32(realm, value);
|
||||
|
||||
// 3. Return the result of applying bitwise complement to oldValue. The result is a signed 32-bit integer.
|
||||
return new _index2.NumberValue(realm, ~_oldValue);
|
||||
} else if (op === "!") {
|
||||
// ECMA262 12.6.9
|
||||
// 1. Let expr be the result of evaluating UnaryExpression.
|
||||
// 2. Let oldValue be ToBoolean(? GetValue(expr)).
|
||||
var _oldValue2 = _singletons.To.ToBoolean(realm, value);
|
||||
|
||||
// 3. If oldValue is true, return false.
|
||||
if (_oldValue2 === true) return realm.intrinsics.false;
|
||||
|
||||
// 4. Return true.
|
||||
return realm.intrinsics.true;
|
||||
} else if (op === "void") {
|
||||
// 1. Let expr be the result of evaluating UnaryExpression.
|
||||
// 2. Perform ? GetValue(expr).
|
||||
// 3. Return undefined.
|
||||
return realm.intrinsics.undefined;
|
||||
} else if (op === "typeof") {
|
||||
var isInstance = function isInstance(proto, Constructor) {
|
||||
return proto instanceof Constructor || proto === Constructor.prototype;
|
||||
};
|
||||
// ECMA262 12.6.5
|
||||
// 1. Let val be the result of evaluating UnaryExpression.
|
||||
// 2. If Type(val) is Reference, then
|
||||
// 3. Let val be ? GetValue(val).
|
||||
|
||||
|
||||
var val = value;
|
||||
// 4. Return a String according to Table 35.
|
||||
var proto = val.getType().prototype;
|
||||
if (isInstance(proto, _index2.UndefinedValue)) {
|
||||
return new _index2.StringValue(realm, "undefined");
|
||||
} else if (isInstance(proto, _index2.NullValue)) {
|
||||
return new _index2.StringValue(realm, "object");
|
||||
} else if (isInstance(proto, _index2.StringValue)) {
|
||||
return new _index2.StringValue(realm, "string");
|
||||
} else if (isInstance(proto, _index2.BooleanValue)) {
|
||||
return new _index2.StringValue(realm, "boolean");
|
||||
} else if (isInstance(proto, _index2.NumberValue)) {
|
||||
return new _index2.StringValue(realm, "number");
|
||||
} else if (isInstance(proto, _index2.SymbolValue)) {
|
||||
return new _index2.StringValue(realm, "symbol");
|
||||
} else if (isInstance(proto, _index2.ObjectValue)) {
|
||||
if ((0, _index.IsCallable)(realm, val)) {
|
||||
return new _index2.StringValue(realm, "function");
|
||||
}
|
||||
return new _index2.StringValue(realm, "object");
|
||||
} else {
|
||||
(0, _invariant2.default)(false);
|
||||
}
|
||||
} else {
|
||||
(0, _invariant2.default)(op === "delete");
|
||||
// ECMA262 12.5.3.2
|
||||
// 1. Let ref be the result of evaluating UnaryExpression.
|
||||
// 2. ReturnIfAbrupt(ref).
|
||||
// 3. If Type(ref) is not Reference, return true.
|
||||
return realm.intrinsics.true;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "unaryOp",
|
||||
value: function unaryOp(realm, op, operandValues) {
|
||||
var operandElements = operandValues._elements;
|
||||
if (operandElements === undefined) return ValuesDomain.topVal;
|
||||
var resultSet = new Set();
|
||||
var savedHandler = realm.errorHandler;
|
||||
var savedIsReadOnly = realm.isReadOnly;
|
||||
realm.isReadOnly = true;
|
||||
try {
|
||||
realm.errorHandler = function () {
|
||||
throw new _errors.FatalError();
|
||||
};
|
||||
var _iteratorNormalCompletion11 = true;
|
||||
var _didIteratorError11 = false;
|
||||
var _iteratorError11 = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator11 = operandElements[Symbol.iterator](), _step11; !(_iteratorNormalCompletion11 = (_step11 = _iterator11.next()).done); _iteratorNormalCompletion11 = true) {
|
||||
var operandElem = _step11.value;
|
||||
|
||||
var result = ValuesDomain.computeUnary(realm, op, operandElem);
|
||||
(0, _invariant2.default)(result instanceof _index2.ConcreteValue);
|
||||
resultSet.add(result);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError11 = true;
|
||||
_iteratorError11 = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion11 && _iterator11.return) {
|
||||
_iterator11.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError11) {
|
||||
throw _iteratorError11;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (e instanceof _completions.AbruptCompletion) return ValuesDomain.topVal;
|
||||
} finally {
|
||||
realm.errorHandler = savedHandler;
|
||||
realm.isReadOnly = savedIsReadOnly;
|
||||
}
|
||||
return new ValuesDomain(resultSet);
|
||||
}
|
||||
}, {
|
||||
key: "joinValues",
|
||||
value: function joinValues(realm, v1, v2) {
|
||||
if (v1 === undefined) v1 = realm.intrinsics.undefined;
|
||||
if (v2 === undefined) v2 = realm.intrinsics.undefined;
|
||||
if (v1 instanceof _index2.AbstractValue) return v1.values.joinWith(v2);
|
||||
if (v2 instanceof _index2.AbstractValue) return v2.values.joinWith(v1);
|
||||
var union = new Set();
|
||||
(0, _invariant2.default)(v1 instanceof _index2.ConcreteValue);
|
||||
union.add(v1);
|
||||
(0, _invariant2.default)(v2 instanceof _index2.ConcreteValue);
|
||||
union.add(v2);
|
||||
return new ValuesDomain(union);
|
||||
}
|
||||
}, {
|
||||
key: "meetValues",
|
||||
value: function meetValues(realm, v1, v2) {
|
||||
if (v1 === undefined) v1 = realm.intrinsics.undefined;
|
||||
if (v2 === undefined) v2 = realm.intrinsics.undefined;
|
||||
if (v1 instanceof _index2.AbstractValue) return v1.values.meetWith(v2);
|
||||
if (v2 instanceof _index2.AbstractValue) return v2.values.meetWith(v1);
|
||||
var intersection = new Set();
|
||||
(0, _invariant2.default)(v1 instanceof _index2.ConcreteValue);
|
||||
(0, _invariant2.default)(v2 instanceof _index2.ConcreteValue);
|
||||
if (v1 === v2) intersection.add(v1);
|
||||
return new ValuesDomain(intersection);
|
||||
}
|
||||
}]);
|
||||
|
||||
return ValuesDomain;
|
||||
}();
|
||||
|
||||
ValuesDomain.topVal = new ValuesDomain(undefined);
|
||||
exports.default = ValuesDomain;
|
||||
//# sourceMappingURL=ValuesDomain.js.map
|
||||
1
build/node_modules/prepack/lib/domains/ValuesDomain.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/domains/ValuesDomain.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
26
build/node_modules/prepack/lib/domains/index.js
generated
vendored
Normal file
26
build/node_modules/prepack/lib/domains/index.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _TypesDomain = require("./TypesDomain.js");
|
||||
|
||||
Object.defineProperty(exports, "TypesDomain", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_TypesDomain).default;
|
||||
}
|
||||
});
|
||||
|
||||
var _ValuesDomain = require("./ValuesDomain.js");
|
||||
|
||||
Object.defineProperty(exports, "ValuesDomain", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _interopRequireDefault(_ValuesDomain).default;
|
||||
}
|
||||
});
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
build/node_modules/prepack/lib/domains/index.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/domains/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/domains/index.js"],"names":["default"],"mappings":";;;;;;;;;;;gDAWSA,O;;;;;;;;;iDACAA,O","file":"index.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 as TypesDomain } from \"./TypesDomain.js\";\nexport { default as ValuesDomain } from \"./ValuesDomain.js\";\n"]}
|
||||
1579
build/node_modules/prepack/lib/environment.js
generated
vendored
Normal file
1579
build/node_modules/prepack/lib/environment.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
build/node_modules/prepack/lib/environment.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/environment.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
54
build/node_modules/prepack/lib/errors.js
generated
vendored
Normal file
54
build/node_modules/prepack/lib/errors.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.FatalError = FatalError;
|
||||
|
||||
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; }
|
||||
|
||||
// This is the error format used to report errors to the caller-supplied
|
||||
// error-handler
|
||||
/**
|
||||
* 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 CompilerDiagnostic = exports.CompilerDiagnostic = function (_Error) {
|
||||
_inherits(CompilerDiagnostic, _Error);
|
||||
|
||||
function CompilerDiagnostic(message, location, errorCode, severity) {
|
||||
_classCallCheck(this, CompilerDiagnostic);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (CompilerDiagnostic.__proto__ || Object.getPrototypeOf(CompilerDiagnostic)).call(this, message));
|
||||
|
||||
_this.location = location;
|
||||
_this.severity = severity;
|
||||
_this.errorCode = errorCode;
|
||||
return _this;
|
||||
}
|
||||
|
||||
return CompilerDiagnostic;
|
||||
}(Error);
|
||||
|
||||
// This error is thrown to exit Prepack when an ErrorHandler returns 'FatalError'
|
||||
// This should just be a class but Babel classes doesn't work with
|
||||
// built-in super classes.
|
||||
|
||||
|
||||
function FatalError(message) {
|
||||
var self = new Error(message || "A fatal error occurred while prepacking.");
|
||||
Object.setPrototypeOf(self, FatalError.prototype);
|
||||
return self;
|
||||
}
|
||||
Object.setPrototypeOf(FatalError, Error);
|
||||
Object.setPrototypeOf(FatalError.prototype, Error.prototype);
|
||||
//# sourceMappingURL=errors.js.map
|
||||
1
build/node_modules/prepack/lib/errors.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/errors.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/errors.js"],"names":["FatalError","CompilerDiagnostic","message","location","errorCode","severity","Error","self","Object","setPrototypeOf","prototype"],"mappings":";;;;;QAqCgBA,U,GAAAA,U;;;;;;;;AApBhB;AACA;AAlBA;;;;;;;;;IAmBaC,kB,WAAAA,kB;;;AACX,8BAAYC,OAAZ,EAA6BC,QAA7B,EAAiEC,SAAjE,EAAoFC,QAApF,EAAwG;AAAA;;AAAA,wIAChGH,OADgG;;AAGtG,UAAKC,QAAL,GAAgBA,QAAhB;AACA,UAAKE,QAAL,GAAgBA,QAAhB;AACA,UAAKD,SAAL,GAAiBA,SAAjB;AALsG;AAMvG;;;EAPqCE,K;;AAexC;AACA;AACA;;;AACO,SAASN,UAAT,CAAoBE,OAApB,EAAsC;AAC3C,MAAIK,OAAO,IAAID,KAAJ,CAAUJ,WAAW,0CAArB,CAAX;AACAM,SAAOC,cAAP,CAAsBF,IAAtB,EAA4BP,WAAWU,SAAvC;AACA,SAAOH,IAAP;AACD;AACDC,OAAOC,cAAP,CAAsBT,UAAtB,EAAkCM,KAAlC;AACAE,OAAOC,cAAP,CAAsBT,WAAWU,SAAjC,EAA4CJ,MAAMI,SAAlD","file":"errors.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 { BabelNodeSourceLocation } from \"babel-types\";\n\nexport type Severity = \"FatalError\" | \"RecoverableError\" | \"Warning\" | \"Information\";\nexport type ErrorHandlerResult = \"Fail\" | \"Recover\";\nexport type ErrorCode = \"PP0001\";\n\n// This is the error format used to report errors to the caller-supplied\n// error-handler\nexport class CompilerDiagnostic extends Error {\n constructor(message: string, location: ?BabelNodeSourceLocation, errorCode: string, severity: Severity) {\n super(message);\n\n this.location = location;\n this.severity = severity;\n this.errorCode = errorCode;\n }\n\n callStack: void | string;\n location: ?BabelNodeSourceLocation;\n severity: Severity;\n errorCode: string;\n}\n\n// This error is thrown to exit Prepack when an ErrorHandler returns 'FatalError'\n// This should just be a class but Babel classes doesn't work with\n// built-in super classes.\nexport function FatalError(message?: string) {\n let self = new Error(message || \"A fatal error occurred while prepacking.\");\n Object.setPrototypeOf(self, FatalError.prototype);\n return self;\n}\nObject.setPrototypeOf(FatalError, Error);\nObject.setPrototypeOf(FatalError.prototype, Error.prototype);\n\nexport type ErrorHandler = (error: CompilerDiagnostic) => ErrorHandlerResult;\n"]}
|
||||
97
build/node_modules/prepack/lib/evaluators/ArrayExpression.js
generated
vendored
Normal file
97
build/node_modules/prepack/lib/evaluators/ArrayExpression.js
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = function (ast, strictCode, env, realm) {
|
||||
// 1. Let array be ArrayCreate(0).
|
||||
var array = _singletons.Create.ArrayCreate(realm, 0);
|
||||
|
||||
// 2. Let len be the result of performing ArrayAccumulation for ElementList with arguments array and 0.
|
||||
var elements = ast.elements || [];
|
||||
var len = elements.length;
|
||||
var nextIndex = 0;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var elem = elements[i];
|
||||
if (!elem) {
|
||||
nextIndex++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// ECMA262 12.2.5.2
|
||||
if (elem.type === "SpreadElement") {
|
||||
// 1. Let spreadRef be the result of evaluating AssignmentExpression.
|
||||
var spreadRef = env.evaluate(elem.argument, strictCode);
|
||||
|
||||
// 2. Let spreadObj be ? GetValue(spreadRef).
|
||||
var spreadObj = _singletons.Environment.GetValue(realm, spreadRef);
|
||||
|
||||
// 3. Let iterator be ? GetIterator(spreadObj).
|
||||
var iterator = (0, _index2.GetIterator)(realm, spreadObj);
|
||||
|
||||
// 4. Repeat
|
||||
while (true) {
|
||||
// a. Let next be ? IteratorStep(iterator).
|
||||
var next = (0, _iterator.IteratorStep)(realm, iterator);
|
||||
|
||||
// b. If next is false, return nextIndex.
|
||||
if (next === false) break;
|
||||
|
||||
// c. Let nextValue be ? IteratorValue(next).
|
||||
var nextValue = (0, _iterator.IteratorValue)(realm, next);
|
||||
|
||||
// d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), nextValue).
|
||||
var status = _singletons.Create.CreateDataProperty(realm, array, new _index.StringValue(realm, nextIndex++ + ""), nextValue);
|
||||
|
||||
// e. Assert: status is true.
|
||||
(0, _invariant2.default)(status === true);
|
||||
|
||||
// f. Let nextIndex be nextIndex + 1.
|
||||
}
|
||||
} else {
|
||||
// Redundant steps.
|
||||
// 1. Let postIndex be the result of performing ArrayAccumulation for ElementList with arguments array and nextIndex.
|
||||
// 2. ReturnIfAbrupt(postIndex).
|
||||
// 3. Let padding be the ElisionWidth of Elision; if Elision is not present, use the numeric value zero.
|
||||
|
||||
// 4. Let initResult be the result of evaluating AssignmentExpression.
|
||||
var initResult = env.evaluate(elem, strictCode);
|
||||
|
||||
// 5. Let initValue be ? GetValue(initResult).
|
||||
var initValue = _singletons.Environment.GetValue(realm, initResult);
|
||||
|
||||
// 6. Let created be CreateDataProperty(array, ToString(ToUint32(postIndex+padding)), initValue).
|
||||
var created = _singletons.Create.CreateDataProperty(realm, array, new _index.StringValue(realm, nextIndex++ + ""), initValue);
|
||||
|
||||
// 7. Assert: created is true.
|
||||
(0, _invariant2.default)(created === true, "expected data property creation");
|
||||
}
|
||||
}
|
||||
|
||||
// Not necessary since we propagate completions with exceptions.
|
||||
// 3. ReturnIfAbrupt(len).
|
||||
|
||||
// 4. Perform Set(array, "length", ToUint32(len), false).
|
||||
_singletons.Properties.Set(realm, array, "length", new _index.NumberValue(realm, nextIndex), false);
|
||||
|
||||
// 5. NOTE: The above Set cannot fail because of the nature of the object returned by ArrayCreate.
|
||||
|
||||
// 6. Return array.
|
||||
return array;
|
||||
};
|
||||
|
||||
var _index = require("../values/index.js");
|
||||
|
||||
var _index2 = require("../methods/index.js");
|
||||
|
||||
var _invariant = require("../invariant.js");
|
||||
|
||||
var _invariant2 = _interopRequireDefault(_invariant);
|
||||
|
||||
var _iterator = require("../methods/iterator.js");
|
||||
|
||||
var _singletons = require("../singletons.js");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
//# sourceMappingURL=ArrayExpression.js.map
|
||||
1
build/node_modules/prepack/lib/evaluators/ArrayExpression.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/evaluators/ArrayExpression.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
45
build/node_modules/prepack/lib/evaluators/ArrowFunctionExpression.js
generated
vendored
Normal file
45
build/node_modules/prepack/lib/evaluators/ArrowFunctionExpression.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = function (ast, strictCode, env, realm) {
|
||||
var ConciseBody = ast.body;
|
||||
if (ConciseBody.type !== "BlockStatement") {
|
||||
ConciseBody = t.blockStatement([t.returnStatement(ConciseBody)]);
|
||||
// Use original array function's location for the new concise body.
|
||||
ConciseBody.loc = ast.body.loc;
|
||||
}
|
||||
|
||||
// 1. If the function code for this ArrowFunction is strict mode code, let strict be true. Otherwise let strict be false.
|
||||
var strict = strictCode || (0, _strict2.default)(ast.body);
|
||||
|
||||
// 2. Let scope be the LexicalEnvironment of the running execution context.
|
||||
var scope = env;
|
||||
|
||||
// 3. Let parameters be CoveredFormalsList of ArrowParameters.
|
||||
var parameters = ast.params;
|
||||
|
||||
// 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).
|
||||
var closure = _singletons.Functions.FunctionCreate(realm, "arrow", parameters, ConciseBody, scope, strict);
|
||||
closure.loc = ast.loc;
|
||||
|
||||
// 5. Return closure.
|
||||
return closure;
|
||||
};
|
||||
|
||||
var _singletons = require("../singletons.js");
|
||||
|
||||
var _strict = require("../utils/strict.js");
|
||||
|
||||
var _strict2 = _interopRequireDefault(_strict);
|
||||
|
||||
var _babelTypes = require("babel-types");
|
||||
|
||||
var t = _interopRequireWildcard(_babelTypes);
|
||||
|
||||
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 }; }
|
||||
//# sourceMappingURL=ArrowFunctionExpression.js.map
|
||||
1
build/node_modules/prepack/lib/evaluators/ArrowFunctionExpression.js.map
generated
vendored
Normal file
1
build/node_modules/prepack/lib/evaluators/ArrowFunctionExpression.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/evaluators/ArrowFunctionExpression.js"],"names":["ast","strictCode","env","realm","ConciseBody","body","type","t","blockStatement","returnStatement","loc","strict","scope","parameters","params","closure","FunctionCreate"],"mappings":";;;;;;kBAoBe,UACbA,GADa,EAEbC,UAFa,EAGbC,GAHa,EAIbC,KAJa,EAKN;AACP,MAAIC,cAAcJ,IAAIK,IAAtB;AACA,MAAID,YAAYE,IAAZ,KAAqB,gBAAzB,EAA2C;AACzCF,kBAAcG,EAAEC,cAAF,CAAiB,CAACD,EAAEE,eAAF,CAAkBL,WAAlB,CAAD,CAAjB,CAAd;AACA;AACAA,gBAAYM,GAAZ,GAAkBV,IAAIK,IAAJ,CAASK,GAA3B;AACD;;AAED;AACA,MAAIC,SAASV,cAAc,sBAASD,IAAIK,IAAb,CAA3B;;AAEA;AACA,MAAIO,QAAQV,GAAZ;;AAEA;AACA,MAAIW,aAAab,IAAIc,MAArB;;AAEA;AACA,MAAIC,UAAU,sBAAUC,cAAV,CAAyBb,KAAzB,EAAgC,OAAhC,EAAyCU,UAAzC,EAAqDT,WAArD,EAAkEQ,KAAlE,EAAyED,MAAzE,CAAd;AACAI,UAAQL,GAAR,GAAcV,IAAIU,GAAlB;;AAEA;AACA,SAAOK,OAAP;AACD,C;;AAlCD;;AACA;;;;AACA;;IAAYR,C","file":"ArrowFunctionExpression.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 { Realm } from \"../realm.js\";\nimport type { LexicalEnvironment } from \"../environment.js\";\nimport type { Value } from \"../values/index.js\";\nimport { Functions } from \"../singletons.js\";\nimport IsStrict from \"../utils/strict.js\";\nimport * as t from \"babel-types\";\nimport type { BabelNodeArrowFunctionExpression } from \"babel-types\";\n\n// ECMA262 14.2.16\nexport default function(\n ast: BabelNodeArrowFunctionExpression,\n strictCode: boolean,\n env: LexicalEnvironment,\n realm: Realm\n): Value {\n let ConciseBody = ast.body;\n if (ConciseBody.type !== \"BlockStatement\") {\n ConciseBody = t.blockStatement([t.returnStatement(ConciseBody)]);\n // Use original array function's location for the new concise body.\n ConciseBody.loc = ast.body.loc;\n }\n\n // 1. If the function code for this ArrowFunction is strict mode code, let strict be true. Otherwise let strict be false.\n let strict = strictCode || IsStrict(ast.body);\n\n // 2. Let scope be the LexicalEnvironment of the running execution context.\n let scope = env;\n\n // 3. Let parameters be CoveredFormalsList of ArrowParameters.\n let parameters = ast.params;\n\n // 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict).\n let closure = Functions.FunctionCreate(realm, \"arrow\", parameters, ConciseBody, scope, strict);\n closure.loc = ast.loc;\n\n // 5. Return closure.\n return closure;\n}\n"]}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user