expo 54.0.0-canary-20250722-599a28f → 54.0.0-canary-20250826-f475166

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 (99) hide show
  1. package/android/build.gradle +2 -2
  2. package/android/src/main/java/expo/modules/ExpoReactHostFactory.kt +1 -7
  3. package/android/src/main/java/expo/modules/ReactActivityDelegateWrapper.kt +33 -8
  4. package/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt +0 -5
  5. package/android/src/test/resources/robolectric.properties +1 -0
  6. package/build/Expo.d.ts +9 -1
  7. package/build/Expo.d.ts.map +1 -1
  8. package/build/async-require/fetchAsync.native.d.ts.map +1 -1
  9. package/build/async-require/hmr.d.ts.map +1 -1
  10. package/build/winter/FormData.d.ts.map +1 -1
  11. package/build/winter/fetch/FetchResponse.d.ts +2 -2
  12. package/build/winter/fetch/FetchResponse.d.ts.map +1 -1
  13. package/build/winter/fetch/NativeRequest.d.ts +1 -1
  14. package/build/winter/fetch/NativeRequest.d.ts.map +1 -1
  15. package/build/winter/fetch/RequestUtils.d.ts.map +1 -1
  16. package/build/winter/fetch/convertFormData.d.ts.map +1 -1
  17. package/build/winter/installGlobal.d.ts +25 -0
  18. package/build/winter/installGlobal.d.ts.map +1 -0
  19. package/bundledNativeModules.json +97 -96
  20. package/devtools.d.ts +1 -1
  21. package/devtools.js +1 -1
  22. package/internal/babel-preset.d.ts +2 -0
  23. package/internal/babel-preset.js +2 -0
  24. package/internal/install-global.d.ts +2 -0
  25. package/internal/install-global.js +5 -0
  26. package/internal/unstable-autolinking-exports.d.ts +2 -0
  27. package/internal/unstable-autolinking-exports.js +2 -0
  28. package/internal/unstable-expo-updates-cli-exports.d.ts +2 -0
  29. package/internal/unstable-expo-updates-cli-exports.js +2 -0
  30. package/ios/AppDelegates/ExpoAppDelegate.swift +1 -1
  31. package/ios/AppDelegates/ExpoReactNativeFactory.swift +15 -2
  32. package/ios/AppDelegates/ExpoReactNativeFactoryDelegate.swift +1 -1
  33. package/ios/AppDelegates/RCTAppDelegateUmbrella.h +5 -0
  34. package/ios/Fetch/ExpoFetchCustomExtension.swift +1 -1
  35. package/ios/Fetch/ExpoFetchModule.swift +3 -3
  36. package/ios/Fetch/ExpoURLSessionTask.swift +2 -2
  37. package/ios/Fetch/NativeRequest.swift +1 -1
  38. package/ios/Fetch/NativeResponse.swift +2 -2
  39. package/package.json +29 -27
  40. package/src/Expo.ts +4 -0
  41. package/src/async-require/fetchAsync.native.ts +48 -10
  42. package/src/async-require/hmr.ts +1 -2
  43. package/src/async-require/messageSocket.native.ts +0 -3
  44. package/src/winter/FormData.ts +1 -9
  45. package/src/winter/__tests__/structuredClone.test.ios.ts +27 -0
  46. package/src/winter/fetch/FetchResponse.ts +4 -4
  47. package/src/winter/fetch/NativeRequest.ts +1 -1
  48. package/src/winter/fetch/RequestUtils.ts +15 -1
  49. package/src/winter/fetch/__tests__/RequestUtils-test.ts +7 -7
  50. package/src/winter/fetch/__tests__/convertFormData-test.native.ts +1 -3
  51. package/src/winter/fetch/convertFormData.ts +56 -27
  52. package/src/winter/installGlobal.ts +109 -0
  53. package/src/winter/runtime.native.ts +4 -20
  54. package/template.tgz +0 -0
  55. package/build/devtools/DevToolsPluginClient.d.ts +0 -72
  56. package/build/devtools/DevToolsPluginClient.d.ts.map +0 -1
  57. package/build/devtools/DevToolsPluginClientFactory.d.ts +0 -16
  58. package/build/devtools/DevToolsPluginClientFactory.d.ts.map +0 -1
  59. package/build/devtools/DevToolsPluginClientImplApp.d.ts +0 -15
  60. package/build/devtools/DevToolsPluginClientImplApp.d.ts.map +0 -1
  61. package/build/devtools/DevToolsPluginClientImplBrowser.d.ts +0 -14
  62. package/build/devtools/DevToolsPluginClientImplBrowser.d.ts.map +0 -1
  63. package/build/devtools/MessageFramePacker.d.ts +0 -50
  64. package/build/devtools/MessageFramePacker.d.ts.map +0 -1
  65. package/build/devtools/ProtocolVersion.d.ts +0 -7
  66. package/build/devtools/ProtocolVersion.d.ts.map +0 -1
  67. package/build/devtools/WebSocketBackingStore.d.ts +0 -10
  68. package/build/devtools/WebSocketBackingStore.d.ts.map +0 -1
  69. package/build/devtools/WebSocketWithReconnect.d.ts +0 -81
  70. package/build/devtools/WebSocketWithReconnect.d.ts.map +0 -1
  71. package/build/devtools/devtools.types.d.ts +0 -42
  72. package/build/devtools/devtools.types.d.ts.map +0 -1
  73. package/build/devtools/getConnectionInfo.d.ts +0 -6
  74. package/build/devtools/getConnectionInfo.d.ts.map +0 -1
  75. package/build/devtools/getConnectionInfo.native.d.ts +0 -6
  76. package/build/devtools/getConnectionInfo.native.d.ts.map +0 -1
  77. package/build/devtools/index.d.ts +0 -12
  78. package/build/devtools/index.d.ts.map +0 -1
  79. package/build/devtools/logger.d.ts +0 -6
  80. package/build/devtools/logger.d.ts.map +0 -1
  81. package/src/devtools/DevToolsPluginClient.ts +0 -240
  82. package/src/devtools/DevToolsPluginClientFactory.ts +0 -73
  83. package/src/devtools/DevToolsPluginClientImplApp.ts +0 -56
  84. package/src/devtools/DevToolsPluginClientImplBrowser.ts +0 -38
  85. package/src/devtools/MessageFramePacker.ts +0 -235
  86. package/src/devtools/ProtocolVersion.ts +0 -6
  87. package/src/devtools/WebSocketBackingStore.ts +0 -10
  88. package/src/devtools/WebSocketWithReconnect.ts +0 -318
  89. package/src/devtools/__tests__/DevToolsPluginClient-test.ts +0 -285
  90. package/src/devtools/__tests__/DevToolsPluginClientFactory-test.ts +0 -120
  91. package/src/devtools/__tests__/MessageFramePack-test.node.ts +0 -157
  92. package/src/devtools/__tests__/MockWebSocket.ts +0 -100
  93. package/src/devtools/__tests__/WebSocketWithReconnect-test.node.ts +0 -184
  94. package/src/devtools/__tests__/logger-test.ts +0 -20
  95. package/src/devtools/devtools.types.ts +0 -50
  96. package/src/devtools/getConnectionInfo.native.ts +0 -18
  97. package/src/devtools/getConnectionInfo.ts +0 -16
  98. package/src/devtools/index.ts +0 -53
  99. package/src/devtools/logger.ts +0 -29
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Copyright © 2025 650 Industries.
3
+ * Copyright © Meta Platforms, Inc. and affiliates.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ *
8
+ * Fork of unexposed react-native module
9
+ * https://github.com/facebook/react-native/blob/c5fb371061c1083684a23aa0852f6dbfb74a8b52/packages/react-native/Libraries/Utilities/PolyfillFunctions.js#L1
10
+ */
11
+
12
+ // Add a well-known shared symbol that doesn't show up in iteration or inspection
13
+ // this can be used to detect if the global object abides by the Expo team's documented
14
+ // built-in requirements.
15
+ const BUILTIN_SYMBOL = Symbol.for('expo.builtin');
16
+
17
+ /** Defines a lazily evaluated property on the supplied `object` */
18
+ function defineLazyObjectProperty<T>(
19
+ object: object,
20
+ name: string,
21
+ descriptor: {
22
+ get: () => T;
23
+ enumerable?: boolean;
24
+ writable?: boolean;
25
+ }
26
+ ): void {
27
+ const { get } = descriptor;
28
+ const enumerable = descriptor.enumerable !== false;
29
+ const writable = descriptor.writable !== false;
30
+
31
+ let value: any;
32
+ let valueSet = false;
33
+ function getValue(): T {
34
+ // WORKAROUND: A weird infinite loop occurs where calling `getValue` calls
35
+ // `setValue` which calls `Object.defineProperty` which somehow triggers
36
+ // `getValue` again. Adding `valueSet` breaks this loop.
37
+ if (!valueSet) {
38
+ // Calling `get()` here can trigger an infinite loop if it fails to
39
+ // remove the getter on the property, which can happen when executing
40
+ // JS in a V8 context. `valueSet = true` will break this loop, and
41
+ // sets the value of the property to undefined, until the code in `get()`
42
+ // finishes, at which point the property is set to the correct value.
43
+ valueSet = true;
44
+ setValue(get());
45
+ }
46
+ return value;
47
+ }
48
+ function setValue(newValue: T): void {
49
+ value = newValue;
50
+ valueSet = true;
51
+ Object.defineProperty(object, name, {
52
+ value: newValue,
53
+ configurable: true,
54
+ enumerable,
55
+ writable,
56
+ });
57
+ }
58
+
59
+ Object.defineProperty(object, name, {
60
+ get: getValue,
61
+ set: setValue,
62
+ configurable: true,
63
+ enumerable,
64
+ });
65
+ }
66
+
67
+ /**
68
+ * Sets an object's property. If a property with the same name exists, this will
69
+ * replace it but maintain its descriptor configuration. The property will be
70
+ * replaced with a lazy getter.
71
+ *
72
+ * In DEV mode the original property value will be preserved as `original[PropertyName]`
73
+ * so that, if necessary, it can be restored. For example, if you want to route
74
+ * network requests through DevTools (to trace them):
75
+ *
76
+ * global.XMLHttpRequest = global.originalXMLHttpRequest;
77
+ *
78
+ * @see https://github.com/facebook/react-native/issues/934
79
+ */
80
+ export function installGlobal<T extends object>(name: string, getValue: () => T): void {
81
+ // @ts-ignore: globalThis is not defined in all environments
82
+ const object = typeof global !== 'undefined' ? global : globalThis;
83
+ const descriptor = Object.getOwnPropertyDescriptor(object, name);
84
+ if (__DEV__ && descriptor) {
85
+ const backupName = `original${name[0].toUpperCase()}${name.slice(1)}`;
86
+ Object.defineProperty(object, backupName, descriptor);
87
+ }
88
+
89
+ const { enumerable, writable, configurable = false } = descriptor || {};
90
+ if (descriptor && !configurable) {
91
+ console.error('Failed to set polyfill. ' + name + ' is not configurable.');
92
+ return;
93
+ }
94
+
95
+ defineLazyObjectProperty(object, name, {
96
+ get() {
97
+ const value = getValue();
98
+ Object.defineProperty(value, BUILTIN_SYMBOL, {
99
+ value: true,
100
+ enumerable: false,
101
+ configurable: false,
102
+ });
103
+
104
+ return value;
105
+ },
106
+ enumerable: enumerable !== false,
107
+ writable: writable !== false,
108
+ });
109
+ }
@@ -1,27 +1,8 @@
1
1
  // This file configures the runtime environment to increase compatibility with WinterCG.
