Next Iteration
This commit is contained in:
23
shared/package.json
Normal file
23
shared/package.json
Normal 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
39
shared/src/contract.ts
Normal 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
1
shared/src/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./contract";
|
||||
16
shared/tsconfig.json
Normal file
16
shared/tsconfig.json
Normal 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/**/*"]
|
||||
}
|
||||
Reference in New Issue
Block a user