From 955a6da7c0cd981c2d4e57a588800595ad14bc39 Mon Sep 17 00:00:00 2001 From: pancake Date: Tue, 16 May 2023 12:01:27 +0200 Subject: [PATCH] Skeleton for the ts rewrite of r2pipe.js --- typescript/r2pipe/Makefile | 4 ++++ typescript/r2pipe/examples/hello/Makefile | 7 ++++++ typescript/r2pipe/examples/hello/index.ts | 4 ++++ typescript/r2pipe/examples/hello/package.json | 23 +++++++++++++++++++ .../r2pipe/examples/hello/tsconfig.json | 20 ++++++++++++++++ typescript/r2pipe/package.json | 22 ++++++++++++++++++ typescript/r2pipe/tsconfig.json | 15 ++++++++++++ 7 files changed, 95 insertions(+) create mode 100644 typescript/r2pipe/Makefile create mode 100644 typescript/r2pipe/examples/hello/Makefile create mode 100644 typescript/r2pipe/examples/hello/index.ts create mode 100644 typescript/r2pipe/examples/hello/package.json create mode 100644 typescript/r2pipe/examples/hello/tsconfig.json create mode 100644 typescript/r2pipe/package.json create mode 100644 typescript/r2pipe/tsconfig.json diff --git a/typescript/r2pipe/Makefile b/typescript/r2pipe/Makefile new file mode 100644 index 0000000..8deaaef --- /dev/null +++ b/typescript/r2pipe/Makefile @@ -0,0 +1,4 @@ +all: + tsc -d index.ts + tsc + make -C examples/hello diff --git a/typescript/r2pipe/examples/hello/Makefile b/typescript/r2pipe/examples/hello/Makefile new file mode 100644 index 0000000..2baaeff --- /dev/null +++ b/typescript/r2pipe/examples/hello/Makefile @@ -0,0 +1,7 @@ +all: + rm -f r2pipe + ln -fs ../.. r2pipe + r2frida-compile -So index.r2.js index.ts + r2 -qi index.r2.js - + tsc index.ts + r2 -qi index.js - diff --git a/typescript/r2pipe/examples/hello/index.ts b/typescript/r2pipe/examples/hello/index.ts new file mode 100644 index 0000000..b71d22f --- /dev/null +++ b/typescript/r2pipe/examples/hello/index.ts @@ -0,0 +1,4 @@ +import * as r2pipe from "@r2pipe"; + +const r2 = r2pipe.open(); +console.log(r2.cmd("?e hello")); diff --git a/typescript/r2pipe/examples/hello/package.json b/typescript/r2pipe/examples/hello/package.json new file mode 100644 index 0000000..197cf4a --- /dev/null +++ b/typescript/r2pipe/examples/hello/package.json @@ -0,0 +1,23 @@ +{ + "name": "r2pipe-example-hello", + "version": "0.0.1", + "description": "example using the new r2pipe", + "type": "module", + "main": "./index.js", + "types": "./index.d.js", + "license": "LGPL-3.0", + "module": "es2020", + "engines": { + "node": ">=14.16" + }, + "devDependencies": { + "@frida/events": "^4.0.4", + "@types/frida-gum": "^18.3.1", + "@types/node": "^18.0.0", + "@typescript-eslint/eslint-plugin": "^5.51.0", + "@typescript-eslint/parser": "^5.51.0", + "eslint": "^8.34.0", + "frida-compile": "^16.1.5", + "typescript": "^5.0.0" + } +} diff --git a/typescript/r2pipe/examples/hello/tsconfig.json b/typescript/r2pipe/examples/hello/tsconfig.json new file mode 100644 index 0000000..4013e83 --- /dev/null +++ b/typescript/r2pipe/examples/hello/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "target": "es6", + "module": "esnext", + "lib": ["es6"], + "declaration": true, + "esModuleInterop": true, + "moduleResolution": "nodenext", + "strict": true, + "skipLibCheck": true, + "outDir": "./dist", + "paths": { + "@r2pipe": ["./r2pipe/index.js"] + } + }, + "include": [ + "index.ts" + ] +} diff --git a/typescript/r2pipe/package.json b/typescript/r2pipe/package.json new file mode 100644 index 0000000..7d2598b --- /dev/null +++ b/typescript/r2pipe/package.json @@ -0,0 +1,22 @@ +{ + "name": "r2pipe-example-hello", + "version": "0.0.6", + "description": "example using the new r2pipe", + "type": "module", + "main": "./index.js", + "types": "./index.d.js", + "license": "LGPL-3.0", + "engines": { + "node": ">=14.16" + }, + "devDependencies": { + "@frida/events": "^4.0.4", + "@types/frida-gum": "^18.3.1", + "@types/node": "^18.0.0", + "@typescript-eslint/eslint-plugin": "^5.51.0", + "@typescript-eslint/parser": "^5.51.0", + "eslint": "^8.34.0", + "frida-compile": "^16.1.5", + "typescript": "^5.0.0" + } +} diff --git a/typescript/r2pipe/tsconfig.json b/typescript/r2pipe/tsconfig.json new file mode 100644 index 0000000..db876b1 --- /dev/null +++ b/typescript/r2pipe/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "moduleResolution": "node", + "target": "es2020", + "lib": ["es2020"], + "declaration": true, + "strict": true, + "skipLibCheck": true, + "outDir": "./dist" + }, + "include": [ + "index.ts" + ] +}