2
2
  // https://wintercg.org/
3
3
 
4
- // @ts-ignore: PolyfillFunctions does not have types exported
5
- import { polyfillGlobal as installGlobal } from 'react-native/Libraries/Utilities/PolyfillFunctions';
6
-
7
4
  import { installFormDataPatch } from './FormData';
8
- // Add a well-known shared symbol that doesn't show up in iteration or inspection
9
- // this can be used to detect if the global object abides by the Expo team's documented
10
- // built-in requirements.
11
- const BUILTIN_SYMBOL = Symbol.for('expo.builtin');
12
-
13
- function addBuiltinSymbol(obj: object) {
14
- Object.defineProperty(obj, BUILTIN_SYMBOL, {
15
- value: true,
16
- enumerable: false,
17
- configurable: false,
18
- });
19
- return obj;
20
- }
21
-
22
- function install(name: string, getValue: () => any) {
23
- installGlobal(name, () => addBuiltinSymbol(getValue()));
24
- }
5
+ import { installGlobal as install } from './installGlobal';
25
6
 
26
7
  // https://encoding.spec.whatwg.org/#textdecoder
27
8
  install('TextDecoder', () => require('./TextDecoder').TextDecoder);
@@ -38,6 +19,9 @@ install('URLSearchParams', () => require('./url').URLSearchParams);
38
19
 
