From 6fb7447636592c6b2f0c8ced4562f29fd133884e Mon Sep 17 00:00:00 2001 From: Mattijs Fuijkschot Date: Tue, 30 May 2023 14:51:18 +0200 Subject: [PATCH] chore: added TangoRPC / createWebViewChannel --- package.json | 2 +- rollup.config.mjs | 2 +- src/index.tsx | 9 +++++++++ .../tango-rpc-webview-script.ts | 0 tsconfig.json | 2 +- tsconfig.tango-rpc.json | 2 +- 6 files changed, 13 insertions(+), 4 deletions(-) rename {tango-rpc-webview-script => src}/tango-rpc-webview-script.ts (100%) diff --git a/package.json b/package.json index 2ab7659..5552766 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "example": "yarn --cwd example", "bootstrap": "yarn example && yarn install", "build-webview-script": "rollup -c rollup.config.mjs", - "watch-webview-script": "npx nodemon -i dist -w tango-rpc-webview-script/tango-rpc-webview-script.ts rollup -c rollup.config.mjs" + "watch-webview-script": "npx nodemon -i dist -w src/tango-rpc-webview-script.ts rollup -c rollup.config.mjs" }, "keywords": [ "react-native", diff --git a/rollup.config.mjs b/rollup.config.mjs index ab17698..a0643ec 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -9,7 +9,7 @@ function config({ format, minify, input, file }) { const isJSON = file.endsWith("json") const sourcemap = !isJSON return { - input: `./tango-rpc-webview-script/${input}.ts`, + input: `./src/${input}.ts`, output: { name: "TangoRPC", file: file, diff --git a/src/index.tsx b/src/index.tsx index a258d06..781bc88 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,5 +1,14 @@ import TangoWebview from "./tango-webview" +import { createWebViewChannel } from "./tango-rpc-webview-script" + +import * as _TangoRPC from "tango-rpc" + export * from "./tango-webview" +export const TangoRPC = { + ..._TangoRPC, + createWebViewChannel, +} + export default TangoWebview diff --git a/tango-rpc-webview-script/tango-rpc-webview-script.ts b/src/tango-rpc-webview-script.ts similarity index 100% rename from tango-rpc-webview-script/tango-rpc-webview-script.ts rename to src/tango-rpc-webview-script.ts diff --git a/tsconfig.json b/tsconfig.json index 5168ea2..70e4188 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -25,5 +25,5 @@ "target": "esnext", "verbatimModuleSyntax": true, }, - "exclude": ["dist", "tango-rpc-webview-script"] + "exclude": ["dist"] } diff --git a/tsconfig.tango-rpc.json b/tsconfig.tango-rpc.json index 1aa0860..eba580b 100644 --- a/tsconfig.tango-rpc.json +++ b/tsconfig.tango-rpc.json @@ -10,5 +10,5 @@ "sourceMap": true, "skipLibCheck":true, }, - "files": ["./tango-rpc-webview-script/tango-rpc-webview-script.ts"] + "files": ["./src/tango-rpc-webview-script.ts"] } \ No newline at end of file