* Updates Dependencies
* Uses webpack to bundle runtime library into a single file * Inject the entire file into the Debugee * Register runtime helpers (hediet_dbgVis)
This commit is contained in:
@@ -64,13 +64,14 @@
|
||||
"crypto-random-string": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^4.17.0",
|
||||
"@types/serve-static": "^1.13.2",
|
||||
"@types/node": "^12.6.8",
|
||||
"@types/vscode": "1.35.0",
|
||||
"tslint": "^5.18.0",
|
||||
"typescript": "^3.5.3",
|
||||
"webpack": "^4.38.0",
|
||||
"webpack-cli": "^3.3.6"
|
||||
"@types/express": "^4.17.2",
|
||||
"@types/serve-static": "^1.13.3",
|
||||
"@types/node": "^13.7.1",
|
||||
"@types/vscode": "1.42.0",
|
||||
"tslint": "^6.0.0",
|
||||
"typescript": "^3.7.5",
|
||||
"webpack": "^4.41.6",
|
||||
"webpack-cli": "^3.3.11",
|
||||
"ts-loader": "^6.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,11 @@ import {
|
||||
import { observable, autorun, action } from "mobx";
|
||||
import { Disposable } from "@hediet/std/disposable";
|
||||
import {
|
||||
selfContainedGetInitializedDataExtractorApi,
|
||||
getExpressionForDataExtractorApi,
|
||||
DataResult,
|
||||
DataExtractorId,
|
||||
ApiHasNotBeenInitializedCode,
|
||||
selfContainedInitDataExtractorApi,
|
||||
TypeScriptAstDataExtractor,
|
||||
AsIsDataExtractor,
|
||||
GetDebugVisualizationDataExtractor,
|
||||
getExpressionToInitializeDataExtractorApi,
|
||||
} from "@hediet/debug-visualizer-data-extraction";
|
||||
import {
|
||||
DataExtractionState,
|
||||
@@ -100,14 +97,30 @@ export class JsDebuggerSourceImplementation implements JsDataSource {
|
||||
|
||||
try {
|
||||
w._state = { kind: "loading" };
|
||||
const fnSrc = selfContainedGetInitializedDataExtractorApi.toString();
|
||||
|
||||
const preferredExtractor = w.preferredDataExtractor
|
||||
? `"${w.preferredDataExtractor}"`
|
||||
: "undefined";
|
||||
|
||||
const body = `(${fnSrc})().getData(${w.expression}, expr => eval(expr), ${preferredExtractor})`;
|
||||
const expression = `(() => { try { return ${body}; } catch (e) { return JSON.stringify({ kind: "Error", message: e.message, stack: e.stack }); } })()`;
|
||||
const body = `${getExpressionForDataExtractorApi()}.getData(
|
||||
${w.expression},
|
||||
expr => eval(expr),
|
||||
${preferredExtractor}
|
||||
)`;
|
||||
|
||||
const expression = `
|
||||
(() => {
|
||||
try {
|
||||
return ${body};
|
||||
} catch (e) {
|
||||
return JSON.stringify({
|
||||
kind: "Error",
|
||||
message: e.message,
|
||||
stack: e.stack
|
||||
});
|
||||
}
|
||||
})()
|
||||
`;
|
||||
|
||||
const reply = await session.evaluate({
|
||||
expression,
|
||||
@@ -147,24 +160,14 @@ export class JsDebuggerSourceImplementation implements JsDataSource {
|
||||
frameId: number | undefined
|
||||
): Promise<boolean> {
|
||||
try {
|
||||
let expression = `(${selfContainedInitDataExtractorApi.toString()})();`;
|
||||
// prefer existing is true, so that manually registered (possibly newer) extractors are not overwritten.
|
||||
const expression = `${getExpressionToInitializeDataExtractorApi()}.registerDefaultExtractors(true);`;
|
||||
|
||||
const es = [
|
||||
TypeScriptAstDataExtractor,
|
||||
AsIsDataExtractor,
|
||||
GetDebugVisualizationDataExtractor,
|
||||
].map(e => `new (${e.toString()})()`);
|
||||
expression += `(${selfContainedGetInitializedDataExtractorApi.toString()})()`;
|
||||
// prefer existing is true, so that manually registered extractors are not overwritten.
|
||||
expression += `.registerExtractors([${es.join(",")}], true)`;
|
||||
|
||||
const reply = await session.evaluate({
|
||||
await session.evaluate({
|
||||
expression,
|
||||
frameId,
|
||||
});
|
||||
if (reply.result === "true") {
|
||||
// register extractors
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
return false;
|
||||
|
||||
@@ -28,26 +28,26 @@
|
||||
"vis-data": "^6.3.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/classnames": "^2.2.8",
|
||||
"@types/react": "^16.8.21",
|
||||
"@types/react-dom": "^16.8.4",
|
||||
"@types/classnames": "^2.2.9",
|
||||
"@types/react": "^16.9.19",
|
||||
"@types/react-dom": "^16.9.5",
|
||||
"@types/line-column": "^1.0.0",
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"css-loader": "^3.0.0",
|
||||
"file-loader": "^4.0.0",
|
||||
"fork-ts-checker-webpack-plugin": "^1.4.2",
|
||||
"css-loader": "^3.4.2",
|
||||
"file-loader": "^5.0.2",
|
||||
"fork-ts-checker-webpack-plugin": "^4.0.3",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
"monaco-editor-webpack-plugin": "^1.7.0",
|
||||
"node-sass": "^4.12.0",
|
||||
"raw-loader": "^3.0.0",
|
||||
"sass": "^1.20.1",
|
||||
"sass-loader": "^7.1.0",
|
||||
"style-loader": "^0.23.1",
|
||||
"ts-loader": "^6.0.3",
|
||||
"ts-node": "^8.3.0",
|
||||
"typescript": "^3.5.2",
|
||||
"webpack": "^4.35.0",
|
||||
"webpack-cli": "^3.3.4",
|
||||
"webpack-dev-server": "^3.7.2"
|
||||
"monaco-editor-webpack-plugin": "^1.8.2",
|
||||
"node-sass": "^4.13.1",
|
||||
"raw-loader": "^4.0.0",
|
||||
"sass": "^1.25.0",
|
||||
"sass-loader": "^8.0.2",
|
||||
"style-loader": "^1.1.3",
|
||||
"ts-loader": "^6.2.1",
|
||||
"ts-node": "^8.6.2",
|
||||
"typescript": "^3.7.5",
|
||||
"webpack": "^4.41.6",
|
||||
"webpack-cli": "^3.3.11",
|
||||
"webpack-dev-server": "^3.10.3"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user