@rg-dev/electron-helpers 1.0.1 → 1.0.3

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/dist/client.cjs CHANGED
@@ -34,12 +34,6 @@ var defineIpcCommands = () => null;
34
34
  var defineIpcEvents = () => null;
35
35
  var IpcClient = class _IpcClient {
36
36
  ipc;
37
- /**
38
- * const client = IpcClient.create(globalThis.ipc, {
39
- * commands: defineIpcCommands<{ wow: () => string }>(),
40
- * events: defineIpcEvents<{ message: (content: string) => void }>(),
41
- * })
42
- */
43
37
  static create(electronIpc, _shape) {
44
38
  const client = new _IpcClient();
45
39
  client.ipc = electronIpc;
package/dist/client.d.cts CHANGED
@@ -14,26 +14,10 @@ type CommandMap = Record<string, (...args: any[]) => IpcResponse<any>>;
14
14
  type IpcResponseType<Commands extends CommandMap, cmd extends keyof Commands> = Promise<NonNullable<ReturnType<Commands[cmd]> extends infer R ? R extends {
15
15
  _content: infer T;
16
16
  } ? T : never : never>>;
17
- /**
18
- * Define commands with plain return types:
19
- *
20
- * defineIpcCommands<{ wow: () => string }>()
21
- */
22
17
  declare const defineIpcCommands: <T extends Record<string, (...args: any[]) => any>>() => { [K in keyof T]: (...args: Parameters<T[K]>) => IpcResponse<ReturnType<T[K]>>; };
23
- /**
24
- * Define events (renderer <-> main, fire-and-forget):
25
- *
26
- * defineIpcEvents<{ message: (content: string) => void }>()
27
- */
28
18
  declare const defineIpcEvents: <T extends EventMap>() => T;
29
19
  declare class IpcClient<Commands extends CommandMap, Events extends EventMap = {}> {
30
20
  private ipc;
31
- /**
32
- * const client = IpcClient.create(globalThis.ipc, {
33
- * commands: defineIpcCommands<{ wow: () => string }>(),
34
- * events: defineIpcEvents<{ message: (content: string) => void }>(),
35
- * })
36
- */
37
21
  static create<Commands extends CommandMap, Events extends EventMap = {}>(electronIpc: TypedIpcRenderer<Events, Commands>, _shape: {
38
22
  commands: Commands;
39
23
  events?: Events;
package/dist/client.d.ts CHANGED
@@ -14,26 +14,10 @@ type CommandMap = Record<string, (...args: any[]) => IpcResponse<any>>;
14
14
  type IpcResponseType<Commands extends CommandMap, cmd extends keyof Commands> = Promise<NonNullable<ReturnType<Commands[cmd]> extends infer R ? R extends {
15
15
  _content: infer T;
16
16
  } ? T : never : never>>;
17
- /**
18
- * Define commands with plain return types:
19
- *
20
- * defineIpcCommands<{ wow: () => string }>()
21
- */
22
17
  declare const defineIpcCommands: <T extends Record<string, (...args: any[]) => any>>() => { [K in keyof T]: (...args: Parameters<T[K]>) => IpcResponse<ReturnType<T[K]>>; };
23
- /**
24
- * Define events (renderer <-> main, fire-and-forget):
25
- *
26
- * defineIpcEvents<{ message: (content: string) => void }>()
27
- */
28
18
  declare const defineIpcEvents: <T extends EventMap>() => T;
29
19
  declare class IpcClient<Commands extends CommandMap, Events extends EventMap = {}> {
30
20
  private ipc;
31
- /**
32
- * const client = IpcClient.create(globalThis.ipc, {
33
- * commands: defineIpcCommands<{ wow: () => string }>(),
34
- * events: defineIpcEvents<{ message: (content: string) => void }>(),
35
- * })
36
- */
37
21
  static create<Commands extends CommandMap, Events extends EventMap = {}>(electronIpc: TypedIpcRenderer<Events, Commands>, _shape: {
38
22
  commands: Commands;
39
23
  events?: Events;
package/dist/client.js CHANGED
@@ -6,12 +6,6 @@ var defineIpcCommands = () => null;
6
6
  var defineIpcEvents = () => null;
7
7
  var IpcClient = class _IpcClient {
8
8
  ipc;
9
- /**
10
- * const client = IpcClient.create(globalThis.ipc, {
11
- * commands: defineIpcCommands<{ wow: () => string }>(),
12
- * events: defineIpcEvents<{ message: (content: string) => void }>(),
13
- * })
14
- */
15
9
  static create(electronIpc, _shape) {
16
10
  const client = new _IpcClient();
17
11
  client.ipc = electronIpc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rg-dev/electron-helpers",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "tsup && node dist/index.cjs",
@@ -12,24 +12,34 @@
12
12
  "files": [
13
13
  "dist"
14
14
  ],
15
- "publishConfig": {
16
- "access": "public"
15
+ "publishConfig": {
16
+ "access": "public"
17
17
  },
18
18
  "module": "./dist/index.js",
19
19
  "types": "./dist/index.d.ts",
20
20
  "type": "module",
21
+ "typesVersions": {
22
+ "*": {
23
+ "dist/backend": [
24
+ "dist/backend.d.ts"
25
+ ],
26
+ "dist/client": [
27
+ "dist/client.d.ts"
28
+ ]
29
+ }
30
+ },
21
31
  "exports": {
22
- ".": {
23
- "import": "./dist/index.js",
24
- "require": "./dist/index.cjs"
32
+ ".": {
33
+ "import": "./dist/index.js",
34
+ "require": "./dist/index.cjs"
25
35
  },
26
- "./dist/client": {
27
- "import": "./dist/client.js",
28
- "require": "./dist/client.cjs"
36
+ "./dist/client": {
37
+ "import": "./dist/client.js",
38
+ "require": "./dist/client.cjs"
29
39
  },
30
- "./dist/backend": {
31
- "import": "./dist/backend.js",
32
- "require": "./dist/backend.cjs"
40
+ "./dist/backend": {
41
+ "import": "./dist/backend.js",
42
+ "require": "./dist/backend.cjs"
33
43
  }
34
44
  },
35
45
  "devDependencies": {