first commit

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

View File

@@ -0,0 +1,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