@moddable/typings 9.0.1 → 10.0.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.
Files changed (160) hide show
  1. package/DS18X20.d.ts +40 -0
  2. package/{embedded_io/system.d.ts → ResourceIterator.d.ts} +4 -15
  3. package/ble/bleclient.d.ts +1 -0
  4. package/ble/bleserver.d.ts +1 -0
  5. package/ble/btutils.d.ts +3 -0
  6. package/ble/connection.d.ts +1 -0
  7. package/ble/gap.d.ts +2 -0
  8. package/ble/gatt.d.ts +4 -0
  9. package/ble/hidclient.d.ts +5 -0
  10. package/ble/sm.d.ts +3 -0
  11. package/captiveportal.d.ts +71 -0
  12. package/commodetto/Poco.d.ts +10 -2
  13. package/commodetto/ReadGIF.d.ts +1 -1
  14. package/commodetto/outline.d.ts +4 -1
  15. package/commodetto/parseRLE.d.ts +1 -1
  16. package/commodetto/readJPEG.d.ts +1 -1
  17. package/config/analog.d.ts +31 -0
  18. package/config/digital.d.ts +32 -0
  19. package/config/dns.d.ts +33 -0
  20. package/config/dnssd.d.ts +31 -0
  21. package/config/files.d.ts +27 -0
  22. package/config/flash.d.ts +27 -0
  23. package/config/httpclient.d.ts +34 -0
  24. package/config/httpsclient.d.ts +34 -0
  25. package/config/httpserver.d.ts +33 -0
  26. package/config/i2c.d.ts +33 -0
  27. package/config/mqtt.d.ts +27 -0
  28. package/config/mqttclient.d.ts +31 -0
  29. package/config/mqttsclient.d.ts +32 -0
  30. package/config/ntp.d.ts +34 -0
  31. package/config/pulsecount.d.ts +30 -0
  32. package/config/pwm.d.ts +30 -0
  33. package/config/serial.d.ts +31 -0
  34. package/config/socket.d.ts +34 -0
  35. package/config/spi.d.ts +31 -0
  36. package/config/storage.d.ts +27 -0
  37. package/config/system.d.ts +27 -0
  38. package/config/tls.d.ts +30 -0
  39. package/config/update.d.ts +27 -0
  40. package/config/wsclient.d.ts +31 -0
  41. package/config/wssclient.d.ts +32 -0
  42. package/crc.d.ts +1 -1
  43. package/dns/server.d.ts +1 -0
  44. package/embedded/RTC/zephyr-builtin.d.ts +48 -0
  45. package/embedded/RTC.d.ts +18 -7
  46. package/embedded/display.d.ts +8 -3
  47. package/embedded/storage/files.d.ts +10 -7
  48. package/embedded/storage/flash.d.ts +2 -2
  49. package/embedded/storage/key-value.d.ts +27 -6
  50. package/embedded/system.d.ts +49 -0
  51. package/embedded_io/_common.d.ts +42 -3
  52. package/embedded_io/analog.d.ts +7 -7
  53. package/embedded_io/audio/in.d.ts +3 -2
  54. package/embedded_io/audio/out.d.ts +12 -4
  55. package/embedded_io/ble/central.d.ts +5 -4
  56. package/embedded_io/ble/peripheral.d.ts +6 -5
  57. package/embedded_io/crypt/digest.d.ts +2 -2
  58. package/embedded_io/digital.d.ts +4 -3
  59. package/embedded_io/digitalbank.d.ts +9 -5
  60. package/embedded_io/i2c.d.ts +9 -6
  61. package/embedded_io/image/in/camera.d.ts +82 -0
  62. package/embedded_io/pulsecount.d.ts +7 -5
  63. package/embedded_io/pwm.d.ts +11 -5
  64. package/embedded_io/serial.d.ts +33 -16
  65. package/embedded_io/smbus.d.ts +1 -1
  66. package/embedded_io/socket/listener.d.ts +3 -2
  67. package/embedded_io/socket/tcp/tls.d.ts +41 -12
  68. package/embedded_io/socket/tcp.d.ts +26 -12
  69. package/embedded_io/socket/udp.d.ts +17 -12
  70. package/embedded_io/spi.d.ts +8 -6
  71. package/embedded_network/dns/resolver/udp.d.ts +13 -6
  72. package/embedded_network/dns/server/udp.d.ts +39 -0
  73. package/embedded_network/dnssd.d.ts +9 -7
  74. package/embedded_network/http/client.d.ts +23 -8
  75. package/embedded_network/http/server/route/serversentevents.d.ts +48 -0
  76. package/embedded_network/http/server/route/static.d.ts +41 -0
  77. package/embedded_network/http/server/route/webdav.d.ts +42 -0
  78. package/embedded_network/http/server/route/ws/handshake.d.ts +28 -0
  79. package/embedded_network/http/server.d.ts +28 -6
  80. package/embedded_network/interface/ethernet.d.ts +3 -3
  81. package/embedded_network/interface/wifi/accesspoint.d.ts +2 -2
  82. package/embedded_network/interface/wifi.d.ts +21 -12
  83. package/embedded_network/mdns.d.ts +2 -2
  84. package/embedded_network/mqtt/client.d.ts +55 -16
  85. package/embedded_network/ntp/client.d.ts +16 -8
  86. package/embedded_network/websocket/client.d.ts +49 -29
  87. package/embedded_provider/builtin.d.ts +40 -34
  88. package/file.d.ts +4 -0
  89. package/flash.d.ts +1 -0
  90. package/global.d.ts +0 -3
  91. package/host/default.d.ts +31 -0
  92. package/host/esp32/moddable_six.d.ts +50 -0
  93. package/host/esp32/moddable_two.d.ts +55 -0
  94. package/host/generic.d.ts +47 -0
  95. package/host/index.d.ts +24 -0
  96. package/host/lin.d.ts +30 -0
  97. package/host/mac.d.ts +30 -0
  98. package/host/pebble.d.ts +70 -0
  99. package/host/win.d.ts +30 -0
  100. package/http.d.ts +2 -0
  101. package/mcpack.d.ts +20 -0
  102. package/mdns.d.ts +1 -0
  103. package/modules.d.ts +1 -1
  104. package/mqtt/js.d.ts +22 -4
  105. package/neopixel.d.ts +2 -2
  106. package/onewire.d.ts +31 -0
  107. package/package.json +14 -4
  108. package/pebble/accelerometer.d.ts +5 -5
  109. package/pebble/battery.d.ts +3 -3
  110. package/pebble/button.d.ts +2 -2
  111. package/pebble/compass.d.ts +3 -3
  112. package/pebble/dictation.d.ts +2 -2
  113. package/pebble/global.d.ts +37 -3
  114. package/pebble/health.d.ts +2 -2
  115. package/pebble/location.d.ts +2 -2
  116. package/pebble/message.d.ts +5 -5
  117. package/pebble/piu.d.ts +2 -57
  118. package/pebble/poco.d.ts +2 -2
  119. package/pebble/texture.d.ts +33 -0
  120. package/pebble/touch.d.ts +47 -0
  121. package/ping.d.ts +1 -0
  122. package/pins/analog.d.ts +1 -0
  123. package/pins/audioin.d.ts +1 -0
  124. package/pins/digital.d.ts +1 -0
  125. package/pins/i2c.d.ts +1 -0
  126. package/pins/pwm.d.ts +1 -0
  127. package/pins/rmt.d.ts +1 -0
  128. package/pins/servo.d.ts +1 -0
  129. package/pins/smbus.d.ts +1 -0
  130. package/piu/MC-types.d.ts +231 -97
  131. package/piu/MC.d.ts +2 -1
  132. package/piu/QRCode.d.ts +5 -0
  133. package/piu/RoundRect.d.ts +53 -0
  134. package/piu/SVGImage.d.ts +62 -0
  135. package/piu/Timeline.d.ts +17 -21
  136. package/pococolorcell.d.ts +25 -0
  137. package/pocoqrcode.d.ts +25 -0
  138. package/pocostatic.d.ts +25 -0
  139. package/preference.d.ts +1 -0
  140. package/securesocket.d.ts +1 -0
  141. package/sntp.d.ts +1 -0
  142. package/socket.d.ts +6 -0
  143. package/ssl/session.d.ts +60 -0
  144. package/time.d.ts +1 -1
  145. package/tsconfig.es2024.json +0 -1
  146. package/tsconfig.es2025.json +1 -1
  147. package/web/bluetooth.d.ts +112 -0
  148. package/web/decompressionstream.d.ts +1 -1
  149. package/web/eventsource.d.ts +12 -7
  150. package/web/fetch-streams.d.ts +57 -0
  151. package/web/fetch.d.ts +1 -1
  152. package/web/serial.d.ts +58 -0
  153. package/web/websocket.d.ts +18 -13
  154. package/web/webstorage.d.ts +3 -0
  155. package/web/worker.d.ts +2 -0
  156. package/websocket.d.ts +2 -0
  157. package/wifi.d.ts +1 -0
  158. package/xs.d.ts +54 -6
  159. package/display.d.ts +0 -68
  160. package/pebble/device.d.ts +0 -51
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ // modules/piu/MC/outline/piuSVGImage.js (and the same content on Pebble)
22
+
23
+ declare module "piu/SVGImage" {
24
+ import { Content, ContentDictionary } from "piu/MC";
25
+
26
+ interface SVGImage extends Content {
27
+ opacity: number;
28
+ center(x: number, y: number): void;
29
+ cx: number;
30
+ cy: number;
31
+ rotate(a: number): void;
32
+ r: number;
33
+ scale(x: number, y: number): void;
34
+ s: number;
35
+ sx: number;
36
+ sy: number;
37
+ translate(x: number, y: number): void;
38
+ tx: number;
39
+ ty: number;
40
+ }
41
+ interface SVGImageDictionary extends ContentDictionary {
42
+ clip?: boolean;
43
+ /** the path of the SVG resource */
44
+ path?: string;
45
+ /** the SVG resource itself, as parsed by load */
46
+ resource?: object;
47
+ }
48
+ interface SVGImageConstructor {
49
+ new(behaviorData?: any, dictionary?: SVGImageDictionary): SVGImage;
50
+ (behaviorData?: any, dictionary?: SVGImageDictionary): SVGImage;
51
+
52
+ template<T>(this: T, fn: (arg: any) => SVGImageDictionary): T;
53
+ }
54
+ const SVGImage: SVGImageConstructor;
55
+
56
+ global {
57
+ const SVGImage: SVGImageConstructor
58
+ }
59
+
60
+ export { SVGImage };
61
+ export default SVGImage;
62
+ }
package/piu/Timeline.d.ts CHANGED
@@ -19,32 +19,28 @@
19
19
  */
