@irsdk-node/native 4.1.1 → 5.1.0

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.
@@ -4,14 +4,14 @@ All rights reserved.
4
4
 
5
5
  Redistribution and use in source and binary forms, with or without
6
6
  modification, are permitted provided that the following conditions are met:
7
- * Redistributions of source code must retain the above copyright
8
- notice, this list of conditions and the following disclaimer.
9
- * Redistributions in binary form must reproduce the above copyright
10
- notice, this list of conditions and the following disclaimer in the
11
- documentation and/or other materials provided with the distribution.
12
- * Neither the name of iRacing.com Motorsport Simulations nor the
13
- names of its contributors may be used to endorse or promote products
14
- derived from this software without specific prior written permission.
7
+ * Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+ * Neither the name of iRacing.com Motorsport Simulations nor the
13
+ names of its contributors may be used to endorse or promote products
14
+ derived from this software without specific prior written permission.
15
15
 
16
16
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
17
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -56,8 +56,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56
56
  static HANDLE hDataValidEvent = NULL;
57
57
  static HANDLE hMemMapFile = NULL;
58
58
 
59
- static const char *pSharedMem = NULL;
60
- static const irsdk_header *pHeader = NULL;
59
+ static const char* pSharedMem = NULL;
60
+ static const irsdk_header* pHeader = NULL;
61
61
 
62
62
  static int lastTickCount = INT_MAX;
63
63
  static bool isInitialized = false;
@@ -69,30 +69,30 @@ static time_t lastValidTime = 0;
69
69
 
70
70
  bool irsdk_startup()