39
20
  install('__ExpoImportMetaRegistry', () => require('./ImportMetaRegistry').ImportMetaRegistry);
40
21
 
22
+ // https://html.spec.whatwg.org/multipage/structured-data.html#structuredclone
23
+ install('structuredClone', () => require('@ungap/structured-clone').default);
24
+
41
25
  installFormDataPatch(FormData);
42
26
 
43
27
  // Polyfill async iterator symbol for Hermes.
package/template.tgz ADDED
Binary file
@@ -1,72 +0,0 @@
1
- import { WebSocketBackingStore } from './WebSocketBackingStore';
2
- import type { ConnectionInfo, DevToolsPluginClientOptions, HandshakeMessageParams } from './devtools.types';
3
- export interface EventSubscription {
4
- remove(): void;
5
- }
6
- /**
7
- * This client is for the Expo DevTools Plugins to communicate between the app and the DevTools webpage hosted in a browser.
8
- * All the code should be both compatible with browsers and React Native.
9
- */
10
- export declare abstract class DevToolsPluginClient {
11
- readonly connectionInfo: ConnectionInfo;
12
- private readonly options?;
13
- private listeners;
14
- private static defaultWSStore;
15
- private readonly wsStore;
16
- protected isClosed: boolean;
17
- protected retries: number;
18
- private readonly messageFramePacker;
19
- constructor(connectionInfo: ConnectionInfo, options?: DevToolsPluginClientOptions | undefined);
20
- /**
21
- * Initialize the connection.
22
- * @hidden
23
- */
24
- initAsync(): Promise<void>;
25
- /**
26
- * Close the connection.
27
- */
28
- closeAsync(): Promise<void>;
29
- /**
30
- * Send a message to the other end of DevTools.
31
- * @param method A method name.
32
- * @param params any extra payload.
33
- */
34
- sendMessage(method: string, params: any): void;
35
- /**
36
- * Subscribe to a message from the other end of DevTools.
37
- * @param method Subscribe to a message with a method name.
38
- * @param listener Listener to be called when a message is received.
39
- */
40
- addMessageListener(method: string, listener: (params: any) => void): EventSubscription;
41
- /**
42
- * Subscribe to a message from the other end of DevTools just once.
43
- * @param method Subscribe to a message with a method name.
44
- * @param listener Listener to be called when a message is received.
45
- */
46
- addMessageListenerOnce(method: string, listener: (params: any) => void): void;
47
- /**
48
- * Internal handshake message sender.
49
- * @hidden
50
- */
51
- protected sendHandshakeMessage(params: HandshakeMessageParams): void;
52
- /**
53
- * Internal handshake message listener.
54
- * @hidden
55
- */
56
- protected addHandskakeMessageListener(listener: (params: HandshakeMessageParams) => void): EventSubscription;
57
- /**
58
- * Returns whether the client is connected to the server.
59
- */
60
- isConnected(): boolean;
61
- /**
62
- * The method to create the WebSocket connection.
63
- */
64
- protected connectAsync(): Promise<WebSocket>;
65
- protected handleMessage: (event: WebSocketMessageEvent) => Promise<void>;
66
- /**
67
- * Get the WebSocket backing store. Exposed for testing.
68
- * @hidden
69
- */
70
- getWebSocketBackingStore(): WebSocketBackingStore;
71
- }
72
- //# sourceMappingURL=DevToolsPluginClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DevToolsPluginClient.d.ts","sourceRoot":"","sources":["../../src/devtools/DevToolsPluginClient.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,KAAK,EACV,cAAc,EACd,2BAA2B,EAC3B,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAS1B,MAAM,WAAW,iBAAiB;IAChC,MAAM,IAAI,IAAI,CAAC;CAChB;AAED;;;GAGG;AACH,8BAAsB,oBAAoB;aAYtB,cAAc,EAAE,cAAc;IAC9C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IAZ3B,OAAO,CAAC,SAAS,CAAyD;IAE1E,OAAO,CAAC,MAAM,CAAC,cAAc,CAAsD;IACnF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8D;IAEtF,SAAS,CAAC,QAAQ,UAAS;IAC3B,SAAS,CAAC,OAAO,SAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CACR;gBAGT,cAAc,EAAE,cAAc,EAC7B,OAAO,CAAC,EAAE,2BAA2B,YAAA;IAMxD;;;OAGG;IACU,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAQvC;;OAEG;IACU,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAWxC;;;;OAIG;IACI,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG;IAmB9C;;;;OAIG;IACI,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,GAAG,iBAAiB;IAU7F;;;;OAIG;IACI,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAQpF;;;OAGG;IACH,SAAS,CAAC,oBAAoB,CAAC,MAAM,EAAE,sBAAsB;IAQ7D;;;OAGG;IACH,SAAS,CAAC,2BAA2B,CACnC,QAAQ,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,GACjD,iBAAiB;IA2BpB;;OAEG;IACI,WAAW,IAAI,OAAO;IAI7B;;OAEG;IACH,SAAS,CAAC,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC;IAyB5C,SAAS,CAAC,aAAa,GAAU,OAAO,qBAAqB,mBA6B3D;IAEF;;;OAGG;IACI,wBAAwB,IAAI,qBAAqB;CAGzD"}
@@ -1,16 +0,0 @@
1
- import type { DevToolsPluginClient } from './DevToolsPluginClient';
2
- import type { ConnectionInfo, DevToolsPluginClientOptions } from './devtools.types';
3
- /**
4
- * Factory of DevToolsPluginClient based on sender types.
5
- * @hidden
6
- */
7
- export declare function createDevToolsPluginClient(connectionInfo: ConnectionInfo, options?: DevToolsPluginClientOptions): Promise<DevToolsPluginClient>;
8
- /**
9
- * Public API to get the DevToolsPluginClient instance.
10
- */
11
- export declare function getDevToolsPluginClientAsync(pluginName: string, options?: DevToolsPluginClientOptions): Promise<DevToolsPluginClient>;
12
- /**
13
- * Internal testing API to cleanup all DevToolsPluginClient instances.
14
- */
15
- export declare function cleanupDevToolsPluginInstances(): void;
16
- //# sourceMappingURL=DevToolsPluginClientFactory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DevToolsPluginClientFactory.d.ts","sourceRoot":"","sources":["../../src/devtools/DevToolsPluginClientFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,KAAK,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAKpF;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,cAAc,EAAE,cAAc,EAC9B,OAAO,CAAC,EAAE,2BAA2B,GACpC,OAAO,CAAC,oBAAoB,CAAC,CAS/B;AAED;;GAEG;AACH,wBAAsB,4BAA4B,CAChD,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,2BAA2B,GACpC,OAAO,CAAC,oBAAoB,CAAC,CAyB/B;AAED;;GAEG;AACH,wBAAgB,8BAA8B,SAU7C"}
@@ -1,15 +0,0 @@
1
- import { DevToolsPluginClient } from './DevToolsPluginClient';
2
- /**
3
- * The DevToolsPluginClient for the app -> browser communication.
4
- */
5
- export declare class DevToolsPluginClientImplApp extends DevToolsPluginClient {
6
- private browserClientMap;
7
- /**
8
- * Initialize the connection.
9
- * @hidden
10
- */
11
- initAsync(): Promise<void>;
12
- private addHandshakeHandler;
13
- private terminateBrowserClient;
14
- }
15
- //# sourceMappingURL=DevToolsPluginClientImplApp.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DevToolsPluginClientImplApp.d.ts","sourceRoot":"","sources":["../../src/devtools/DevToolsPluginClientImplApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,oBAAoB;IAEnE,OAAO,CAAC,gBAAgB,CAA8B;IAEtD;;;OAGG;IACY,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAKzC,OAAO,CAAC,mBAAmB;IA4B3B,OAAO,CAAC,sBAAsB;CAQ/B"}
@@ -1,14 +0,0 @@
1
- import { DevToolsPluginClient } from './DevToolsPluginClient';
2
- /**
3
- * The DevToolsPluginClient for the browser -> app communication.
4
- */
5
- export declare class DevToolsPluginClientImplBrowser extends DevToolsPluginClient {
6
- private browserClientId;
7
- /**
8
- * Initialize the connection.
9
- * @hidden
10
- */
11
- initAsync(): Promise<void>;
12
- private startHandshake;
13
- }
14
- //# sourceMappingURL=DevToolsPluginClientImplBrowser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DevToolsPluginClientImplBrowser.d.ts","sourceRoot":"","sources":["../../src/devtools/DevToolsPluginClientImplBrowser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D;;GAEG;AACH,qBAAa,+BAAgC,SAAQ,oBAAoB;IACvE,OAAO,CAAC,eAAe,CAAiC;IAExD;;;OAGG;IACY,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAKzC,OAAO,CAAC,cAAc;CAmBvB"}
@@ -1,50 +0,0 @@
1
- /**
2
- * A message frame packer that serializes a messageKey and a payload into either a JSON string
3
- * (fast path) or a binary format (for complex payloads).
4
- *
5
- * Fast Path (JSON.stringify/JSON.parse):
6
- * - For simple payloads (e.g., strings, numbers, null, undefined, or plain objects), the packer
7
- * uses `JSON.stringify` for serialization and `JSON.parse` for deserialization, ensuring
8
- * optimal performance.
9
- *
10
- * Binary Format:
11
- * - For more complex payloads (e.g., Uint8Array, ArrayBuffer, Blob), the packer uses a binary
12
- * format with the following structure:
13
- *
14
- * +------------------+-------------------+----------------------------+--------------------------+
15
- * | 4 bytes (Uint32) | Variable length | 1 byte (Uint8) | Variable length |
16
- * | MessageKeyLength | MessageKey (JSON) | PayloadTypeIndicator (enum)| Payload (binary data) |
17
- * +------------------+-------------------+----------------------------+--------------------------+
18
- *
19
- * 1. MessageKeyLength (4 bytes):
20
- * - A 4-byte unsigned integer indicating the length of the MessageKey JSON string.
21
- *
22
- * 2. MessageKey (Variable length):
23
- * - The JSON string representing the message key, encoded as UTF-8.
24
- *
25
- * 3. PayloadTypeIndicator (1 byte):
26
- * - A single byte enum value representing the type of the payload (e.g., Uint8Array, String,
27
- * Object, ArrayBuffer, Blob).
28
- *
29
- * 4. Payload (Variable length):
30
- * - The actual payload data, which can vary in type and length depending on the PayloadType.
31
- */
32
- type MessageKeyTypeBase = string | object;
33
- type PayloadType = Uint8Array | string | number | null | undefined | object | ArrayBuffer | Blob;
34
- interface MessageFrame<T extends MessageKeyTypeBase> {
35
- messageKey: T;
36
- payload?: PayloadType;
37
- }
38
- export declare class MessageFramePacker<T extends MessageKeyTypeBase> {
39
- private textEncoder;
40
- private textDecoder;
41
- pack({ messageKey, payload }: MessageFrame<T>): string | Uint8Array | Promise<Uint8Array>;
42
- unpack(packedData: string | ArrayBuffer): MessageFrame<T>;
43
- private isFastPathPayload;
44
- private payloadToUint8Array;
45
- private packImpl;
46
- private deserializePayload;
47
- private static getPayloadTypeIndicator;
48
- }
49
- export {};
50
- //# sourceMappingURL=MessageFramePacker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MessageFramePacker.d.ts","sourceRoot":"","sources":["../../src/devtools/MessageFramePacker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAIH,KAAK,kBAAkB,GAAG,MAAM,GAAG,MAAM,CAAC;AAC1C,KAAK,WAAW,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;AAajG,UAAU,YAAY,CAAC,CAAC,SAAS,kBAAkB;IACjD,UAAU,EAAE,CAAC,CAAC;IACd,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED,qBAAa,kBAAkB,CAAC,CAAC,SAAS,kBAAkB;IAC1D,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,WAAW,CAAqB;IAEjC,IAAI,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IA2BzF,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC;IA0BhE,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,mBAAmB;IAuB3B,OAAO,CAAC,QAAQ;IA8BhB,OAAO,CAAC,kBAAkB;IAoC1B,OAAO,CAAC,MAAM,CAAC,uBAAuB;CAqBvC"}
@@ -1,7 +0,0 @@
1
- /**
2
- * A transport protocol version between the app and the webui.
3
- * It shows a warning in handshaking stage if the version is different between the app and the webui.
4
- * The value should be increased when the protocol is changed.
5
- */
6
- export declare const PROTOCOL_VERSION = 1;
7
- //# sourceMappingURL=ProtocolVersion.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProtocolVersion.d.ts","sourceRoot":"","sources":["../../src/devtools/ProtocolVersion.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * The backing store for the WebSocket connection and reference count.
3
- * This is used for connection multiplexing.
4
- */
5
- export declare class WebSocketBackingStore {
6
- ws: WebSocket | null;
7
- refCount: number;
8
- constructor(ws?: WebSocket | null, refCount?: number);
9
- }
10
- //# sourceMappingURL=WebSocketBackingStore.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebSocketBackingStore.d.ts","sourceRoot":"","sources":["../../src/devtools/WebSocketBackingStore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,qBAAqB;IAEvB,EAAE,EAAE,SAAS,GAAG,IAAI;IACpB,QAAQ,EAAE,MAAM;gBADhB,EAAE,GAAE,SAAS,GAAG,IAAW,EAC3B,QAAQ,GAAE,MAAU;CAE9B"}
@@ -1,81 +0,0 @@
1
- import type { DevToolsPluginClientOptions } from './devtools.types';
2
- export interface Options {
3
- /**
4
- * Reconnect interval in milliseconds.
5
- * @default 1500
6
- */
7
- retriesInterval?: number;
8
- /**
9
- * The maximum number of retries.
10
- * @default 200
11
- */
12
- maxRetries?: number;
13
- /**
14
- * The timeout in milliseconds for the WebSocket connecting.
15
- */
16
- connectTimeout?: number;
17
- /**
18
- * The error handler.
19
- * @default throwing an error
20
- */
21
- onError?: (error: Error) => void;
22
- /**
23
- * The callback to be called when the WebSocket is reconnected.
24
- * @default no-op
25
- */
26
- onReconnect?: (reason: string) => void;
27
- /**
28
- * The [`binaryType`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/binaryType).
29
- */
30
- binaryType?: DevToolsPluginClientOptions['websocketBinaryType'];
31
- }
32
- export declare class WebSocketWithReconnect implements WebSocket {
33
- readonly url: string;
34
- private readonly retriesInterval;
35
- private readonly maxRetries;
36
- private readonly connectTimeout;
37
- private readonly onError;
38
- private readonly onReconnect;
39
- private ws;
40
- private retries;
41
- private connectTimeoutHandle;
42
- private isClosed;
43
- private sendQueue;
44
- private lastCloseEvent;
45
- private eventListeners;
46
- private readonly wsBinaryType?;
47
- constructor(url: string, options?: Options);
48
- close(code?: number, reason?: string): void;
49
- addEventListener(event: 'message', listener: (event: WebSocketMessageEvent) => void): void;
50
- addEventListener(event: 'open', listener: () => void): void;
51
- addEventListener(event: 'error', listener: (event: WebSocketErrorEvent) => void): void;
52
- addEventListener(event: 'close', listener: (event: WebSocketCloseEvent) => void): void;
53
- removeEventListener(event: string, listener: (event: any) => void): void;
54
- private connect;
55
- send(data: string | ArrayBufferView | Blob | ArrayBufferLike): void;
56
- private emitEvent;
57
- private handleOpen;
58
- private handleMessage;
59
- private handleError;
60
- private handleClose;
61
- private handleConnectTimeout;
62
- private clearConnectTimeoutIfNeeded;
63
- private reconnectIfNeeded;
64
- private wsClose;
65
- get readyState(): number;
66
- readonly CONNECTING = 0;
67
- readonly OPEN = 1;
68
- readonly CLOSING = 2;
69
- readonly CLOSED = 3;
70
- get binaryType(): BinaryType;
71
- get bufferedAmount(): number;
72
- get extensions(): string;
73
- get protocol(): string;
74
- ping(): void;
75
- dispatchEvent(event: Event): boolean;
76
- set onclose(_value: ((e: WebSocketCloseEvent) => any) | null);
77
- set onerror(_value: ((e: Event) => any) | null);
78
- set onmessage(_value: ((e: WebSocketMessageEvent) => any) | null);
79
- set onopen(_value: (() => any) | null);
80
- }
81
- //# sourceMappingURL=WebSocketWithReconnect.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WebSocketWithReconnect.d.ts","sourceRoot":"","sources":["../../src/devtools/WebSocketWithReconnect.ts"],"names":[],"mappings":"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"}
@@ -1,42 +0,0 @@
1
- import type { WebSocketBackingStore } from './WebSocketBackingStore';
2
- /**
3
- * The connection info for devtools plugins client.
4
- */
5
- export interface ConnectionInfo {
6
- /** Indicates the sender towards the devtools plugin. */
7
- sender: 'app' | 'browser';
8
- /** Dev server address. */
9
- devServer: string;
10
- /** The plugin name. */
11
- pluginName: string;
12
- /**
13
- * The backing store for the WebSocket connection. Exposed for testing.
14
- * If not provided, the default singleton instance will be used.
15
- * @hidden
16
- */
17
- wsStore?: WebSocketBackingStore;
18
- /**
19
- * The transport protocol version between the app and the webui.
20
- */
21
- protocolVersion: number;
22
- }
23
- /**
24
- * Options for the devtools plugin client.
25
- */
26
- export interface DevToolsPluginClientOptions {
27
- /**
28
- * The underlying WebSocket [`binaryType`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/binaryType).
29
- */
30
- websocketBinaryType?: 'arraybuffer' | 'blob';
31
- }
32
- /**
33
- * The handshake messages for the devtools plugin client.
34
- * @hidden
35
- */
36
- export interface HandshakeMessageParams {
37
- protocolVersion: number;
38
- pluginName: string;
39
- method: 'handshake' | 'terminateBrowserClient';
40
- browserClientId: string;
41
- }
42
- //# sourceMappingURL=devtools.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"devtools.types.d.ts","sourceRoot":"","sources":["../../src/devtools/devtools.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,wDAAwD;IACxD,MAAM,EACF,KAAK,GACL,SAAS,CAAC;IAEd,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;IAElB,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAEhC;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,mBAAmB,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC;CAC9C;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,GAAG,wBAAwB,CAAC;IAC/C,eAAe,EAAE,MAAM,CAAC;CACzB"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Get the dev server address.
3
- */
4
- import type { ConnectionInfo } from './devtools.types';
5
- export declare function getConnectionInfo(): Omit<ConnectionInfo, 'pluginName'>;
6
- //# sourceMappingURL=getConnectionInfo.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getConnectionInfo.d.ts","sourceRoot":"","sources":["../../src/devtools/getConnectionInfo.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,wBAAgB,iBAAiB,IAAI,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,CAQtE"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Get the dev server address.
3
- */
4
- import type { ConnectionInfo } from './devtools.types';
5
- export declare function getConnectionInfo(): Omit<ConnectionInfo, 'pluginName'>;
6
- //# sourceMappingURL=getConnectionInfo.native.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getConnectionInfo.native.d.ts","sourceRoot":"","sources":["../../src/devtools/getConnectionInfo.native.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,wBAAgB,iBAAiB,IAAI,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,CAUtE"}
@@ -1,12 +0,0 @@
1
- import { DevToolsPluginClient } from './DevToolsPluginClient';
2
- import { getDevToolsPluginClientAsync } from './DevToolsPluginClientFactory';
3
- import type { DevToolsPluginClientOptions } from './devtools.types';
4
- export { getDevToolsPluginClientAsync, DevToolsPluginClient };
5
- export type { DevToolsPluginClientOptions };
6
- export type { EventSubscription } from './DevToolsPluginClient';
7
- export { setEnableLogging } from './logger';
8
- /**
9
- * A React hook to get the DevToolsPluginClient instance.
10
- */
11
- export declare function useDevToolsPluginClient(pluginName: string, options?: DevToolsPluginClientOptions): DevToolsPluginClient | null;
12
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/devtools/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAEpE,OAAO,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,CAAC;AAC9D,YAAY,EAAE,2BAA2B,EAAE,CAAC;AAE5C,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,2BAA2B,GACpC,oBAAoB,GAAG,IAAI,CAkC7B"}
@@ -1,6 +0,0 @@
1
- export declare function log(...params: Parameters<typeof console.log>): void;
2
- export declare function debug(...params: Parameters<typeof console.debug>): void;
3
- export declare function info(...params: Parameters<typeof console.info>): void;
4
- export declare function warn(...params: Parameters<typeof console.info>): void;
5
- export declare function setEnableLogging(enabled: boolean): void;
6
- //# sourceMappingURL=logger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/devtools/logger.ts"],"names":[],"mappings":"AAEA,wBAAgB,GAAG,CAAC,GAAG,MAAM,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,GAAG,CAAC,QAI5D;AAED,wBAAgB,KAAK,CAAC,GAAG,MAAM,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,KAAK,CAAC,QAIhE;AAED,wBAAgB,IAAI,CAAC,GAAG,MAAM,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,QAI9D;AAED,wBAAgB,IAAI,CAAC,GAAG,MAAM,EAAE,UAAU,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,QAI9D;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,QAEhD"}