20
20
 
21
21
  declare module "piu/Timeline" {
22
+ type Easing = ((fraction: number) => number) | null;
23
+
24
+ export class Tween {
25
+ constructor(target: object, properties: object, duration: number, easing?: Easing, delay?: number);
26
+ static from(target: object, fromProperties: object, duration: number, easing?: Easing, delay?: number): Tween;
27
+ static on(target: object, onProperties: object, duration: number, easing?: Easing, delay?: number): Tween;
28
+ static to(target: object, toProperties: object, duration: number, easing?: Easing, delay?: number): Tween;
29
+ delay: number;
30
+ duration: number;
31
+ easing: Easing;
32
+ seekTo(time: number): void;
33
+ }
34
+
22
35
  class Timeline {
23
36
  duration: number;
24
37
  fraction: number;
25
38
  time: number;
26
- from(
27
- target: object,
28
- fromProperties: object,
29
- duration: number,
30
- easing?: (fraction: number) => number,
31
- delay?: number
32
- ): Timeline;
33
- on(
34
- target: object,
35
- onProperties: object,
36
- duration: number,
37
- easing?: (fraction: number) => number,
38
- delay?: number
39
- ): Timeline;
39
+ add(tween: Tween, when?: number): Timeline;
40
+ from(target: object, fromProperties: object, duration: number, easing?: Easing, delay?: number, when?: number): Timeline;
41
+ on(target: object, onProperties: object, duration: number, easing?: Easing, delay?: number, when?: number): Timeline;
40
42
  seekTo(time: number): void;
41
- to(
42
- target: object,
43
- fromProperties: object,
44
- duration: number,
45
- easing?: (fraction: number) => number,
46
- delay?: number
47
- ): Timeline;
43
+ to(target: object, toProperties: object, duration: number, easing?: Easing, delay?: number, when?: number): Timeline;
48
44
  }
49
45
  export { Timeline as default }
50
46
  }
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright (c) 2025 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ declare module "commodetto/Poco" {
22
+ interface PocoPrototype {
23
+ drawFrame(frame: ArrayBuffer | HostBuffer, stream: { width: number, height: number, pixelFormat: number }, x: number, y: number): void
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright (c) 2025 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ declare module "commodetto/Poco" {
22
+ interface PocoPrototype {
23
+ drawQRCode(qrcode:ArrayBuffer, x: number, y: number, scale: number, fore: number): void
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ /*
2
+ * Copyright (c) 2025 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ declare module "commodetto/Poco" {
22
+ interface PocoPrototype {
23
+ fillStatic(x: number, y: number, width: number, height: number, brightness?: number): void
24
+ }
25
+ }
package/preference.d.ts CHANGED
@@ -19,6 +19,7 @@
19
19
  */
20
20
 
21
21
  declare module "preference" {
22
+ /** @deprecated Use the ECMA-419 key-value store, embedded:storage/key-value (see guides/key-value) */
22
23
  var Preference: {
23
24
  set: (domain: string, key: string, value: string | boolean | number | ArrayBuffer) => void;
24
25
  get: (domain: string, key: string) => string | boolean | number | ArrayBuffer | undefined;
package/securesocket.d.ts CHANGED
@@ -23,6 +23,7 @@ declare module "securesocket" {
23
23
 
24
24
  type WriteData = number | string | ByteBuffer;
25
25
 
26
+ /** @deprecated Use the ECMA-419 TLS socket, embedded:io/socket/tcp/tls */
26
27
  export default class SecureSocket {
27
28
  sock: typeof Socket;
28
29
 
package/sntp.d.ts CHANGED
@@ -31,6 +31,7 @@ declare module "sntp" {
31
31
  SNTPRetry
32
32
  )
33
33
  type SNTPCallback = (message: SNTPCallbackMessage, value?: number) => void;
34
+ /** @deprecated Use the ECMA-419 NTP client, embedded:network/ntp/client */
34
35
  class SNTP {
35
36
  static readonly time: SNTPTimeRetrieved;
36
37
  static readonly retry: SNTPRetry;
package/socket.d.ts CHANGED
@@ -58,6 +58,7 @@ declare module "socket" {
58
58
  MessageDataReceived |
59
59
  MessageDataSent
60
60
  );
61
+ /** @deprecated Use the ECMA-419 sockets, embedded:io/socket/tcp, embedded:io/socket/udp and embedded:io/socket/listener */
61
62
  abstract class SocketBase {
62
63
  close(): void;
63
64
  read<T extends typeof String | typeof ArrayBuffer>(
@@ -66,14 +67,17 @@ declare module "socket" {
66
67
  ): T extends typeof String ? string : ArrayBuffer;
67
68
  callback: (message: MessageStatus, value?: number) => void;
68
69
  }
70
+ /** @deprecated Use the ECMA-419 sockets, embedded:io/socket/tcp, embedded:io/socket/udp and embedded:io/socket/listener */
69
71
  class RawSocket extends SocketBase {
70
72
  write(ip: string, data: ArrayBuffer): void;
71
73
  write(): number;
72
74
  }
75
+ /** @deprecated Use the ECMA-419 sockets, embedded:io/socket/tcp, embedded:io/socket/udp and embedded:io/socket/listener */
73
76
  class TCPSocket extends SocketBase {
74
77
  write(data: WriteData, ...moreData: WriteData[]): void;
75
78
  write(): number;
76
79
  }
80
+ /** @deprecated Use the ECMA-419 sockets, embedded:io/socket/tcp, embedded:io/socket/udp and embedded:io/socket/listener */
77
81
  class UDPSocket extends SocketBase {
78
82
  write(ip: string, port: number, data: ArrayBuffer): void;
79
83
  write(): number;
@@ -82,11 +86,13 @@ declare module "socket" {
82
86
  port?: number,
83
87
  address?: string
84
88
  };
89
+ /** @deprecated Use the ECMA-419 sockets, embedded:io/socket/tcp, embedded:io/socket/udp and embedded:io/socket/listener */
85
90
  class Listener {
86
91
  constructor(options: ListenerOptions);
87
92
  callback: (this: Listener) => void;
88
93
  }
89
94
  type Socket = RawSocket | TCPSocket | UDPSocket;
95
+ /** @deprecated Use the ECMA-419 sockets, embedded:io/socket/tcp, embedded:io/socket/udp and embedded:io/socket/listener */
90
96
  var Socket: {
91
97
  new <T extends RawSocketOptions | TCPSocketOptions | UDPSocketOptions>(
92
98
  dictionary: T
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ declare module "ssl/session" {
22
+ // the socket a session reads and writes through: the session consumes readable as it reads, and updates writable as it writes
23
+ export interface SSLSessionSocket {
24
+ readable: number;
25
+ writable: number;
26
+ read(buffer: Uint8Array): unknown;
27
+ write(buffer: ByteBuffer): number;
28
+ }
29
+
30
+ export interface SSLSessionOptions {
31
+ protocolVersion?: number;
32
+ minProtocolVersion?: number;
33
+ maxProtocolVersion?: number;
34
+ certificate?: ByteBuffer | ByteBuffer[]; // trusted CA certificates
35
+ clientCertificates?: ByteBuffer[];
36
+ clientKey?: ByteBuffer;
37
+ verify?: boolean;
38
+ trace?: boolean;
39
+ cache?: boolean;
40
+ clientAuth?: { cipherSuites: unknown; subjectDN: unknown };
41
+ serverName?: string; // session_original: alias of tls_server_name
42
+ applicationLayerProtocolNegotiation?: string | ByteBuffer | (string | ByteBuffer)[]; // session_original: alias
43
+ tls_server_name?: string;
44
+ tls_max_fragment_length?: number;
45
+ tls_application_layer_protocol_negotiation?: string | ByteBuffer | (string | ByteBuffer)[];
46
+ tls_elliptic_curves?: number[];
47
+ tls_signature_algorithms?: { hash: number; sig: number }[];
48
+ [extension: `tls_${string}`]: unknown; // the handshake sends every tls_ option it recognizes as an extension
49
+ }
50
+
51
+ class SSLSession {
52
+ constructor(options?: SSLSessionOptions);
53
+ initiateHandshake(socket?: SSLSessionSocket): void;
54
+ handshake(socket: SSLSessionSocket, count?: number): boolean; // true when complete
55
+ read(socket: SSLSessionSocket, count?: number): Uint8Array | null | undefined; // undefined: nothing yet; null: closed
56
+ write(socket: SSLSessionSocket, data: ByteBuffer, options?: { more?: boolean; byteLength?: number }): number;
57
+ close(socket: SSLSessionSocket): void;
58
+ }
59
+ export default SSLSession;
60
+ }
package/time.d.ts CHANGED
@@ -25,7 +25,7 @@ declare module "time" {
25
25
  ) => void,
26
26
  timezone: number;
27
27
  dst: number;
28
- ticks: number;
28
+ readonly ticks: number;
29
29
  delta(start: number, end?: number): number;
30
30
  readonly microseconds?: number;
31
31
  }
@@ -5,7 +5,6 @@
5
5
  "module": "preserve",
6
6
  "moduleResolution": "bundler",
7
7
  "target": "ES2024",
8
- "baseUrl": ".",
9
8
  "paths": {
10
9
  "embedded:io/*": ["./embedded_io/*"],
11
10
  "embedded:io/socket/*": ["./embedded_io/socket/*"],
@@ -1,5 +1,5 @@
1
1
  {
2
- "_comment": "ES2025 overrides on top of the ES2024 base. Used when TypeScript >= 6 (see typesVersions in package.json).",
2
+ "_comment": "ES2025 overrides on top of the ES2024 base. This is tsconfig.base.json (see typesVersions in package.json). TypeScript 6 or later is required.",
3
3
  "extends": "./tsconfig.es2024.json",
4
4
  "compilerOptions": {
5
5
  "lib": ["es2025", "esnext.disposable"],
@@ -0,0 +1,112 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ // Web Bluetooth (https://webbluetoothcg.github.io/web-bluetooth/): the subset implemented by modules/io/ble/web-bluetooth
22
+ declare module "web-bluetooth" {
23
+ // a 16- or 32-bit alias, a full 128-bit UUID string, or a name from the GATT assigned numbers (or config.webbluetooth)
24
+ export type BluetoothServiceUUID = number | string;
25
+ export type BluetoothCharacteristicUUID = number | string;
26
+ export type BluetoothDescriptorUUID = number | string;
27
+
28
+ export class BluetoothUUID {
29
+ static canonicalUUID(alias: number): string;
30
+ static getService(name: BluetoothServiceUUID): string;
31
+ static getCharacteristic(name: BluetoothCharacteristicUUID): string;
32
+ static getDescriptor(name: BluetoothDescriptorUUID): string;
33
+ }
34
+
35
+ export interface BluetoothLEScanFilter {
36
+ name?: string;
37
+ services?: BluetoothServiceUUID[];
38
+ }
39
+
40
+ export interface RequestDeviceOptions {
41
+ filters?: BluetoothLEScanFilter[];
42
+ }
43
+
44
+ export const bluetooth: {
45
+ requestDevice(options?: RequestDeviceOptions): Promise<BluetoothDevice>;
46
+ };
47
+
48
+ export class BluetoothDevice {
49
+ constructor(address: string, name?: string); // Moddable SDK extension: a device discovered by other means, such as GAPClient
50
+ readonly id: string;
51
+ readonly name: string;
52
+ readonly gatt: BluetoothRemoteGATTServer;
53
+ }
54
+
55
+ export interface BluetoothRemoteGATTServer {
56
+ readonly device: BluetoothDevice;
57
+ readonly connected: boolean;
58
+ connect(): Promise<BluetoothRemoteGATTServer>;
59
+ disconnect(): void;
60
+ getPrimaryService(service: BluetoothServiceUUID): Promise<BluetoothRemoteGATTService>;
61
+ getPrimaryServices(services?: BluetoothServiceUUID[]): Promise<BluetoothRemoteGATTService[]>;
62
+ }
63
+
64
+ export interface BluetoothRemoteGATTService {
65
+ readonly device: BluetoothDevice;
66
+ readonly uuid: string;
67
+ readonly isPrimary: boolean;
68
+ getCharacteristic(characteristic: BluetoothCharacteristicUUID): Promise<BluetoothRemoteGATTCharacteristic>;
69
+ getCharacteristics(characteristics?: BluetoothCharacteristicUUID[]): Promise<BluetoothRemoteGATTCharacteristic[]>;
70
+ }
71
+
72
+ export interface BluetoothCharacteristicProperties {
73
+ readonly authenticatedSignedWrites: boolean;
74
+ readonly broadcast: boolean;
75
+ readonly indicate: boolean;
76
+ readonly notify: boolean;
77
+ readonly read: boolean;
78
+ readonly reliableWrite: boolean;
79
+ readonly write: boolean;
80
+ readonly writeWithoutResponse: boolean;
81
+ }
82
+
83
+ // the characteristic's value is always present in its characteristicvaluechanged event
84
+ export interface BluetoothCharacteristicValueChangedEvent {
85
+ readonly target: BluetoothRemoteGATTCharacteristic & { readonly value: DataView };
86
+ }
87
+
88
+ export interface BluetoothRemoteGATTCharacteristic {
89
+ readonly service: BluetoothRemoteGATTService;
90
+ readonly uuid: string;
91
+ readonly properties: BluetoothCharacteristicProperties;
92
+ readonly value: DataView | undefined; // the most recently read or notified value
93
+ getDescriptor(descriptor: BluetoothDescriptorUUID): Promise<BluetoothRemoteGATTDescriptor>;
94
+ getDescriptors(descriptors?: BluetoothDescriptorUUID[]): Promise<BluetoothRemoteGATTDescriptor[]>;
95
+ readValue(): Promise<DataView>;
96
+ writeValue(value: ByteBuffer): Promise<void>; // without response
97
+ writeValueWithResponse(value: ByteBuffer): Promise<void>;
98
+ writeValueWithoutResponse(value: ByteBuffer): Promise<void>;
99
+ startNotifications(): Promise<BluetoothRemoteGATTCharacteristic>;
100
+ stopNotifications(): Promise<BluetoothRemoteGATTCharacteristic>;
101
+ addEventListener(type: "characteristicvaluechanged", listener: (event: BluetoothCharacteristicValueChangedEvent) => void): void;
102
+ removeEventListener(type: "characteristicvaluechanged", listener: (event: BluetoothCharacteristicValueChangedEvent) => void): void;
103
+ }
104
+
105
+ export interface BluetoothRemoteGATTDescriptor {
106
+ readonly characteristic: BluetoothRemoteGATTCharacteristic;
107
+ readonly uuid: string;
108
+ readonly value: DataView | undefined;
109
+ readValue(): Promise<DataView>;
110
+ writeValue(value: ByteBuffer): Promise<void>;
111
+ }
112
+ }
@@ -21,7 +21,7 @@
21
21
  declare module "web/decompressionstream" {
22
22
  import type { ReadableStream, WritableStream } from "web/streams";
23
23
 
24
- type DecompressionFormat = "deflate" | "deflate-raw" | "gzip";
24
+ export type DecompressionFormat = "deflate" | "deflate-raw" | "gzip";
25
25
 
26
26
  class DecompressionStream {
27
27
  constructor(format: DecompressionFormat);
@@ -23,7 +23,7 @@ declare module "web/eventsource" {
23
23
 
24
24
  interface EventSourceInit {
25
25
  method?: string;
26
- headers?: Headers | Record<string, string>;
26
+ headers?: Headers | Map<string, string>;
27
27
  body?: string | ArrayBuffer;
28
28
  }
29
29
 
@@ -58,13 +58,13 @@ declare module "web/eventsource" {
58
58
  readonly readyState: number;
59
59
  readonly url: string;
60
60
 
61
- onerror?(event: EventSourceErrorEvent): void;
62
- onopen?(event: EventSourceEvent): void;
63
- onmessage?(event: EventSourceMessageEvent): void;
61
+ onerror: ((this: EventSource, event: EventSourceErrorEvent) => void) | null;
62
+ onopen: ((this: EventSource, event: EventSourceEvent) => void) | null;
63
+ onmessage: ((this: EventSource, event: EventSourceMessageEvent) => void) | null;
64
64
 
65
- addEventListener(type: "open", listener: (event: EventSourceEvent) => void): void;
66
- addEventListener(type: "error", listener: (event: EventSourceErrorEvent) => void): void;
67
- addEventListener(type: "message", listener: (event: EventSourceMessageEvent) => void): void;
65
+ addEventListener(type: "open", listener: (this: EventSource, event: EventSourceEvent) => void): void;
66
+ addEventListener(type: "error", listener: (this: EventSource, event: EventSourceErrorEvent) => void): void;
67
+ addEventListener(type: "message", listener: (this: EventSource, event: EventSourceMessageEvent) => void): void;
68
68
  addEventListener(type: string, listener: (event: EventSourceMessageEvent) => void): void;
69
69
 
70
70
  removeEventListener(type: string, listener: EventSourceEventListener): void;
@@ -74,3 +74,8 @@ declare module "web/eventsource" {
74
74
 
75
75
  export default EventSource;
76
76
  }
77
+
78
+ // the specifier of the module in the Moddable SDK runtime
79
+ declare module "eventsource" {
80
+ export { default } from "web/eventsource";
81
+ }
@@ -0,0 +1,57 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ // the manifest that supplies this module includes the manifests of these configurations
22
+ /// <reference path="../config/httpsclient.d.ts" />
23
+
24
+ // fetch implemented with web streams (examples/web/streams/fetch)
25
+ declare module "web/fetch/streams" {
26
+ import {URL, URLSearchParams} from "url"
27
+ import Headers from "headers"
28
+ import type {ReadableStream} from "web/streams"
29
+ import type {AbortSignal} from "web/abortsignal"
30
+
31
+ class Response {
32
+ // the stream is returned once: body is undefined after it has been read
33
+ get body(): ReadableStream<Uint8Array> | undefined;
34
+ get bodyUsed(): boolean;
35
+ get headers(): Headers;
36
+ get ok(): boolean;
37
+ get redirected(): boolean;
38
+ get status(): number;
39
+ get statusText(): string;
40
+ get url(): string;
41
+ arrayBuffer(): Promise<ArrayBuffer>;
42
+ json(): Promise<any>;
43
+ text(): Promise<string>;
44
+ }
45
+
46
+ interface RequestInit {
47
+ method?: string;
48
+ headers?: Headers | Record<string, string>;
49
+ body?: string | ByteBuffer | URLSearchParams | ReadableStream;
50
+ signal?: AbortSignal;
51
+ }
52
+
53
+ function fetch(resource: string | URL, options?: RequestInit): Promise<Response>;
54
+
55
+ export { fetch, Headers };
56
+ export default fetch;
57
+ }
package/web/fetch.d.ts CHANGED
@@ -43,6 +43,6 @@ declare module "fetch" {
43
43
 
44
44
  function fetch(resource: string | URL, options?: RequestInit): Promise<Response>;
45
45
 
46
- export { fetch };
46
+ export { fetch, Headers };
47
47
  export default fetch;
48
48
  }
@@ -0,0 +1,58 @@
1
+ /*
2
+ * Copyright (c) 2026 Moddable Tech, Inc.
3
+ *
4
+ * This file is part of the Moddable SDK Tools.
5
+ *
6
+ * The Moddable SDK Tools is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * The Moddable SDK Tools is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with the Moddable SDK Tools. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ */
20
+
21
+ // Web Serial (https://wicg.github.io/serial/): the subset implemented by modules/web/serial
22
+ declare module "web/serial" {
23
+ import type { ReadableStream, WritableStream } from "web/streams";
24
+
25
+ export interface SerialOptions {
26
+ baudRate: number;
27
+ bufferSize?: number; // 1 to 16384, default 255
28
+ dataBits?: 8; // the only value supported
29
+ stopBits?: 1; // the only value supported
30
+ parity?: "none"; // the only value supported
31
+ }
32
+
33
+ export interface SerialOutputSignals {
34
+ dataTerminalReady?: boolean;
35
+ requestToSend?: boolean;
36
+ break?: false; // break is not supported
37
+ }
38
+
39
+ export interface SerialPortInfo {
40
+ usbVendorId?: number;
41
+ usbProductId?: number;
42
+ }
43
+
44
+ export interface SerialPort {
45
+ readonly connected: boolean;
46
+ readonly readable: ReadableStream<Uint8Array> | null; // a byte stream: getReader({ mode: "byob" }) is supported
47
+ readonly writable: WritableStream<ByteBuffer> | null;
48
+ getInfo(): SerialPortInfo;
49
+ open(options: SerialOptions): Promise<void>;
50
+ setSignals(signals: SerialOutputSignals): Promise<void>;
51
+ close(): Promise<void>;
52
+ forget(): Promise<void>;
53
+ }
54
+
55
+ export const serial: {
56
+ requestPort(): Promise<SerialPort>;
57
+ };
58
+ }