@bigmistqke/rpc 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigmistqke/rpc",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "type": "module",
5
5
  "description": "RPC toolkit for type-safe communication across Workers, iframes, and network boundaries.",
6
6
  "module": "./dist/index.js",
@@ -27,13 +27,6 @@
27
27
  "types": "./dist/fetch-node.d.ts"
28
28
  }
29
29
  },
30
- "scripts": {
31
- "build": "tsup",
32
- "test": "vitest run",
33
- "types": "pnpm exec tsc --noEmit",
34
- "bump": "bumpp",
35
- "prepublishOnly": "pnpm test && pnpm build"
36
- },
37
30
  "license": "MIT",
38
31
  "devDependencies": {
39
32
  "tsup": "6.6.3",
@@ -44,5 +37,11 @@
44
37
  "@types/node": "^22.15.30",
45
38
  "bumpp": "^10.3.2",
46
39
  "valibot": "^1.0.0"
40
+ },
41
+ "scripts": {
42
+ "build": "tsup",
43
+ "test": "vitest run",
44
+ "types": "pnpm exec tsc --noEmit",
45
+ "bump": "bumpp"
47
46
  }
48
- }
47
+ }
package/src/core.ts CHANGED
@@ -9,7 +9,7 @@ export function createCommander<T extends object = object>(
9
9
  topics: Array<string>,
10
10
  apply: (topics: Array<string>, args: Array<any>) => void,
11
11
  ): T {
12
- return new Proxy(function () {} as T, {
12
+ return new Proxy(function () { } as T, {
13
13
  get(target, topic) {
14
14
  if (typeof topic === 'symbol') return (target as any)[topic]
15
15
  // Return undefined for 'then' so proxy isn't treated as thenable
@@ -32,7 +32,7 @@ export function callMethod(methods: object, topics: string[], args: unknown[]) {
32
32
  if (typeof method !== 'function') {
33
33
  throw new Error(`Topics did not resolve to a function: [${topics.join(',')}]`)
34
34
  }
35
- return method(...args)
35
+ return method.call(methods, ...args)
36
36
  }
37
37
 
38
38
  /**
@@ -10,7 +10,9 @@ import {
10
10
  } from '../protocol'
11
11
  import type { RPC } from '../types'
12
12
  import { createIdRegistry, defer } from '../utils'
13
+
13
14
  export { handle, type Handled } from '../handle'
15
+ export type { RPC } from '../types'
14
16
 
15
17
  export const $TRANSFER = 'RPC-TRANSFER'
16
18
  export const $MESSENGER = Symbol.for('RPC-MESSENGER')