Clean up repo layout

This commit is contained in:
Tony Garnock-Jones 2021-03-02 13:53:33 +01:00
parent d9a1480bad
commit b6473eee6d
17 changed files with 18 additions and 19 deletions

View File

@ -5,5 +5,10 @@
}, },
"dependencies": { "dependencies": {
"preserves": "^0.6.0" "preserves": "^0.6.0"
},
"scripts": {
"compile": "npx tsc",
"compile:watch": "npx tsc -w",
"clean": "rm -rf lib"
} }
} }

View File

View File

View File

@ -4,12 +4,13 @@ import { Dataspace, Observe } from './dataspace.js';
import { Worker } from 'worker_threads'; import { Worker } from 'worker_threads';
import { Relay, spawnRelay } from './relay.js'; import { Relay, spawnRelay } from './relay.js';
import { BoxState, SetBox } from './box-protocol.js'; import { BoxState, SetBox } from './box-protocol.js';
import path from 'path';
const Instance = Record.makeConstructor<{moduleName: string, arg: Assertion}>()( const Instance = Record.makeConstructor<{moduleName: string, arg: Assertion}>()(
Symbol.for('Instance'), ['moduleName', 'arg']); Symbol.for('Instance'), ['moduleName', 'arg']);
function spawnWorker(t: Turn, moduleName: string, arg: Assertion) { function spawnWorker(t: Turn, moduleName: string, arg: Assertion) {
const w = new Worker('./wload.js'); const w = new Worker(path.join(__dirname, 'wload.js'));
spawnRelay(t, { spawnRelay(t, {
packetWriter: bs => w.postMessage(bs), packetWriter: bs => w.postMessage(bs),
setup(t: Turn, r: Relay) { setup(t: Turn, r: Relay) {
@ -60,11 +61,12 @@ Turn.for(new Actor(), async (t: Turn) => {
[0, Lit(BoxState.constructorInfo.label)]])))); [0, Lit(BoxState.constructorInfo.label)]]))));
// spawnModule(t, './box.js', [ds, 500000, 25000]); const boxpath = path.join(__dirname, 'box.js');
spawnWorker(t, './box.js', [ds_for_box, 50000, 2500]); const clientpath = path.join(__dirname, 'client.js');
// spawnModule(t, './client.js', ds_for_client);
spawnWorker(t, './client.js', ds_for_client);
spawnModule(t, boxpath, [ds, 500000, 25000]);
// spawnWorker(t, boxpath, [ds_for_box, 50000, 2500]);
spawnModule(t, clientpath, ds_for_client);
// spawnWorker(t, clientpath, ds_for_client);
}); });

7
t.ts
View File

@ -1,7 +0,0 @@
import { Assertion, Turn } from './actor';
console.log('hi')
export default function (_t: Turn, arg: Assertion) {
console.log('in exported main', arg);
}

View File

@ -3,16 +3,15 @@
"target": "es2017", "target": "es2017",
"lib": ["es2017", "dom"], "lib": ["es2017", "dom"],
"declaration": true, "declaration": true,
"baseUrl": ".", "baseUrl": "./src",
"rootDir": ".", "rootDir": "./src",
"outDir": ".", "outDir": "./lib",
"declarationDir": ".", "declarationDir": "./lib",
"esModuleInterop": true, "esModuleInterop": true,
"moduleResolution": "node", "moduleResolution": "node",
"module": "commonjs", "module": "commonjs",
"sourceMap": true, "sourceMap": true,
"strict": true "strict": true
}, },
"include": ["**/*.ts"], "include": ["src/**/*.ts"]
"exclude": []
} }