@3leaps/sysprims 0.1.7

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,327 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /* prettier-ignore */
4
+
5
+ /* auto-generated by NAPI-RS */
6
+
7
+ const { existsSync, readFileSync } = require('fs')
8
+ const { join } = require('path')
9
+
10
+ const { platform, arch } = process
11
+
12
+ let nativeBinding = null
13
+ let localFileExisted = false
14
+ let loadError = null
15
+
16
+ function isMusl() {
17
+ // For Node 10
18
+ if (!process.report || typeof process.report.getReport !== 'function') {
19
+ try {
20
+ const lddPath = require('child_process').execSync('which ldd').toString().trim()
21
+ return readFileSync(lddPath, 'utf8').includes('musl')
22
+ } catch (e) {
23
+ return true
24
+ }
25
+ } else {
26
+ const { glibcVersionRuntime } = process.report.getReport().header
27
+ return !glibcVersionRuntime
28
+ }
29
+ }
30
+
31
+ switch (platform) {
32
+ case 'android':
33
+ switch (arch) {
34
+ case 'arm64':
35
+ localFileExisted = existsSync(join(__dirname, 'sysprims.android-arm64.node'))
36
+ try {
37
+ if (localFileExisted) {
38
+ nativeBinding = require('./sysprims.android-arm64.node')
39
+ } else {
40
+ nativeBinding = require('@3leaps/sysprims-android-arm64')
41
+ }
42
+ } catch (e) {
43
+ loadError = e
44
+ }
45
+ break
46
+ case 'arm':
47
+ localFileExisted = existsSync(join(__dirname, 'sysprims.android-arm-eabi.node'))
48
+ try {
49
+ if (localFileExisted) {
50
+ nativeBinding = require('./sysprims.android-arm-eabi.node')
51
+ } else {
52
+ nativeBinding = require('@3leaps/sysprims-android-arm-eabi')
53
+ }
54
+ } catch (e) {
55
+ loadError = e
56
+ }
57
+ break
58
+ default:
59
+ throw new Error(`Unsupported architecture on Android ${arch}`)
60
+ }
61
+ break
62
+ case 'win32':
63
+ switch (arch) {
64
+ case 'x64':
65
+ localFileExisted = existsSync(
66
+ join(__dirname, 'sysprims.win32-x64-msvc.node')
67
+ )
68
+ try {
69
+ if (localFileExisted) {
70
+ nativeBinding = require('./sysprims.win32-x64-msvc.node')
71
+ } else {
72
+ nativeBinding = require('@3leaps/sysprims-win32-x64-msvc')
73
+ }
74
+ } catch (e) {
75
+ loadError = e
76
+ }
77
+ break
78
+ case 'ia32':
79
+ localFileExisted = existsSync(
80
+ join(__dirname, 'sysprims.win32-ia32-msvc.node')
81
+ )
82
+ try {
83
+ if (localFileExisted) {
84
+ nativeBinding = require('./sysprims.win32-ia32-msvc.node')
85
+ } else {
86
+ nativeBinding = require('@3leaps/sysprims-win32-ia32-msvc')
87
+ }
88
+ } catch (e) {
89
+ loadError = e
90
+ }
91
+ break
92
+ case 'arm64':
93
+ localFileExisted = existsSync(
94
+ join(__dirname, 'sysprims.win32-arm64-msvc.node')
95
+ )
96
+ try {
97
+ if (localFileExisted) {
98
+ nativeBinding = require('./sysprims.win32-arm64-msvc.node')
99
+ } else {
100
+ nativeBinding = require('@3leaps/sysprims-win32-arm64-msvc')
101
+ }
102
+ } catch (e) {
103
+ loadError = e
104
+ }
105
+ break
106
+ default:
107
+ throw new Error(`Unsupported architecture on Windows: ${arch}`)
108
+ }
109
+ break
110
+ case 'darwin':
111
+ localFileExisted = existsSync(join(__dirname, 'sysprims.darwin-universal.node'))
112
+ try {
113
+ if (localFileExisted) {
114
+ nativeBinding = require('./sysprims.darwin-universal.node')
115
+ } else {
116
+ nativeBinding = require('@3leaps/sysprims-darwin-universal')
117
+ }
118
+ break
119
+ } catch {}
120
+ switch (arch) {
121
+ case 'x64':
122
+ localFileExisted = existsSync(join(__dirname, 'sysprims.darwin-x64.node'))
123
+ try {
124
+ if (localFileExisted) {
125
+ nativeBinding = require('./sysprims.darwin-x64.node')
126
+ } else {
127
+ nativeBinding = require('@3leaps/sysprims-darwin-x64')
128
+ }
129
+ } catch (e) {
130
+ loadError = e
131
+ }
132
+ break
133
+ case 'arm64':
134
+ localFileExisted = existsSync(
135
+ join(__dirname, 'sysprims.darwin-arm64.node')
136
+ )
137
+ try {
138
+ if (localFileExisted) {
139
+ nativeBinding = require('./sysprims.darwin-arm64.node')
140
+ } else {
141
+ nativeBinding = require('@3leaps/sysprims-darwin-arm64')
142
+ }
143
+ } catch (e) {
144
+ loadError = e
145
+ }
146
+ break
147
+ default:
148
+ throw new Error(`Unsupported architecture on macOS: ${arch}`)
149
+ }
150
+ break
151
+ case 'freebsd':
152
+ if (arch !== 'x64') {
153
+ throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
154
+ }
155
+ localFileExisted = existsSync(join(__dirname, 'sysprims.freebsd-x64.node'))
156
+ try {
157
+ if (localFileExisted) {
158
+ nativeBinding = require('./sysprims.freebsd-x64.node')
159
+ } else {
160
+ nativeBinding = require('@3leaps/sysprims-freebsd-x64')
161
+ }
162
+ } catch (e) {
163
+ loadError = e
164
+ }
165
+ break
166
+ case 'linux':
167
+ switch (arch) {
168
+ case 'x64':
169
+ if (isMusl()) {
170
+ localFileExisted = existsSync(
171
+ join(__dirname, 'sysprims.linux-x64-musl.node')
172
+ )
173
+ try {
174
+ if (localFileExisted) {
175
+ nativeBinding = require('./sysprims.linux-x64-musl.node')
176
+ } else {
177
+ nativeBinding = require('@3leaps/sysprims-linux-x64-musl')
178
+ }
179
+ } catch (e) {
180
+ loadError = e
181
+ }
182
+ } else {
183
+ localFileExisted = existsSync(
184
+ join(__dirname, 'sysprims.linux-x64-gnu.node')
185
+ )
186
+ try {
187
+ if (localFileExisted) {
188
+ nativeBinding = require('./sysprims.linux-x64-gnu.node')
189
+ } else {
190
+ nativeBinding = require('@3leaps/sysprims-linux-x64-gnu')
191
+ }
192
+ } catch (e) {
193
+ loadError = e
194
+ }
195
+ }
196
+ break
197
+ case 'arm64':
198
+ if (isMusl()) {
199
+ localFileExisted = existsSync(
200
+ join(__dirname, 'sysprims.linux-arm64-musl.node')
201
+ )
202
+ try {
203
+ if (localFileExisted) {
204
+ nativeBinding = require('./sysprims.linux-arm64-musl.node')
205
+ } else {
206
+ nativeBinding = require('@3leaps/sysprims-linux-arm64-musl')
207
+ }
208
+ } catch (e) {
209
+ loadError = e
210
+ }
211
+ } else {
212
+ localFileExisted = existsSync(
213
+ join(__dirname, 'sysprims.linux-arm64-gnu.node')
214
+ )
215
+ try {
216
+ if (localFileExisted) {
217
+ nativeBinding = require('./sysprims.linux-arm64-gnu.node')
218
+ } else {
219
+ nativeBinding = require('@3leaps/sysprims-linux-arm64-gnu')
220
+ }
221
+ } catch (e) {
222
+ loadError = e
223
+ }
224
+ }
225
+ break
226
+ case 'arm':
227
+ if (isMusl()) {
228
+ localFileExisted = existsSync(
229
+ join(__dirname, 'sysprims.linux-arm-musleabihf.node')
230
+ )
231
+ try {
232
+ if (localFileExisted) {
233
+ nativeBinding = require('./sysprims.linux-arm-musleabihf.node')
234
+ } else {
235
+ nativeBinding = require('@3leaps/sysprims-linux-arm-musleabihf')
236
+ }
237
+ } catch (e) {
238
+ loadError = e
239
+ }
240
+ } else {
241
+ localFileExisted = existsSync(
242
+ join(__dirname, 'sysprims.linux-arm-gnueabihf.node')
243
+ )
244
+ try {
245
+ if (localFileExisted) {
246
+ nativeBinding = require('./sysprims.linux-arm-gnueabihf.node')
247
+ } else {
248
+ nativeBinding = require('@3leaps/sysprims-linux-arm-gnueabihf')
249
+ }
250
+ } catch (e) {
251
+ loadError = e
252
+ }
253
+ }
254
+ break
255
+ case 'riscv64':
256
+ if (isMusl()) {
257
+ localFileExisted = existsSync(
258
+ join(__dirname, 'sysprims.linux-riscv64-musl.node')
259
+ )
260
+ try {
261
+ if (localFileExisted) {
262
+ nativeBinding = require('./sysprims.linux-riscv64-musl.node')
263
+ } else {
264
+ nativeBinding = require('@3leaps/sysprims-linux-riscv64-musl')
265
+ }
266
+ } catch (e) {
267
+ loadError = e
268
+ }
269
+ } else {
270
+ localFileExisted = existsSync(
271
+ join(__dirname, 'sysprims.linux-riscv64-gnu.node')
272
+ )
273
+ try {
274
+ if (localFileExisted) {
275
+ nativeBinding = require('./sysprims.linux-riscv64-gnu.node')
276
+ } else {
277
+ nativeBinding = require('@3leaps/sysprims-linux-riscv64-gnu')
278
+ }
279
+ } catch (e) {
280
+ loadError = e
281
+ }
282
+ }
283
+ break
284
+ case 's390x':
285
+ localFileExisted = existsSync(
286
+ join(__dirname, 'sysprims.linux-s390x-gnu.node')
287
+ )
288
+ try {
289
+ if (localFileExisted) {
290
+ nativeBinding = require('./sysprims.linux-s390x-gnu.node')
291
+ } else {
292
+ nativeBinding = require('@3leaps/sysprims-linux-s390x-gnu')
293
+ }
294
+ } catch (e) {
295
+ loadError = e
296
+ }
297
+ break
298
+ default:
299
+ throw new Error(`Unsupported architecture on Linux: ${arch}`)
300
+ }
301
+ break
302
+ default:
303
+ throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
304
+ }
305
+
306
+ if (!nativeBinding) {
307
+ if (loadError) {
308
+ throw loadError
309
+ }
310
+ throw new Error(`Failed to load native binding`)
311
+ }
312
+
313
+ const { sysprimsAbiVersion, sysprimsProcGet, sysprimsProcList, sysprimsProcListeningPorts, sysprimsProcWaitPid, sysprimsSelfGetpgid, sysprimsSelfGetsid, sysprimsSignalSend, sysprimsSignalSendGroup, sysprimsTerminate, sysprimsForceKill, sysprimsTerminateTree, sysprimsSpawnInGroup } = nativeBinding
314
+
315
+ module.exports.sysprimsAbiVersion = sysprimsAbiVersion
316
+ module.exports.sysprimsProcGet = sysprimsProcGet
317
+ module.exports.sysprimsProcList = sysprimsProcList
318
+ module.exports.sysprimsProcListeningPorts = sysprimsProcListeningPorts
319
+ module.exports.sysprimsProcWaitPid = sysprimsProcWaitPid
320
+ module.exports.sysprimsSelfGetpgid = sysprimsSelfGetpgid
321
+ module.exports.sysprimsSelfGetsid = sysprimsSelfGetsid
322
+ module.exports.sysprimsSignalSend = sysprimsSignalSend
323
+ module.exports.sysprimsSignalSendGroup = sysprimsSignalSendGroup
324
+ module.exports.sysprimsTerminate = sysprimsTerminate
325
+ module.exports.sysprimsForceKill = sysprimsForceKill
326
+ module.exports.sysprimsTerminateTree = sysprimsTerminateTree
327
+ module.exports.sysprimsSpawnInGroup = sysprimsSpawnInGroup
@@ -0,0 +1,3 @@
1
+ import type { SysprimsLib } from "./ffi";
2
+ export declare function loadNativeBinding(packageRoot: string): SysprimsLib;
3
+ //# sourceMappingURL=native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native.d.ts","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AA6DzC,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,CA4BlE"}
package/dist/native.js ADDED
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.loadNativeBinding = loadNativeBinding;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ function isMusl() {
10
+ // Best-effort detection for Node on Linux.
11
+ // If `process.report` isn't available, default to musl (safer for container environments).
12
+ const report = process.report;
13
+ if (!report || typeof report.getReport !== "function")
14
+ return true;
15
+ try {
16
+ const r = report.getReport();
17
+ return !r?.header?.glibcVersionRuntime;
18
+ }
19
+ catch {
20
+ return true;
21
+ }
22
+ }
23
+ function bindingIdForRuntime() {
24
+ const platform = process.platform;
25
+ const arch = process.arch;
26
+ if (process.versions?.bun) {
27
+ throw new Error("sysprims TypeScript bindings are not yet validated on Bun. " +
28
+ "Run under Node.js or add a fallback path for Bun.");
29
+ }
30
+ if (platform === "darwin") {
31
+ if (arch !== "arm64") {
32
+ throw new Error(`Unsupported platform for sysprims: ${platform}/${arch}. ` +
33
+ "macOS x64 is not supported by sysprims.");
34
+ }
35
+ return "darwin-arm64";
36
+ }
37
+ if (platform === "win32") {
38
+ if (arch === "x64")
39
+ return "win32-x64-msvc";
40
+ if (arch === "arm64")
41
+ return "win32-arm64-msvc";
42
+ throw new Error(`Unsupported platform for sysprims: ${platform}/${arch}`);
43
+ }
44
+ if (platform === "linux") {
45
+ const abi = isMusl() ? "musl" : "gnu";
46
+ if (arch === "x64")
47
+ return `linux-x64-${abi}`;
48
+ if (arch === "arm64")
49
+ return `linux-arm64-${abi}`;
50
+ throw new Error(`Unsupported platform for sysprims: ${platform}/${arch}`);
51
+ }
52
+ throw new Error(`Unsupported platform for sysprims: ${platform}/${arch}`);
53
+ }
54
+ function packageNameForBindingId(bindingId) {
55
+ return `@3leaps/sysprims-${bindingId}`;
56
+ }
57
+ function localNodeFilename(bindingId) {
58
+ return `sysprims.${bindingId}.node`;
59
+ }
60
+ function loadNativeBinding(packageRoot) {
61
+ const bindingId = bindingIdForRuntime();
62
+ const localNode = node_path_1.default.join(packageRoot, "dist", "native", localNodeFilename(bindingId));
63
+ const pkg = packageNameForBindingId(bindingId);
64
+ // Prefer local build (git checkout / local path installs).
65
+ if (node_fs_1.default.existsSync(localNode)) {
66
+ // biome-ignore lint/suspicious/noExplicitAny: napi binding is runtime-loaded
67
+ return require(localNode);
68
+ }
69
+ // Otherwise require the platform package (npm optional dependency).
70
+ try {
71
+ // biome-ignore lint/suspicious/noExplicitAny: napi binding is runtime-loaded
72
+ return require(pkg);
73
+ }
74
+ catch (e) {
75
+ const msg = e instanceof Error ? e.message : String(e);
76
+ throw new Error("Failed to load sysprims native addon for this platform.\n" +
77
+ `Expected: ${pkg}\n` +
78
+ "\n" +
79
+ "If you are installing from a git checkout or local path, build the native addon first:\n" +
80
+ " npm run build:native\n" +
81
+ "\n" +
82
+ "If you are installing from npm, the platform prebuild package may be missing or failed to install.\n" +
83
+ `Original error: ${msg}`);
84
+ }
85
+ }
86
+ //# sourceMappingURL=native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native.js","sourceRoot":"","sources":["../src/native.ts"],"names":[],"mappings":";;;;;AAgEA,8CA4BC;AA5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,aAAa,GAAG,IAAI;YACpB,IAAI;YACJ,0FAA0F;YAC1F,0BAA0B;YAC1B,IAAI;YACJ,sGAAsG;YACtG,mBAAmB,GAAG,EAAE,CAC3B,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,124 @@
1
+ export type JsonObject = Record<string, unknown>;
2
+ export type ProcessState = "running" | "sleeping" | "stopped" | "zombie" | "unknown";
3
+ /**
4
+ * Information about a single process.
5
+ * Matches schema: process-info.schema.json#/definitions/process_info
6
+ */
7
+ export interface ProcessInfo {
8
+ pid: number;
9
+ ppid: number;
10
+ name: string;
11
+ user?: string | null;
12
+ cpu_percent: number;
13
+ memory_kb: number;
14
+ elapsed_seconds: number;
15
+ start_time_unix_ms?: number | null;
16
+ exe_path?: string | null;
17
+ state: ProcessState;
18
+ cmdline: string[];
19
+ }
20
+ /**
21
+ * Filter criteria for process listing.
22
+ * All fields use snake_case to match FFI expectations directly.
23
+ */
24
+ export interface ProcessFilter {
25
+ name_contains?: string;
26
+ name_equals?: string;
27
+ user_equals?: string;
28
+ pid_in?: number[];
29
+ state_in?: ProcessState[];
30
+ cpu_above?: number;
31
+ memory_above_kb?: number;
32
+ }
33
+ /**
34
+ * Snapshot of running processes.
35
+ * Matches schema: process-info.schema.json
36
+ */
37
+ export interface ProcessSnapshot {
38
+ schema_id: string;
39
+ timestamp: string;
40
+ processes: ProcessInfo[];
41
+ }
42
+ /**
43
+ * Result of waiting for a PID to exit.
44
+ * Matches schema: wait-pid-result.schema.json
45
+ */
46
+ export interface WaitPidResult {
47
+ schema_id: string;
48
+ timestamp: string;
49
+ platform: string;
50
+ pid: number;
51
+ exited: boolean;
52
+ timed_out: boolean;
53
+ exit_code?: number | null;
54
+ warnings: string[];
55
+ }
56
+ export interface TerminateTreeConfig {
57
+ schema_id?: string;
58
+ grace_timeout_ms?: number | null;
59
+ kill_timeout_ms?: number | null;
60
+ signal?: number | null;
61
+ kill_signal?: number | null;
62
+ }
63
+ export interface TerminateTreeResult {
64
+ schema_id: string;
65
+ timestamp: string;
66
+ platform: string;
67
+ pid: number;
68
+ pgid?: number | null;
69
+ signal_sent: number;
70
+ kill_signal?: number | null;
71
+ escalated: boolean;
72
+ exited: boolean;
73
+ timed_out: boolean;
74
+ tree_kill_reliability: "guaranteed" | "best_effort";
75
+ warnings: string[];
76
+ }
77
+ export interface SpawnInGroupConfig {
78
+ schema_id?: string;
79
+ argv: string[];
80
+ cwd?: string | null;
81
+ env?: Record<string, string> | null;
82
+ }
83
+ export interface SpawnInGroupResult {
84
+ schema_id: string;
85
+ timestamp: string;
86
+ platform: string;
87
+ pid: number;
88
+ pgid?: number | null;
89
+ tree_kill_reliability: "guaranteed" | "best_effort";
90
+ warnings: string[];
91
+ }
92
+ export type Protocol = "tcp" | "udp";
93
+ /**
94
+ * Information about a listening socket binding.
95
+ * Matches schema: port-bindings.schema.json#/definitions/port_binding
96
+ */
97
+ export interface PortBinding {
98
+ protocol: Protocol;
99
+ local_addr?: string | null;
100
+ local_port: number;
101
+ state?: string | null;
102
+ pid?: number | null;
103
+ process?: ProcessInfo;
104
+ }
105
+ /**
106
+ * Filter criteria for port listing.
107
+ * All fields use snake_case to match FFI expectations directly.
108
+ */
109
+ export interface PortFilter {
110
+ protocol?: Protocol;
111
+ local_port?: number;
112
+ }
113
+ /**
114
+ * Snapshot of listening ports.
115
+ * Matches schema: port-bindings.schema.json
116
+ */
117
+ export interface PortBindingsSnapshot {
118
+ schema_id: string;
119
+ timestamp: string;
120
+ platform: string;
121
+ bindings: PortBinding[];
122
+ warnings: string[];
123
+ }
124
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAIjD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,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GAAG,KAAK,GAAG,KAAK,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ [package]
2
+ name = "sysprims-ts-napi"
3
+ version.workspace = true
4
+ edition.workspace = true
5
+ license.workspace = true
6
+ repository.workspace = true
7
+ authors.workspace = true
8
+ # NOTE: napi-build requires rustc >= 1.88.
9
+ rust-version = "1.88.0"
10
+ description = "Node-API addon for @3leaps/sysprims (TypeScript bindings)"
11
+
12
+ [lib]
13
+ crate-type = ["cdylib"]
14
+
15
+ [dependencies]
16
+ napi = { version = "2.16.16", default-features = false, features = ["napi8"] }
17
+ napi-derive = "2.16.13"
18
+ serde = { workspace = true, features = ["derive"] }
19
+ serde_json.workspace = true
20
+
21
+ sysprims-core.workspace = true
22
+ sysprims-proc.workspace = true
23
+ sysprims-signal.workspace = true
24
+ sysprims-session.workspace = true
25
+ sysprims-timeout.workspace = true
26
+
27
+ [build-dependencies]
28
+ napi-build = "2.1.4"
@@ -0,0 +1,3 @@
1
+ fn main() {
2
+ napi_build::setup();
3
+ }