71
71
  {
72
- if(!hMemMapFile)
72
+ if (!hMemMapFile)
73
73
  {
74
- hMemMapFile = OpenFileMapping( FILE_MAP_READ, FALSE, IRSDK_MEMMAPFILENAME);
74
+ hMemMapFile = OpenFileMapping(FILE_MAP_READ, FALSE, IRSDK_MEMMAPFILENAME);
75
75
  lastTickCount = INT_MAX;
76
76
  }
77
77
 
78
- if(hMemMapFile)
78
+ if (hMemMapFile)
79
79
  {
80
- if(!pSharedMem)
80
+ if (!pSharedMem)
81
81
  {
82
- pSharedMem = (const char *)MapViewOfFile(hMemMapFile, FILE_MAP_READ, 0, 0, 0);
83
- pHeader = (irsdk_header *)pSharedMem;
82
+ pSharedMem = (const char*)MapViewOfFile(hMemMapFile, FILE_MAP_READ, 0, 0, 0);
83
+ pHeader = (irsdk_header*)pSharedMem;
84
84
  lastTickCount = INT_MAX;
85
85
  }
86
86
 
87
- if(pSharedMem)
87
+ if (pSharedMem)
88
88
  {
89
- if(!hDataValidEvent)
89
+ if (!hDataValidEvent)
90
90
  {
91
91
  hDataValidEvent = OpenEvent(SYNCHRONIZE, false, IRSDK_DATAVALIDEVENTNAME);
92
92
  lastTickCount = INT_MAX;
93
93
  }
94
94
 
95
- if(hDataValidEvent)
95
+ if (hDataValidEvent)
96
96
  {
97
97
  isInitialized = true;
98
98
  return isInitialized;
@@ -109,13 +109,13 @@ bool irsdk_startup()
109
109
 
110
110
  void irsdk_shutdown()
111
111
  {
112
- if(hDataValidEvent)
112
+ if (hDataValidEvent)
113
113
  CloseHandle(hDataValidEvent);
114
114
 
115
- if(pSharedMem)
115
+ if (pSharedMem)
116
116
  UnmapViewOfFile(pSharedMem);
117
117
 
118
- if(hMemMapFile)
118
+ if (hMemMapFile)
119
119
  CloseHandle(hMemMapFile);
120
120
 
121
121
  hDataValidEvent = NULL;
@@ -127,38 +127,38 @@ void irsdk_shutdown()
127
127
  lastTickCount = INT_MAX;
128
128
  }
129
129
 
130
- bool irsdk_getNewData(char *data)
130
+ bool irsdk_getNewData(char* data)
131
131
  {
132
- if(isInitialized || irsdk_startup())
132
+ if (isInitialized || irsdk_startup())
133
133
  {
134
134
  #ifdef _MSC_VER
135
135
  _ASSERTE(NULL != pHeader);
136
136
  #endif
137
137
 
138
138
  // if sim is not active, then no new data
139
- if(!(pHeader->status & irsdk_stConnected))
139
+ if (!(pHeader->status & irsdk_stConnected))
140
140
  {
141
141
  lastTickCount = INT_MAX;
142
142
  return false;
143
143
  }
144
144
 
145
145
  int latest = 0;
146
- for(int i=1; i<pHeader->numBuf; i++)
147
- if(pHeader->varBuf[latest].tickCount < pHeader->varBuf[i].tickCount)
148
- latest = i;
146
+ for (int i = 1; i < pHeader->numBuf; i++)
147
+ if (pHeader->varBuf[latest].tickCount < pHeader->varBuf[i].tickCount)
148
+ latest = i;
149
149
 
150
150
  // if newer than last recieved, than report new data
151
- if(lastTickCount < pHeader->varBuf[latest].tickCount)
151
+ if (lastTickCount < pHeader->varBuf[latest].tickCount)
152
152
  {
153
153
  // if asked to retrieve the data
154
- if(data)
154
+ if (data)
155
155
  {
156
156
  // try twice to get the data out
157
- for(int count = 0; count < 2; count++)
157
+ for (int count = 0; count < 2; count++)
158
158
  {
159
- int curTickCount = pHeader->varBuf[latest].tickCount;
159
+ int curTickCount = pHeader->varBuf[latest].tickCount;
160
160
  memcpy(data, pSharedMem + pHeader->varBuf[latest].bufOffset, pHeader->bufLen);
161
- if(curTickCount == pHeader->varBuf[latest].tickCount)
161
+ if (curTickCount == pHeader->varBuf[latest].tickCount)
162
162
  {
163
163
  lastTickCount = curTickCount;
164
164
  lastValidTime = time(NULL);
@@ -170,15 +170,15 @@ bool irsdk_getNewData(char *data)
170
170
  }
171
171
  else
172
172
  {
173
- lastTickCount = pHeader->varBuf[latest].tickCount;
173
+ lastTickCount = pHeader->varBuf[latest].tickCount;
174
174
  lastValidTime = time(NULL);
175
175
  return true;
176
176
  }
177
177
  }
178
178
  // if older than last recieved, than reset, we probably disconnected
179
- else if(lastTickCount > pHeader->varBuf[latest].tickCount)
179
+ else if (lastTickCount > pHeader->varBuf[latest].tickCount)
180
180
  {
181
- lastTickCount = pHeader->varBuf[latest].tickCount;
181
+ lastTickCount = pHeader->varBuf[latest].tickCount;
182
182
  return false;
183
183
  }
184
184
  // else the same, and nothing changed this tick
@@ -188,30 +188,30 @@ bool irsdk_getNewData(char *data)
188
188
  }
189
189
 
190
190
 
191
- bool irsdk_waitForDataReady(int timeOut, char *data)
191
+ bool irsdk_waitForDataReady(int timeOut, char* data)
192
192
  {
193
193
  #ifdef _MSC_VER
194
194
  _ASSERTE(timeOut >= 0);
195
195
  #endif
196
196
 
197
- if(isInitialized || irsdk_startup())
197
+ if (isInitialized || irsdk_startup())
198
198
  {
199
199
  // just to be sure, check before we sleep
200
- if(irsdk_getNewData(data))
200
+ if (irsdk_getNewData(data))
201
201
  return true;
202
202
 
203
203
  // sleep till signaled
204
204
  WaitForSingleObject(hDataValidEvent, timeOut);
205
205
 
206
206
  // we woke up, so check for data
207
- if(irsdk_getNewData(data))
207
+ if (irsdk_getNewData(data))
208
208
  return true;
209
209
  else
210
210
  return false;
211
211
  }
212
212
 
213
213
  // sleep if error
214
- if(timeOut > 0)
214
+ if (timeOut > 0)
215
215
  Sleep(timeOut);
216
216
 
217
217
  return false;
@@ -219,7 +219,7 @@ bool irsdk_waitForDataReady(int timeOut, char *data)
219
219
 
220
220
  bool irsdk_isConnected()
221
221
  {
222
- if(isInitialized)
222
+ if (isInitialized)
223
223
  {
224
224
  int elapsed = (int)difftime(time(NULL), lastValidTime);
225
225
  return (pHeader->status & irsdk_stConnected) > 0 && elapsed < timeout;
@@ -228,9 +228,9 @@ bool irsdk_isConnected()
228
228
  return false;
229
229
  }
230
230
 
231
- const irsdk_header *irsdk_getHeader()
231
+ const irsdk_header* irsdk_getHeader()
232
232
  {
233
- if(isInitialized)
233
+ if (isInitialized)
234
234
  {
235
235
  return pHeader;
236
236
  }
@@ -241,9 +241,9 @@ const irsdk_header *irsdk_getHeader()
241
241
  // direct access to the data buffer
242
242
  // Warnign! This buffer is volitile so read it out fast!
243
243
  // Use the cached copy from irsdk_waitForDataReady() or irsdk_getNewData() instead
244
- const char *irsdk_getData(int index)
244
+ const char* irsdk_getData(int index)
245
245
  {
246
- if(isInitialized)
246
+ if (isInitialized)
247
247
  {
248
248
  return pSharedMem + pHeader->varBuf[index].bufOffset;
249
249
  }
@@ -251,9 +251,9 @@ const char *irsdk_getData(int index)
251
251
  return NULL;
252
252
  }
253
253
 
254
- const char *irsdk_getSessionInfoStr()
254
+ const char* irsdk_getSessionInfoStr()
255
255
  {
256
- if(isInitialized)
256
+ if (isInitialized)
257
257
  {
258
258
  return pSharedMem + pHeader->sessionInfoOffset;
259
259
  }
@@ -262,27 +262,27 @@ const char *irsdk_getSessionInfoStr()
262
262
 
263
263
  int irsdk_getSessionInfoStrUpdate()
264
264
  {
265
- if(isInitialized)
265
+ if (isInitialized)
266
266
  {
267
267
  return pHeader->sessionInfoUpdate;
268
268
  }
269
269
  return -1;
270
270
  }
271
271
 
272
- const irsdk_varHeader *irsdk_getVarHeaderPtr()
272
+ const irsdk_varHeader* irsdk_getVarHeaderPtr()
273
273
  {
274
- if(isInitialized)
274
+ if (isInitialized)
275
275
  {
276
276
  return ((irsdk_varHeader*)(pSharedMem + pHeader->varHeaderOffset));
277
277
  }
278
278
  return NULL;
279
279
  }
280
280
 
281
- const irsdk_varHeader *irsdk_getVarHeaderEntry(int index)
281
+ const irsdk_varHeader* irsdk_getVarHeaderEntry(int index)
282
282
  {
283
- if(isInitialized)
283
+ if (isInitialized)
284
284
  {
285
- if(index >= 0 && index < pHeader->numVars)
285
+ if (index >= 0 && index < pHeader->numVars)
286
286
  {
287
287
  return &((irsdk_varHeader*)(pSharedMem + pHeader->varHeaderOffset))[index];
288
288
  }
@@ -291,16 +291,16 @@ const irsdk_varHeader *irsdk_getVarHeaderEntry(int index)
291
291
  }
292
292
 
293
293
  // Note: this is a linear search, so cache the results
294
- int irsdk_varNameToIndex(const char *name)
294
+ int irsdk_varNameToIndex(const char* name)
295
295
  {
296
- const irsdk_varHeader *pVar;
296
+ const irsdk_varHeader* pVar;
297
297
 
298
- if(name)
298
+ if (name)
299
299
  {
300
- for(int index=0; index<pHeader->numVars; index++)
300
+ for (int index = 0; index < pHeader->numVars; index++)
301
301
  {
302
302
  pVar = irsdk_getVarHeaderEntry(index);
303
- if(pVar && 0 == strncmp(name, pVar->name, IRSDK_MAX_STRING))
303
+ if (pVar && 0 == strncmp(name, pVar->name, IRSDK_MAX_STRING))
304
304
  {
305
305
  return index;
306
306
  }
@@ -310,16 +310,16 @@ int irsdk_varNameToIndex(const char *name)
310
310
  return -1;
311
311
  }
312
312
 
313
- int irsdk_varNameToOffset(const char *name)
313
+ int irsdk_varNameToOffset(const char* name)
314
314
  {
315
- const irsdk_varHeader *pVar;
315
+ const irsdk_varHeader* pVar;
316
316
 
317
- if(name)
317
+ if (name)
318
318
  {
319
- for(int index=0; index<pHeader->numVars; index++)
319
+ for (int index = 0; index < pHeader->numVars; index++)
320
320
  {
321
321
  pVar = irsdk_getVarHeaderEntry(index);
322
- if(pVar && 0 == strncmp(name, pVar->name, IRSDK_MAX_STRING))
322
+ if (pVar && 0 == strncmp(name, pVar->name, IRSDK_MAX_STRING))
323
323
  {
324
324
  return pVar->offset;
325
325
  }
@@ -331,14 +331,14 @@ int irsdk_varNameToOffset(const char *name)
331
331
 
332
332
  unsigned int irsdk_getBroadcastMsgID()
333
333
  {
334
- static unsigned int msgId = RegisterWindowMessage(IRSDK_BROADCASTMSGNAME);
334
+ static unsigned int msgId = RegisterWindowMessage(IRSDK_BROADCASTMSGNAME);
335
335
 
336
336
  return msgId;
337
337
  }
338
338
 
339
339
  void irsdk_broadcastMsg(irsdk_BroadcastMsg msg, int var1, int var2, int var3)
340
340
  {
341
- irsdk_broadcastMsg(msg, var1, static_cast<int>MAKELONG(var2, var3));
341
+ irsdk_broadcastMsg(msg, var1, (int)MAKELONG(var2, var3));
342
342
  }
343
343
 
344
344
  void irsdk_broadcastMsg(irsdk_BroadcastMsg msg, int var1, float var2)
@@ -353,7 +353,7 @@ void irsdk_broadcastMsg(irsdk_BroadcastMsg msg, int var1, int var2)
353
353
  {
354
354
  static unsigned int msgId = irsdk_getBroadcastMsgID();
355
355
 
356
- if(msgId && msg >= 0 && msg < irsdk_BroadcastLast)
356
+ if (msgId && msg >= 0 && msg < irsdk_BroadcastLast)
357
357
  {
358
358
  SendNotifyMessage(HWND_BROADCAST, msgId, MAKELONG(msg, var1), var2);
359
359
  }
@@ -363,14 +363,14 @@ int irsdk_padCarNum(int num, int zero)
363
363
  {
364
364
  int retVal = num;
365
365
  int numPlace = 1;
366
- if(num > 99)
366
+ if (num > 99)
367
367
  numPlace = 3;
368
- else if(num > 9)
368
+ else if (num > 9)
369
369
  numPlace = 2;
370
- if(zero)
370
+ if (zero)
371
371
  {
372
372
  numPlace += zero;
373
- retVal = num + 1000*numPlace;
373
+ retVal = num + 1000 * numPlace;
374
374
  }
375
375
 
376
376
  return retVal;
@@ -4,14 +4,14 @@ All rights reserved.
4
4
 
5
5
  Redistribution and use in source and binary forms, with or without
6
6
  modification, are permitted provided that the following conditions are met:
7
- * Redistributions of source code must retain the above copyright
8
- notice, this list of conditions and the following disclaimer.
9
- * Redistributions in binary form must reproduce the above copyright
10
- notice, this list of conditions and the following disclaimer in the
11
- documentation and/or other materials provided with the distribution.
12
- * Neither the name of iRacing.com Motorsport Simulations nor the
13
- names of its contributors may be used to endorse or promote products
14
- derived from this software without specific prior written permission.
7
+ * Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright
10
+ notice, this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+ * Neither the name of iRacing.com Motorsport Simulations nor the
13
+ names of its contributors may be used to endorse or promote products
14
+ derived from this software without specific prior written permission.
15
15
 
16
16
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17
17
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -37,9 +37,9 @@ enum yaml_state {
37
37
  };
38
38
 
39
39
  // super simple YAML parser
40
- bool parseYaml(const char *data, const char* path, const char **val, int *len)
40
+ bool parseYaml(const char* data, const char* path, const char** val, int* len)
41
41
  {
42
- if(data && path && val && len)
42
+ if (data && path && val && len)
43
43
  {
44
44
  // make sure we set this to something
45
45
  *val = NULL;
@@ -48,39 +48,39 @@ bool parseYaml(const char *data, const char* path, const char **val, int *len)
48
48
  int depth = 0;
49
49
  yaml_state state = space;
50
50
 
51
- const char *keystr = NULL;
51
+ const char* keystr = NULL;
52
52
  int keylen = 0;
53
53
 
54
- const char *valuestr = NULL;
54
+ const char* valuestr = NULL;
55
55
  int valuelen = 0;
56
56
 
57
- const char *pathptr = path;
57
+ const char* pathptr = path;
58
58
  int pathdepth = 0;
59
59
 
60
- while(*data)
60
+ while (*data)
61
61
  {
62
- switch(*data)
62
+ switch (*data)
63
63
  {
64
64
  case ' ':
65
- if(state == newline)
65
+ if (state == newline)
66
66
  state = space;
67
- if(state == space)
67
+ if (state == space)
68
68
  depth++;
69
- else if(state == key)
69
+ else if (state == key)
70
70
  keylen++;
71
- else if(state == value)
71
+ else if (state == value)
72
72
  valuelen++;
73
73
  break;
74
74
  case '-':
75
- if(state == newline)
75
+ if (state == newline)
76
76
  state = space;
77
- if(state == space)
77
+ if (state == space)
78
78
  depth++;
79
- else if(state == key)
79
+ else if (state == key)
80
80
  keylen++;
81
- else if(state == value)
81
+ else if (state == value)
82
82
  valuelen++;
83
- else if(state == keysep)
83
+ else if (state == keysep)
84
84
  {
85
85
  state = value;
86
86
  valuestr = data;
@@ -88,50 +88,50 @@ bool parseYaml(const char *data, const char* path, const char **val, int *len)
88
88
  }
89
89
  break;
90
90
  case ':':
91
- if(state == key)
91
+ if (state == key)
92
92
  {
93
93
  state = keysep;
94
94
  keylen++;
95
95
  }
96
- else if(state == keysep)
96
+ else if (state == keysep)
97
97
  {
98
98
  state = value;
99
99
  valuestr = data;
100
100
  }
101
- else if(state == value)
101
+ else if (state == value)
102
102
  valuelen++;
103
103
  break;
104
104
  case '\n':
105
105
  case '\r':
106
- if(state != newline)
106
+ if (state != newline)
107
107
  {
108
- if(depth < pathdepth)
108
+ if (depth < pathdepth)
109
109
  {
110
110
  return false;
111
111
  }
112
- else if(keylen && 0 == strncmp(keystr, pathptr, keylen))
112
+ else if (keylen && 0 == strncmp(keystr, pathptr, keylen))
113
113
  {
114
114
  bool found = true;
115
115
  //do we need to test the value?
116
- if(*(pathptr+keylen) == '{')
116
+ if (*(pathptr + keylen) == '{')
117
117
  {
118
118
  //search for closing brace
119
- int pathvaluelen = keylen + 1;
120
- while(*(pathptr+pathvaluelen) && *(pathptr+pathvaluelen) != '}')
121
- pathvaluelen++;
119
+ int pathvaluelen = keylen + 1;
120
+ while (*(pathptr + pathvaluelen) && *(pathptr + pathvaluelen) != '}')
121
+ pathvaluelen++;
122
122
 
123
- if(valuelen == pathvaluelen - (keylen+1) && 0 == strncmp(valuestr, (pathptr+keylen+1), valuelen))
123
+ if (valuelen == pathvaluelen - (keylen + 1) && 0 == strncmp(valuestr, (pathptr + keylen + 1), valuelen))
124
124
  pathptr += valuelen + 2;
125
125
  else
126
126
  found = false;
127
127
  }
128
128
 
129
- if(found)
129
+ if (found)
130
130
  {
131
131
  pathptr += keylen;
132
132
  pathdepth = depth;
133
133
 
134
- if(*pathptr == '\0')
134
+ if (*pathptr == '\0')
135
135
  {
136
136
  *val = valuestr;
137
137
  *len = valuelen;
@@ -147,21 +147,21 @@ bool parseYaml(const char *data, const char* path, const char **val, int *len)
147
147
  state = newline;
148
148
  break;
149
149
  default:
150
- if(state == space || state == newline)
150
+ if (state == space || state == newline)
151
151
  {
152
152
  state = key;
153
153
  keystr = data;
154
154
  keylen = 0; //redundant?
155
155
  }
156
- else if(state == keysep)
156
+ else if (state == keysep)
157
157
  {
158
158
  state = value;
159
159
  valuestr = data;
160
160
  valuelen = 0; //redundant?
161
161
  }
162
- if(state == key)
162
+ if (state == key)
163
163
  keylen++;
164
- if(state == value)
164
+ if (state == value)
165
165
  valuelen++;
166
166
  break;
167
167
  }
package/lib/yaml_parser.h CHANGED
@@ -29,6 +29,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
  #define YAML_PARSER_H
30
30
 
31
31
  // super simple YAML parser
32
- bool parseYaml(const char *data, const char* path, const char **val, int *len);
32
+ bool parseYaml(const char* data, const char* path, const char** val, int* len);
33
33
 
34
34
  #endif //YAML_PARSER_H
package/package.json CHANGED
@@ -1,11 +1,7 @@
1
1
  {
2
2
  "name": "@irsdk-node/native",
3
- "version": "4.1.1",
4
- "author": {
5
- "name": "Matt Bengston",
6
- "email": "bengsfort@gmail.com",
7
- "url": "http://bengsfort.dev/"
8
- },
3
+ "version": "5.1.0",
4
+ "author": "Matt Bengston <bengsfort@gmail.com> (https://bengsfort.dev/)",
9
5
  "bugs": {
10
6
  "email": "bengsfort@gmail.com",
11
7
  "url": "https://github.com/bengsfort/irsdk-node/issues"
@@ -17,54 +13,56 @@
17
13
  "package.json",
18
14
  "./dist",
19
15
  "./lib",
20
- "./index.js",
21
16
  "./index.d.ts",
22
17
  "./prebuilds",
23
18
  "./scripts",
24
19
  "./binding.gyp",
25
20
  "./README.md"
26
21
  ],
22
+ "type": "module",
23
+ "main": "./dist/cjs/index.cjs",
24
+ "module": "./dist/esm/index.js",
25
+ "types": "./dist/types/index.d.ts",
27
26
  "exports": {
28
27
  ".": {
29
- "types": "./index.d.ts",
30
- "default": "./index.js"
28
+ "types": "./dist/types/index.d.ts",
29
+ "import": "./dist/esm/index.js",
30
+ "require": "./dist/cjs/index.cjs"
31
31
  }
32
32
  },
33
- "main": "./index.js",
34
- "types": "./index.d.ts",
33
+ "prettier": "@bengsfort/eslint-config-flat/prettier.config.js",
35
34
  "dependencies": {
36
35
  "bindings": "^1.5.0",
37
36
  "js-yaml": "^4.1.0",
38
37
  "node-addon-api": "^8.2.1",
39
- "node-gyp": "^10.2.0",
38
+ "node-gyp": "^11.5.0",
40
39
  "node-gyp-build": "^4.8.4",
41
- "@irsdk-node/types": "^3.0.3"
40
+ "@irsdk-node/types": "^4.0.4"
42
41
  },
43
42
  "devDependencies": {
43
+ "@bengsfort/eslint-config-flat": "^0.2.5",
44
44
  "@types/js-yaml": "^4.0.9",
45
- "@typescript-eslint/eslint-plugin": "^5.6.0",
46
- "@typescript-eslint/parser": "^5.6.0",
47
- "concurrently": "^7.0.0",
48
- "eslint": "^8.4.1",
49
- "eslint-config-airbnb-base": "^15.0.0",
50
- "eslint-plugin-import": "^2.25.3",
51
- "eslint-plugin-prettier": "^4.0.0",
45
+ "@types/node": "^24.8.1",
46
+ "esbuild": "^0.25.11",
47
+ "eslint": "^9.38.0",
52
48
  "node-notifier": "^10.0.0",
53
49
  "prebuildify": "^6.0.1",
54
- "prettier": "^2.5.1",
55
- "typescript": "^4.5.2"
50
+ "typescript": "^5.9.3"
56
51
  },
57
52
  "scripts": {
58
53
  "install": "node-gyp-build",
54
+ "configure": "node-gyp rebuild",
55
+ "clean": "pnpm run \"/^clean:.*/\"",
59
56
  "clean:ts": "rm -rf dist *.tsbuildinfo",
60
57
  "clean:cpp": "rm -rf ./prebuilds ./build",
61
- "clean": "pnpm run \"/^clean:.*/\"",
62
- "build": "pnpm run clean && pnpm run \"/^build:(ts|cpp)$/\"",
63
- "build:ts": "tsc --build --force",
58
+ "build": "pnpm run clean && pnpm run \"/^build:(ts|types|cpp)$/\"",
59
+ "build:ts": "node esbuild.js",
64
60
  "build:cpp": "prebuildify --napi --electron-compat",
65
- "watch": "tsc --watch",
66
- "lint": "eslint ./src/**/*.ts --color",
67
- "check-types": "tsc --noEmit",
68
- "generate-types": "node ./scripts/generate-var-types.js"
61
+ "build:types": "tsc --emitDeclarationOnly",
62
+ "watch": "pnpm run \"/^watch:.*/\"",
63
+ "watch:ts": "node esbuild.js --watch",
64
+ "watch:types": "tsc --watch --emitDeclarationOnly",
65
+ "lint": "eslint",
66
+ "check-types": "tsc --noEmit"
69
67
  }
70
68
  }
@@ -1,28 +0,0 @@
1
- import { BroadcastMessages, CameraState, ChatCommand, FFBCommand, PitCommand, ReloadTexturesCommand, ReplayPositionCommand, ReplaySearchCommand, ReplayStateCommand, TelemetryCommand, TelemetryVariable, TelemetryVarList, VideoCaptureCommand } from '@irsdk-node/types';
2
- export interface INativeSDK {
3
- readonly currDataVersion: number;
4
- readonly isMocked: boolean;
5
- enableLogging: boolean;
6
- startSDK(): boolean;
7
- stopSDK(): void;
8
- isRunning(): boolean;
9
- waitForData(timeout?: number): boolean;
10
- getSessionData(): string;
11
- getTelemetryData(): TelemetryVarList;
12
- getTelemetryVariable<T>(index: number): TelemetryVariable<T>;
13
- getTelemetryVariable<T>(name: string): TelemetryVariable<T>;
14
- broadcast(message: BroadcastMessages.CameraSwitchPos, pos: number, group: number, camera: number): void;
15
- broadcast(message: BroadcastMessages.CameraSwitchNum, driver: number, group: number, camera: number): void;
16
- broadcast(message: BroadcastMessages.CameraSetState, state: CameraState): void;
17
- broadcast(message: BroadcastMessages.ReplaySetPlaySpeed, speed: number, slowMotion: number): void;
18
- broadcast(message: BroadcastMessages.ReplaySetPlayPosition, pos: ReplayPositionCommand, frame: number): void;
19
- broadcast(message: BroadcastMessages.ReplaySearch, mode: ReplaySearchCommand): void;
20
- broadcast(message: BroadcastMessages.ReplaySetState, state: ReplayStateCommand): void;
21
- broadcast(message: BroadcastMessages.ReloadTextures, command: ReloadTexturesCommand, carIndex?: number): void;
22
- broadcast(message: BroadcastMessages.ChatCommand, command: ChatCommand, macro?: number): void;
23
- broadcast(message: BroadcastMessages.PitCommand, command: PitCommand, param?: number): void;
24
- broadcast(message: BroadcastMessages.TelemCommand, command: TelemetryCommand): void;
25
- broadcast(message: BroadcastMessages.FFBCommand, command: FFBCommand, value: number): void;
26
- broadcast(message: BroadcastMessages.ReplaySearchSessionTime, session: number, time: number): void;
27
- broadcast(message: BroadcastMessages.VideoCapture, command: VideoCaptureCommand): void;
28
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });