@minip2p/node 0.7.2 → 0.7.4

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.
@@ -0,0 +1,145 @@
1
+ /* auto-generated by NAPI-RS from crates/nodejs; regenerate with `pnpm native:build` */
2
+ /* eslint-disable */
3
+ import type {
4
+ NativeConnectionInfo,
5
+ NativeEvent,
6
+ NativeIdentifyInfo,
7
+ NativeKnownPeerInfo,
8
+ NativeOpenStream,
9
+ NativePathKind,
10
+ NativeRelayReservationInfo,
11
+ Reachability,
12
+ } from "./native-shape.js";
13
+
14
+ /** A native minip2p endpoint owned by Node.js. */
15
+ export declare class NodeEndpoint {
16
+ /** Binds a native endpoint without starting its driver. */
17
+ constructor(secretKey: Uint8Array, config: NodeEndpointConfig)
18
+ /** Starts the detached driver with a strong event-loop doorbell. */
19
+ start(doorbell: () => void): void
20
+ /** Requests shutdown without waiting for the driver thread. */
21
+ close(): void
22
+ /** Returns the local peer ID. */
23
+ peerId(): string
24
+ /** Returns bound peer addresses. */
25
+ listenAddrs(): Array<string>
26
+ /** Returns whether the driver accepts commands. */
27
+ isRunning(): boolean
28
+ /** Pulls a bounded batch of native events. */
29
+ drainEvents(limit: number): Array<NativeEvent>
30
+ /** Returns connected peer IDs. */
31
+ connectedPeers(): Array<string>
32
+ /** Returns whether Identify completed for a peer. */
33
+ isPeerReady(peerId: string): boolean
34
+ /** Returns the latest Identify snapshot. */
35
+ peerInfo(peerId: string): NativeIdentifyInfo | null
36
+ /** Accepted for compatibility; has no effect, since the driver sleeps until the endpoint's next deadline. */
37
+ setActive(active: boolean): void
38
+ /** Subscribes to a pubsub topic. */
39
+ subscribe(topic: string): boolean
40
+ /** Unsubscribes from a pubsub topic. */
41
+ unsubscribe(topic: string): boolean
42
+ /** Publishes one pubsub payload. */
43
+ publish(topic: string, data: Uint8Array): void
44
+ /** Starts one ping operation. */
45
+ ping(peerId: string): void
46
+ /** Registers an application protocol. */
47
+ addProtocol(protocolId: string): void
48
+ /** Starts opening an application stream. */
49
+ openStream(peerId: string, protocolId: string): NativeOpenStream
50
+ /**
51
+ * Sends bytes on an application stream, named by its connection and
52
+ * stream ids.
53
+ */
54
+ sendStream(peerId: string, connId: bigint, streamId: bigint, data: Uint8Array): void
55
+ /** Half-closes the local stream write side. */
56
+ closeStreamWrite(peerId: string, connId: bigint, streamId: bigint): void
57
+ /** Resets an application stream. */
58
+ resetStream(peerId: string, connId: bigint, streamId: bigint): void
59
+ /** Resets and relinquishes an application stream. */
60
+ abandonStream(peerId: string, connId: bigint, streamId: bigint): void
61
+ /**
62
+ * Starts one Connection attempt: a peer ID string, or an array of
63
+ * complete peer addresses naming one peer. Returns the Connect ID.
64
+ */
65
+ connect(target: string | Array<string>): bigint
66
+ /** Cancels a connection attempt. */
67
+ cancelConnect(id: bigint): void
68
+ /** Disconnects one peer. */
69
+ disconnect(peerId: string): void
70
+ /** Returns the current path to a peer. */
71
+ path(peerId: string): NativePathKind | null
72
+ /** Returns the transport connection selected for a peer. */
73
+ connectionInfo(peerId: string): NativeConnectionInfo | null
74
+ /** Returns the discovery address book. */
75
+ knownPeers(): Array<NativeKnownPeerInfo>
76
+ /** Returns the discovery clock. */
77
+ discoveryNowMs(): bigint | null
78
+ /** Returns the current reachability verdict. */
79
+ reachability(): Reachability
80
+ /** Returns the active relay reservation. */
81
+ activeReservation(): NativeRelayReservationInfo | null
82
+ }
83
+
84
+ /** Builds a circuit address through a direct relay address. */
85
+ export declare function circuitAddress(relayAddress: string, peerId: string): string
86
+
87
+ /** Generates a 32-byte Ed25519 secret key. */
88
+ export declare function generateSecretKey(): Uint8Array
89
+
90
+ /** Signed-discovery configuration accepted from Node.js. */
91
+ export interface NodeDiscoveryOptions {
92
+ /** Pubsub topic carrying signed beacons. */
93
+ topic: string
94
+ /** Beacon interval in milliseconds. */
95
+ beaconIntervalMs: bigint
96
+ /** Peer expiry interval in milliseconds. */
97
+ peerTtlMs: bigint
98
+ /** Whether observations may trigger dials. */
99
+ autoDial: boolean
100
+ }
101
+
102
+ /** Endpoint configuration accepted from Node.js. */
103
+ export interface NodeEndpointConfig {
104
+ /** Identify agent version. */
105
+ agentVersion?: string
106
+ /** Relay peer addresses. */
107
+ relays: Array<string>
108
+ /** AutoNAT server peer addresses. */
109
+ autonatServers: Array<string>
110
+ /** Listen multiaddresses, or the QUIC dual-stack defaults when absent. */
111
+ listen?: Array<string>
112
+ /** Whether all outbound paths must remain relayed. */
113
+ forceRelay: boolean
114
+ /** Whether unsigned pubsub messages are accepted. */
115
+ allowUnsigned: boolean
116
+ /** Application protocol identifiers. */
117
+ protocols: Array<string>
118
+ /** Signed discovery configuration. */
119
+ discovery?: NodeDiscoveryOptions
120
+ /** mDNS configuration. */
121
+ mdns?: NodeMdnsOptions
122
+ }
123
+
124
+ /** mDNS configuration accepted from Node.js. */
125
+ export interface NodeMdnsOptions {
126
+ /** Whether IPv6 multicast is enabled. */
127
+ enableIpv6: boolean
128
+ /** Advertised record lifetime in milliseconds. */
129
+ ttlMs: bigint
130
+ /** Query interval in milliseconds. */
131
+ queryIntervalMs: bigint
132
+ /** Maximum encoded packet size. */
133
+ maxPacketBytes: number
134
+ /** Maximum addresses per response. */
135
+ maxAnnouncedAddrs: number
136
+ /** Interface refresh interval in milliseconds. */
137
+ interfaceRefreshMs: bigint
138
+ /** Socket polling interval in milliseconds. */
139
+ socketPollIntervalMs: bigint
140
+ /** Whether observations may trigger dials. */
141
+ autoDial: boolean
142
+ }
143
+
144
+ /** Derives a peer ID from raw Ed25519 secret key material. */
145
+ export declare function peerIdFromSecretKey(secretKey: Uint8Array): string
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Types of the values the native addon returns. `minip2p-ffi-core` derives
3
+ * them with serde (its `js_shape` module pins the representation), and the
4
+ * SDK's backend types describe the same shape, so each native type is the
5
+ * SDK type with napi-rs's value encoding: `u64` arrives as `number`, or as a
6
+ * `bigint` above `u32::MAX`, and bytes arrive as a `Buffer`.
7
+ *
8
+ * The generated `addon.d.ts` imports these names through its header.
9
+ */
10
+ import type { ConnectionInfo, IdentifyInfo, KnownPeerInfo, RelayReservationInfo } from "@minip2p/core";
11
+ import type { BackendOpenStream, P2pEvent, PathKind } from "@minip2p/core/backend";
12
+ /** One SDK backend value as the addon encodes it. */
13
+ export type NativeShape<Value> = Value extends ArrayBuffer ? Uint8Array : Value extends number ? number | bigint : Value extends string | boolean ? Value : Value extends readonly (infer Item)[] ? readonly NativeShape<Item>[] : {
14
+ readonly [Key in keyof Value]: NativeShape<Value[Key]>;
15
+ };
16
+ export type NativeEvent = NativeShape<P2pEvent>;
17
+ export type NativeIdentifyInfo = NativeShape<IdentifyInfo>;
18
+ export type NativeKnownPeerInfo = NativeShape<KnownPeerInfo>;
19
+ export type NativeRelayReservationInfo = NativeShape<RelayReservationInfo>;
20
+ export type NativeConnectionInfo = NativeShape<ConnectionInfo>;
21
+ export type NativeOpenStream = NativeShape<BackendOpenStream>;
22
+ export type NativePathKind = NativeShape<PathKind>;
23
+ export type { Reachability } from "@minip2p/core";
24
+ //# sourceMappingURL=native-shape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-shape.d.ts","sourceRoot":"","sources":["../src/native-shape.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,oBAAoB,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACT,MAAM,uBAAuB,CAAC;AAE/B,qDAAqD;AACrD,MAAM,MAAM,WAAW,CAAC,KAAK,IAAI,KAAK,SAAS,WAAW,GACtD,UAAU,GACV,KAAK,SAAS,MAAM,GAClB,MAAM,GAAG,MAAM,GACf,KAAK,SAAS,MAAM,GAAG,OAAO,GAC5B,KAAK,GACL,KAAK,SAAS,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,GACnC,SAAS,WAAW,CAAC,IAAI,CAAC,EAAE,GAC5B;IAAE,QAAQ,EAAE,GAAG,IAAI,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;CAAE,CAAC;AAErE,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;AAChD,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC;AAC3D,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC;AAC7D,MAAM,MAAM,0BAA0B,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC;AAC3E,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,cAAc,CAAC,CAAC;AAC/D,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,iBAAiB,CAAC,CAAC;AAC9D,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;AACnD,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Types of the values the native addon returns. `minip2p-ffi-core` derives
3
+ * them with serde (its `js_shape` module pins the representation), and the
4
+ * SDK's backend types describe the same shape, so each native type is the
5
+ * SDK type with napi-rs's value encoding: `u64` arrives as `number`, or as a
6
+ * `bigint` above `u32::MAX`, and bytes arrive as a `Buffer`.
7
+ *
8
+ * The generated `addon.d.ts` imports these names through its header.
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=native-shape.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-shape.js","sourceRoot":"","sources":["../src/native-shape.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
package/dist/native.d.ts CHANGED
@@ -1,72 +1,5 @@
1
- interface NativeEndpointConfig {
2
- readonly agentVersion?: string;
3
- readonly allowUnsigned: boolean;
4
- readonly autonatServers: string[];
5
- readonly forceRelay: boolean;
6
- readonly discovery?: {
7
- readonly autoDial: boolean;
8
- readonly beaconIntervalMs: bigint;
9
- readonly peerTtlMs: bigint;
10
- readonly topic: string;
11
- };
12
- readonly listen?: string[];
13
- readonly mdns?: {
14
- readonly autoDial: boolean;
15
- readonly enableIpv6: boolean;
16
- readonly interfaceRefreshMs: bigint;
17
- readonly maxAnnouncedAddrs: number;
18
- readonly maxPacketBytes: number;
19
- readonly queryIntervalMs: bigint;
20
- readonly socketPollIntervalMs: bigint;
21
- readonly ttlMs: bigint;
22
- };
23
- readonly protocols: string[];
24
- readonly relays: string[];
25
- }
26
- export interface NativeEndpoint {
27
- abandonStream: (peerId: string, connId: bigint, streamId: bigint) => void;
28
- activeReservation: () => unknown;
29
- addProtocol: (protocolId: string) => void;
30
- cancelConnect: (id: bigint) => void;
31
- close: () => void;
32
- closeStreamWrite: (peerId: string, connId: bigint, streamId: bigint) => void;
33
- connectedPeers: () => string[];
34
- connectionInfo: (peerId: string) => {
35
- readonly connId: bigint;
36
- readonly remoteAddr?: string | null;
37
- readonly readyProtocols?: string[] | null;
38
- } | null | undefined;
39
- connect: (target: string | string[]) => bigint;
40
- disconnect: (peerId: string) => void;
41
- discoveryNowMs: () => bigint | null | undefined;
42
- drainEvents: (limit: number) => unknown[];
43
- isRunning: () => boolean;
44
- isPeerReady: (peerId: string) => boolean;
45
- knownPeers: () => unknown[];
46
- listenAddrs: () => string[];
47
- openStream: (peerId: string, protocolId: string) => {
48
- readonly connId: bigint;
49
- readonly streamId: bigint;
50
- };
51
- path: (peerId: string) => unknown;
52
- peerId: () => string;
53
- peerInfo: (peerId: string) => unknown;
54
- ping: (peerId: string) => void;
55
- publish: (topic: string, data: Uint8Array) => void;
56
- reachability: () => number;
57
- resetStream: (peerId: string, connId: bigint, streamId: bigint) => void;
58
- sendStream: (peerId: string, connId: bigint, streamId: bigint, data: Uint8Array) => void;
59
- setActive: (active: boolean) => void;
60
- start: (doorbell: () => void) => void;
61
- subscribe: (topic: string) => boolean;
62
- unsubscribe: (topic: string) => boolean;
63
- }
64
- interface NativeBinding {
65
- readonly NodeEndpoint: new (secretKey: Uint8Array, config: NativeEndpointConfig) => NativeEndpoint;
66
- circuitAddress: (relayAddress: string, peerId: string) => string;
67
- generateSecretKey: () => Uint8Array;
68
- peerIdFromSecretKey: (secretKey: Uint8Array) => string;
69
- }
70
- export declare const nativeBinding: NativeBinding;
71
- export {};
1
+ import type * as Addon from "./addon.js";
2
+ /** A native endpoint instance. */
3
+ export type NativeEndpoint = Addon.NodeEndpoint;
4
+ export declare const nativeBinding: typeof Addon;
72
5
  //# sourceMappingURL=native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AA8CA,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE;QACnB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC3B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;QAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;KACxB,CAAC;IACF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE;QACd,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC3B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;QAC7B,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;QACpC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;QACnC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;QAChC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;QACjC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,C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cAAc,CAAC;IACpB,cAAc,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IACjE,iBAAiB,EAAE,MAAM,UAAU,CAAC;IACpC,mBAAmB,EAAE,CAAC,SAAS,EAAE,UAAU,KAAK,MAAM,CAAC;CACxD;AA2CD,eAAO,MAAM,aAAa,eAAqC,CAAC"}
