Next Iteration

This commit is contained in:
Henning Dieterichs
2019-07-31 11:41:10 +02:00
parent 6175e8f55e
commit 922eb0b845
71 changed files with 19606 additions and 14862 deletions

23
shared/package.json Normal file
View File

@@ -0,0 +1,23 @@
{
"name": "@hediet/debug-visualizer-vscode-shared",
"private": true,
"version": "1.0.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"author": {
"name": "Henning Dieterichs",
"email": "henning.dieterichs@live.de"
},
"license": "MIT",
"files": [
"dist",
"src"
],
"scripts": {
"dev": "tsc --watch"
},
"dependencies": {
"@hediet/std": "^0.6.0",
"@hediet/typed-json-rpc": "^0.7.7"
}
}

39
shared/src/contract.ts Normal file
View File

@@ -0,0 +1,39 @@
import { contract, notificationContract, types } from "@hediet/typed-json-rpc";
import { DataExtractionResult } from "@hediet/debug-visualizer-data-extraction";
function unchecked<T>(): types.Type<T, T, unknown> {
return new types.Type<T, T, unknown>(
"unchecked",
(u): u is T => true,
value => types.success(value as T),
value => value
);
}
export type DataExtractionState =
| { kind: "loading" }
| { kind: "error"; message: string }
| { kind: "noDebugSession" }
| {
kind: "data";
result: DataExtractionResult;
};
export const debugVisualizerUIContract = contract({
client: {
updateState: notificationContract({
params: types.type({
newState: unchecked<DataExtractionState>(),
}),
}),
},
server: {
setExpression: notificationContract({
params: types.type({
newExpression: types.string,
}),
}),
refresh: notificationContract({}),
openInBrowser: notificationContract({}),
},
});

1
shared/src/index.ts Normal file
View File

@@ -0,0 +1 @@
export * from "./contract";

16
shared/tsconfig.json Normal file
View File

@@ -0,0 +1,16 @@
{
"compilerOptions": {
"target": "esnext",
"module": "commonjs",
"strict": true,
"outDir": "dist",
"skipLibCheck": true,
"rootDir": "./src",
"resolveJsonModule": true,
"declaration": true,
"declarationMap": true,
"newLine": "LF",
"sourceMap": true
},
"include": ["./src/**/*"]
}