@mikrojs/native 0.18.2 → 0.19.0-pr-352.20260829215534

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.
Files changed (43) hide show
  1. package/CMakeLists.txt +25 -2
  2. package/include/mikrojs/mem.h +4 -0
  3. package/include/mikrojs/ota_client.h +3 -3
  4. package/include/mikrojs/platform.h +8 -0
  5. package/include/mikrojs/private.h +28 -0
  6. package/package.json +4 -5
  7. package/prebuilds/darwin-arm64/mikrojs.napi.node +0 -0
  8. package/prebuilds/linux-arm64/mikrojs.napi.node +0 -0
  9. package/prebuilds/linux-x64/mikrojs.napi.node +0 -0
  10. package/runtime/http/helpers.ts +5 -0
  11. package/runtime/internal.d.ts +41 -2
  12. package/runtime/ota/client.ts +4 -0
  13. package/runtime/ota/ota.ts +4 -0
  14. package/runtime/ota/types.ts +75 -0
  15. package/runtime/schema/schema.ts +25 -3
  16. package/runtime/schema/types.ts +193 -15
  17. package/runtime/sys/types.ts +11 -1
  18. package/runtime/test/test.ts +6 -2
  19. package/runtime/wifi/types.ts +3 -0
  20. package/scripts/gen-schema-fixtures.js +317 -0
  21. package/src/mem.cpp +83 -37
  22. package/src/mik_app_config.cpp +9 -1
  23. package/src/mik_http_client.cpp +1357 -0
  24. package/src/mik_ota_client.cpp +3 -3
  25. package/src/mik_repl.cpp +44 -5
  26. package/src/mik_schema.cpp +892 -0
  27. package/src/mik_sys.cpp +9 -1
  28. package/src/mik_wifi_client.cpp +742 -0
  29. package/src/mikrojs.cpp +34 -8
  30. package/src/modules.cpp +66 -0
  31. package/dist/runtime/schema/core.d.ts +0 -115
  32. package/dist/runtime/schema/core.d.ts.map +0 -1
  33. package/dist/runtime/schema/core.js +0 -259
  34. package/dist/runtime/schema/core.js.map +0 -1
  35. package/dist/runtime/schema/shared.d.ts +0 -54
  36. package/dist/runtime/schema/shared.d.ts.map +0 -1
  37. package/dist/runtime/schema/shared.js +0 -489
  38. package/dist/runtime/schema/shared.js.map +0 -1
  39. package/runtime/http/native.ts +0 -160
  40. package/runtime/http/request.ts +0 -25
  41. package/runtime/schema/core.ts +0 -539
  42. package/runtime/schema/shared.ts +0 -494
  43. package/runtime/wifi/wifi.ts +0 -191
package/src/mik_sys.cpp CHANGED
@@ -187,15 +187,23 @@ static JSValue mik__sys_board(JSContext* ctx) {
187
187
  JS_SetPropertyStr(ctx, obj, "cores", JS_NewInt32(ctx, chip_info.cores));
188
188
  JS_SetPropertyStr(ctx, obj, "revision", JS_NewInt32(ctx, chip_info.revision));
189
189
 
190
- /* Features as string array */
190
+ /* Features as string array. Callers use this to decide whether an
191
+ * optional module will work, so a radio only counts when the silicon
192
+ * has it AND the stack behind it was compiled in. */
191
193
  JSValue features = JS_NewArray(ctx);
192
194
  uint32_t fi = 0;
195
+ #ifdef CONFIG_ESP_WIFI_ENABLED
193
196
  if (chip_info.features & CHIP_FEATURE_WIFI_BGN)
194
197
  JS_SetPropertyUint32(ctx, features, fi++, JS_NewString(ctx, "wifi"));
198
+ #endif
199
+ #ifdef CONFIG_BT_ENABLED
195
200
  if (chip_info.features & CHIP_FEATURE_BLE)
196
201
  JS_SetPropertyUint32(ctx, features, fi++, JS_NewString(ctx, "ble"));
197
202
  if (chip_info.features & CHIP_FEATURE_BT)
198
203
  JS_SetPropertyUint32(ctx, features, fi++, JS_NewString(ctx, "bt"));
204
+ #endif
205
+ /* No stack to gate on: mikrojs has no 802.15.4 API, so this stays a
206
+ * plain silicon report. */
199
207
  if (chip_info.features & CHIP_FEATURE_IEEE802154)
200
208
  JS_SetPropertyUint32(ctx, features, fi++, JS_NewString(ctx, "ieee802154"));
201
209
  JS_SetPropertyStr(ctx, obj, "features", features);