1
+ {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AA+CzC,kCAAkC;AAClC,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,YAAY,CAAC;AA2ChD,eAAO,MAAM,aAAa,cAAqC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"native.js","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAAA,oHAAoH;AAEpH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,MAAM,gBAAgB,GAAG;IACvB,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,kBAAkB;IAClB,YAAY;IACZ,cAAc;IACd,gBAAgB;CACR,CAAC;AAIX,SAAS,SAAS;IAChB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC;IAC3C,MAAM,MAAM,GACV,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACnE,OAAO,MAAM,KAAK,SAAS;QACzB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,KAAK,SAAS;YACvD,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,KAAK,SAAS,CAAC;QAC5D,CAAC,CAA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O,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,KAAK,CAAC;QACd,CAAC;QACD,IAAI,CAAC;YACH,OAAO,GAAG,OAAO,CAAC,iBAAiB,MAAM,EAAE,CAAC,CAAC;QAC/C,CAAC;QAAC,OAAO,YAAY,EAAE,CAAC;YACtB,MAAM,iBAAiB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAChD,CAAC;IACH,CAAC;IACD,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,CACL,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,kBAAkB,CAClD,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAc;IACzC,IACE,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,UAAU;QACxD,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,mBAAmB,CAAC,KAAK,UAAU,EAC7D,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,iBAAiB,CAAC,aAAa,EAAE,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minip2p/node",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Node.js bindings for minip2p",
5
5
  "keywords": [
6
6
  "libp2p",
@@ -38,7 +38,7 @@
38
38
  "registry": "https://registry.npmjs.org/"
39
39
  },
40
40
  "dependencies": {
41
- "@minip2p/core": "0.7.2"
41
+ "@minip2p/core": "0.7.4"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@minip2p/test-fixtures": "0.0.0",
@@ -48,16 +48,17 @@
48
48
  "typescript": "7.0.2"
49
49
  },
50
50
  "optionalDependencies": {
51
- "@minip2p/node-darwin-arm64": "0.7.2",
52
- "@minip2p/node-darwin-x64": "0.7.2",
53
- "@minip2p/node-linux-arm64-gnu": "0.7.2",
54
- "@minip2p/node-linux-arm64-musl": "0.7.2",
55
- "@minip2p/node-linux-x64-gnu": "0.7.2",
56
- "@minip2p/node-linux-x64-musl": "0.7.2",
57
- "@minip2p/node-win32-x64-msvc": "0.7.2"
51
+ "@minip2p/node-darwin-arm64": "0.7.4",
52
+ "@minip2p/node-darwin-x64": "0.7.4",
53
+ "@minip2p/node-linux-arm64-gnu": "0.7.4",
54
+ "@minip2p/node-linux-arm64-musl": "0.7.4",
55
+ "@minip2p/node-linux-x64-gnu": "0.7.4",
56
+ "@minip2p/node-linux-x64-musl": "0.7.4",
57
+ "@minip2p/node-win32-x64-msvc": "0.7.4"
58
58
  },
59
59
  "napi": {
60
60
  "binaryName": "minip2p",
61
+ "dtsHeaderFile": "addon-header.d.ts.txt",
61
62
  "targets": [
62
63
  "x86_64-unknown-linux-gnu",
63
64
  "x86_64-unknown-linux-musl",
@@ -73,10 +74,10 @@
73
74
  },
74
75
  "scripts": {
75
76
  "bench": "vitest bench --run --reporter=default --reporter=json --outputFile ../../../target/bench-node-vitest.json && python3 ../../../scripts/bench_results.py vitest --report ../../../target/bench-node-vitest.json --output ../../../target/bench-results/node-ffi.json --git-sha \"${BENCH_GIT_SHA:-$(git rev-parse HEAD)}\"",
76
- "build": "del-cli dist && tsc -p tsconfig.build.json",
77
+ "build": "del-cli dist && tsc -p tsconfig.build.json && node -e \"require('node:fs').copyFileSync('src/addon.d.ts', 'dist/addon.d.ts')\"",
77
78
  "clean": "del-cli dist",
78
- "native:build": "napi build --platform --no-js --dts ../../../target/minip2p-nodejs.d.ts --release --manifest-path ../../../crates/nodejs/Cargo.toml --output-dir . -- --locked",
79
- "native:build:target": "napi build --platform --no-js --dts ../../../target/minip2p-nodejs.d.ts --release --manifest-path ../../../crates/nodejs/Cargo.toml --output-dir .",
79
+ "native:build": "napi build --platform --no-js --dts src/addon.d.ts --release --manifest-path ../../../crates/nodejs/Cargo.toml --output-dir . -- --locked",
80
+ "native:build:target": "napi build --platform --no-js --dts src/addon.d.ts --release --manifest-path ../../../crates/nodejs/Cargo.toml --output-dir .",
80
81
  "pretest": "cargo build --locked -p minip2p-relay-server-example",
81
82
  "test": "vitest run",
82
83
  "test:watch": "vitest",