From db133946609477f94365724a5a7ca212cacdbd2d Mon Sep 17 00:00:00 2001 From: Dani Guardiola Date: Thu, 29 Feb 2024 00:20:11 +0100 Subject: [PATCH] Publish CJS (#19) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] --- .changeset/violet-candles-brush.md | 5 +++++ README.md | 9 +++++--- bun.lockb | Bin 182914 -> 182868 bytes package.json | 32 +++++++++++++++++------------ 4 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 .changeset/violet-candles-brush.md diff --git a/.changeset/violet-candles-brush.md b/.changeset/violet-candles-brush.md new file mode 100644 index 0000000..6a10371 --- /dev/null +++ b/.changeset/violet-candles-brush.md @@ -0,0 +1,5 @@ +--- +"rpc-anywhere": minor +--- + +Publish CJS version. diff --git a/README.md b/README.md index d12dc2d..6c6b3eb 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,8 @@ Create a type-safe RPC anywhere. npm i rpc-anywhere ``` +[✨ Interactive demo ✨](https://rpc-anywhere.dio.la/) + --- RPC Anywhere lets you create RPCs in **any** context, as long as a transport layer is provided. In other words: a way for messages to get from point A to point B and vice-versa. @@ -89,9 +91,10 @@ It also ships with a few transports: iframes, Electron, browser extensions, work - Message ports: `window`, iframes, workers, broadcast channels, etc. - Browser extensions: content scripts ↔ service worker. - Electron IPC (coming soon). +- Tiny (~1kb gzipped). - Flexible (no enforced client-server architecture). -- Promise-based with optional proxy APIs (e.g. `rpc.requestName(params)`). -- Infers schema type from runtime request handlers. +- Promise-based with optional proxy APIs (e.g. `proxy.requestName(params)`). +- Schema type can be inferred from the request handlers. - Optional lazy initialization (e.g. `rpc.setTransport(transport)`). ## Getting started @@ -237,7 +240,7 @@ Start with [RPC](./docs/1-rpc.md), then read about your transport of choice on t The API reference is available at [tsdocs.dev](https://tsdocs.dev/docs/rpc-anywhere/). -**This package is ESM-only at the moment.** File an issue if this is a problem for you. +**This package is published as both ESM and CommonJS.** ## Type safety and features diff --git a/bun.lock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