diff --git a/typescript/Makefile b/typescript/Makefile index 3e83df3..dcbb569 100644 --- a/typescript/Makefile +++ b/typescript/Makefile @@ -1,4 +1,5 @@ all: + tsc tsc -d r2pipe/index.ts # tsc tsc test-spawn.ts diff --git a/typescript/package.json b/typescript/package.json index 46d5844..2635664 100644 --- a/typescript/package.json +++ b/typescript/package.json @@ -1,6 +1,6 @@ { "name": "r2pipe-ts", - "version": "0.1.0", + "version": "0.1.1", "description": "TypeScript r2pipe API", "type": "commonjs", "main": "./r2pipe/index.js", @@ -18,10 +18,14 @@ }, "files": [ "README.md", - "r2pipe/base.js", - "r2pipe/index.js", - "r2pipe/http.js", - "r2pipe/spawn.js" + "package.json", + "package-lock.json", + "dist/base.js", + "dist/index.js", + "dist/http.js", + "dist/queue.js", + "dist/local.js", + "dist/spawn.js" ], "keywords": [ "radare", diff --git a/typescript/r2pipe/local.ts b/typescript/r2pipe/local.ts index 07d9d13..3f31fa3 100644 --- a/typescript/r2pipe/local.ts +++ b/typescript/r2pipe/local.ts @@ -15,8 +15,13 @@ export class R2PipeLocal extends R2PipeBase { // TODO: we just need the read and write methods, but net.Socket doesnt have path or close() this.stream = new R2PipeQueue(client, client); } else { - const IN = parseInt(process.env.R2PIPE_IN); - const OUT = parseInt(process.env.R2PIPE_OUT); + const envIn = process.env.R2PIPE_IN; + const envOut = process.env.R2PIPE_OUT; + if (!envIn || !envOut) { + throw new Error('This script must be executed from r2 -c "#!pipe node foo.js"'); + } + const IN = parseInt(envIn); + const OUT = parseInt(envOut); if (!IN || !OUT) { throw new Error('This script must be executed from r2 -c "#!pipe node foo.js"'); } diff --git a/typescript/test-http.ts b/typescript/test-http.ts index 58bad6f..8f4377f 100644 --- a/typescript/test-http.ts +++ b/typescript/test-http.ts @@ -1,7 +1,7 @@ // tsc test-http.ts // node --insecure-http-parser test-http.js -import * as r2pipe from "./r2pipe/index.js"; +import * as r2pipe from "./dist/index.js"; // import * as r2pipe from "r2pipe-ts"; async function main() { diff --git a/typescript/test-local.ts b/typescript/test-local.ts index 091a604..9ba1677 100644 --- a/typescript/test-local.ts +++ b/typescript/test-local.ts @@ -1,4 +1,4 @@ -import * as r2pipe from "./r2pipe/index.js"; +import * as r2pipe from "./dist/index.js"; // import * as r2pipe from "r2pipe-ts"; async function main() { diff --git a/typescript/test-spawn.ts b/typescript/test-spawn.ts index 0690400..f1bb6bd 100644 --- a/typescript/test-spawn.ts +++ b/typescript/test-spawn.ts @@ -1,4 +1,4 @@ -import * as r2pipe from "./r2pipe/index.js"; +import * as r2pipe from "./dist/index.js"; // import * as r2pipe from "r2pipe-ts"; async function main() { diff --git a/typescript/tsconfig.json b/typescript/tsconfig.json index e70f254..9745dc2 100644 --- a/typescript/tsconfig.json +++ b/typescript/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "baseUrl": "r2pipe", "moduleResolution": "nodenext", - "target": "esnext", + "target": "es5", "esModuleInterop": true, "resolveJsonModule": true, "module": "commonjs", @@ -10,7 +10,8 @@ "declaration": true, "strict": false, "skipLibCheck": true, - "outDir": "./dist" + "outDir": "./dist", + "rootDir": "./r2pipe" }, "paths": { "*": ["node_modules/*", "src/types/*"]