@expo/devtools 0.0.1

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 (63) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +16 -0
  3. package/build/DevToolsPluginClient.d.ts +73 -0
  4. package/build/DevToolsPluginClient.d.ts.map +1 -0
  5. package/build/DevToolsPluginClient.js +212 -0
  6. package/build/DevToolsPluginClient.js.map +1 -0
  7. package/build/DevToolsPluginClientFactory.d.ts +16 -0
  8. package/build/DevToolsPluginClientFactory.d.ts.map +1 -0
  9. package/build/DevToolsPluginClientFactory.js +60 -0
  10. package/build/DevToolsPluginClientFactory.js.map +1 -0
  11. package/build/DevToolsPluginClientImplApp.d.ts +15 -0
  12. package/build/DevToolsPluginClientImplApp.d.ts.map +1 -0
  13. package/build/DevToolsPluginClientImplApp.js +47 -0
  14. package/build/DevToolsPluginClientImplApp.js.map +1 -0
  15. package/build/DevToolsPluginClientImplBrowser.d.ts +14 -0
  16. package/build/DevToolsPluginClientImplBrowser.d.ts.map +1 -0
  17. package/build/DevToolsPluginClientImplBrowser.js +32 -0
  18. package/build/DevToolsPluginClientImplBrowser.js.map +1 -0
  19. package/build/MessageFramePacker.d.ts +50 -0
  20. package/build/MessageFramePacker.d.ts.map +1 -0
  21. package/build/MessageFramePacker.js +211 -0
  22. package/build/MessageFramePacker.js.map +1 -0
  23. package/build/ProtocolVersion.d.ts +7 -0
  24. package/build/ProtocolVersion.d.ts.map +1 -0
  25. package/build/ProtocolVersion.js +7 -0
  26. package/build/ProtocolVersion.js.map +1 -0
  27. package/build/WebSocketBackingStore.d.ts +10 -0
  28. package/build/WebSocketBackingStore.d.ts.map +1 -0
  29. package/build/WebSocketBackingStore.js +13 -0
  30. package/build/WebSocketBackingStore.js.map +1 -0
  31. package/build/WebSocketWithReconnect.d.ts +92 -0
  32. package/build/WebSocketWithReconnect.d.ts.map +1 -0
  33. package/build/WebSocketWithReconnect.js +216 -0
  34. package/build/WebSocketWithReconnect.js.map +1 -0
  35. package/build/devtools.types.d.ts +42 -0
  36. package/build/devtools.types.d.ts.map +1 -0
  37. package/build/devtools.types.js +2 -0
  38. package/build/devtools.types.js.map +1 -0
  39. package/build/getConnectionInfo.d.ts +6 -0
  40. package/build/getConnectionInfo.d.ts.map +1 -0
  41. package/build/getConnectionInfo.js +14 -0
  42. package/build/getConnectionInfo.js.map +1 -0
  43. package/build/getConnectionInfo.native.d.ts +6 -0
  44. package/build/getConnectionInfo.native.d.ts.map +1 -0
  45. package/build/getConnectionInfo.native.js +16 -0
  46. package/build/getConnectionInfo.native.js.map +1 -0
  47. package/build/hooks.d.ts +7 -0
  48. package/build/hooks.d.ts.map +1 -0
  49. package/build/hooks.js +37 -0
  50. package/build/hooks.js.map +1 -0
  51. package/build/index.d.ts +6 -0
  52. package/build/index.d.ts.map +1 -0
  53. package/build/index.js +5 -0
  54. package/build/index.js.map +1 -0
  55. package/build/logger.d.ts +6 -0
  56. package/build/logger.d.ts.map +1 -0
  57. package/build/logger.js +25 -0
  58. package/build/logger.js.map +1 -0
  59. package/build/utils/blobUtils.d.ts +9 -0
  60. package/build/utils/blobUtils.d.ts.map +1 -0
  61. package/build/utils/blobUtils.js +23 -0
  62. package/build/utils/blobUtils.js.map +1 -0
  63. package/package.json +64 -0
@@ -0,0 +1,42 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtools.types.d.ts","sourceRoot":"","sources":["../src/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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=devtools.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtools.types.js","sourceRoot":"","sources":["../src/devtools.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { WebSocketBackingStore } from './WebSocketBackingStore';\n\n/**\n * The connection info for devtools plugins client.\n */\nexport interface ConnectionInfo {\n /** Indicates the sender towards the devtools plugin. */\n sender:\n | 'app' // client running in the app environment.\n | 'browser'; // client running in the browser environment.\n\n /** Dev server address. */\n devServer: string;\n\n /** The plugin name. */\n pluginName: string;\n\n /**\n * The backing store for the WebSocket connection. Exposed for testing.\n * If not provided, the default singleton instance will be used.\n * @hidden\n */\n wsStore?: WebSocketBackingStore;\n\n /**\n * The transport protocol version between the app and the webui.\n */\n protocolVersion: number;\n}\n\n/**\n * Options for the devtools plugin client.\n */\nexport interface DevToolsPluginClientOptions {\n /**\n * The underlying WebSocket [`binaryType`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/binaryType).\n */\n websocketBinaryType?: 'arraybuffer' | 'blob';\n}\n\n/**\n * The handshake messages for the devtools plugin client.\n * @hidden\n */\nexport interface HandshakeMessageParams {\n protocolVersion: number;\n pluginName: string;\n method: 'handshake' | 'terminateBrowserClient';\n browserClientId: string;\n}\n"]}
@@ -0,0 +1,6 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getConnectionInfo.d.ts","sourceRoot":"","sources":["../src/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"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Get the dev server address.
3
+ */
4
+ import { PROTOCOL_VERSION } from './ProtocolVersion';
5
+ export function getConnectionInfo() {
6
+ const devServerQuery = new URLSearchParams(window.location.search).get('devServer');
7
+ const host = window.location.origin.replace(/^https?:\/\//, '');
8
+ return {
9
+ protocolVersion: PROTOCOL_VERSION,
10
+ sender: 'browser',
11
+ devServer: devServerQuery || host,
12
+ };
13
+ }
14
+ //# sourceMappingURL=getConnectionInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getConnectionInfo.js","sourceRoot":"","sources":["../src/getConnectionInfo.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,MAAM,UAAU,iBAAiB;IAC/B,MAAM,cAAc,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACpF,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IAChE,OAAO;QACL,eAAe,EAAE,gBAAgB;QACjC,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,cAAc,IAAI,IAAI;KAClC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Get the dev server address.\n */\n\nimport { PROTOCOL_VERSION } from './ProtocolVersion';\nimport type { ConnectionInfo } from './devtools.types';\n\nexport function getConnectionInfo(): Omit<ConnectionInfo, 'pluginName'> {\n const devServerQuery = new URLSearchParams(window.location.search).get('devServer');\n const host = window.location.origin.replace(/^https?:\\/\\//, '');\n return {\n protocolVersion: PROTOCOL_VERSION,\n sender: 'browser',\n devServer: devServerQuery || host,\n };\n}\n"]}
@@ -0,0 +1,6 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getConnectionInfo.native.d.ts","sourceRoot":"","sources":["../src/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"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Get the dev server address.
3
+ */
4
+ import { PROTOCOL_VERSION } from './ProtocolVersion';
5
+ export function getConnectionInfo() {
6
+ const getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer').default;
7
+ const devServer = getDevServer()
8
+ .url.replace(/^https?:\/\//, '')
9
+ .replace(/\/?$/, '');
10
+ return {
11
+ protocolVersion: PROTOCOL_VERSION,
12
+ sender: 'app',
13
+ devServer,
14
+ };
15
+ }
16
+ //# sourceMappingURL=getConnectionInfo.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getConnectionInfo.native.js","sourceRoot":"","sources":["../src/getConnectionInfo.native.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD,MAAM,UAAU,iBAAiB;IAC/B,MAAM,YAAY,GAAG,OAAO,CAAC,mDAAmD,CAAC,CAAC,OAAO,CAAC;IAC1F,MAAM,SAAS,GAAG,YAAY,EAAE;SAC7B,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;SAC/B,OAAO,CAAC,MAAM,EAAE,EAAE,CAAW,CAAC;IACjC,OAAO;QACL,eAAe,EAAE,gBAAgB;QACjC,MAAM,EAAE,KAAK;QACb,SAAS;KACV,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Get the dev server address.\n */\n\nimport { PROTOCOL_VERSION } from './ProtocolVersion';\nimport type { ConnectionInfo } from './devtools.types';\n\nexport function getConnectionInfo(): Omit<ConnectionInfo, 'pluginName'> {\n const getDevServer = require('react-native/Libraries/Core/Devtools/getDevServer').default;\n const devServer = getDevServer()\n .url.replace(/^https?:\\/\\//, '')\n .replace(/\\/?$/, '') as string;\n return {\n protocolVersion: PROTOCOL_VERSION,\n sender: 'app',\n devServer,\n };\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import { DevToolsPluginClient } from './DevToolsPluginClient';
2
+ import type { DevToolsPluginClientOptions } from './devtools.types';
3
+ /**
4
+ * A React hook to get the DevToolsPluginClient instance.
5
+ */
6
+ export declare function useDevToolsPluginClient(pluginName: string, options?: DevToolsPluginClientOptions): DevToolsPluginClient | null;
7
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAEpE;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,2BAA2B,GACpC,oBAAoB,GAAG,IAAI,CAkC7B"}
package/build/hooks.js ADDED
@@ -0,0 +1,37 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { getDevToolsPluginClientAsync } from './DevToolsPluginClientFactory';
3
+ /**
4
+ * A React hook to get the DevToolsPluginClient instance.
5
+ */
6
+ export function useDevToolsPluginClient(pluginName, options) {
7
+ const [client, setClient] = useState(null);
8
+ const [error, setError] = useState(null);
9
+ useEffect(() => {
10
+ async function setup() {
11
+ try {
12
+ const client = await getDevToolsPluginClientAsync(pluginName, options);
13
+ setClient(client);
14
+ }
15
+ catch (e) {
16
+ setError(new Error('Failed to setup client from useDevToolsPluginClient: ' + e.toString()));
17
+ }
18
+ }
19
+ async function teardown() {
20
+ try {
21
+ await client?.closeAsync();
22
+ }
23
+ catch (e) {
24
+ setError(new Error('Failed to teardown client from useDevToolsPluginClient: ' + e.toString()));
25
+ }
26
+ }
27
+ setup();
28
+ return () => {
29
+ teardown();
30
+ };
31
+ }, [pluginName]);
32
+ if (error != null) {
33
+ throw error;
34
+ }
35
+ return client;
36
+ }
37
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAG7E;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,UAAkB,EAClB,OAAqC;IAErC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAA8B,IAAI,CAAC,CAAC;IACxE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IAEvD,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,UAAU,KAAK;YAClB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,4BAA4B,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;gBACvE,SAAS,CAAC,MAAM,CAAC,CAAC;YACpB,CAAC;YAAC,OAAO,CAAM,EAAE,CAAC;gBAChB,QAAQ,CAAC,IAAI,KAAK,CAAC,uDAAuD,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YAC9F,CAAC;QACH,CAAC;QAED,KAAK,UAAU,QAAQ;YACrB,IAAI,CAAC;gBACH,MAAM,MAAM,EAAE,UAAU,EAAE,CAAC;YAC7B,CAAC;YAAC,OAAO,CAAM,EAAE,CAAC;gBAChB,QAAQ,CACN,IAAI,KAAK,CAAC,0DAA0D,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CACrF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,KAAK,EAAE,CAAC;QACR,OAAO,GAAG,EAAE;YACV,QAAQ,EAAE,CAAC;QACb,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,MAAM,KAAK,CAAC;IACd,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { DevToolsPluginClient } from './DevToolsPluginClient';\nimport { getDevToolsPluginClientAsync } from './DevToolsPluginClientFactory';\nimport type { DevToolsPluginClientOptions } from './devtools.types';\n\n/**\n * A React hook to get the DevToolsPluginClient instance.\n */\nexport function useDevToolsPluginClient(\n pluginName: string,\n options?: DevToolsPluginClientOptions\n): DevToolsPluginClient | null {\n const [client, setClient] = useState<DevToolsPluginClient | null>(null);\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n async function setup() {\n try {\n const client = await getDevToolsPluginClientAsync(pluginName, options);\n setClient(client);\n } catch (e: any) {\n setError(new Error('Failed to setup client from useDevToolsPluginClient: ' + e.toString()));\n }\n }\n\n async function teardown() {\n try {\n await client?.closeAsync();\n } catch (e: any) {\n setError(\n new Error('Failed to teardown client from useDevToolsPluginClient: ' + e.toString())\n );\n }\n }\n\n setup();\n return () => {\n teardown();\n };\n }, [pluginName]);\n\n if (error != null) {\n throw error;\n }\n return client;\n}\n"]}
@@ -0,0 +1,6 @@
1
+ export * from './hooks';
2
+ export { setEnableLogging } from './logger';
3
+ export { getDevToolsPluginClientAsync } from './DevToolsPluginClientFactory';
4
+ export { DevToolsPluginClient } from './DevToolsPluginClient';
5
+ export type { EventSubscription } from './DevToolsPluginClient';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,YAAY,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
package/build/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from './hooks';
2
+ export { setEnableLogging } from './logger';
3
+ export { getDevToolsPluginClientAsync } from './DevToolsPluginClientFactory';
4
+ export { DevToolsPluginClient } from './DevToolsPluginClient';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["export * from './hooks';\nexport { setEnableLogging } from './logger';\nexport { getDevToolsPluginClientAsync } from './DevToolsPluginClientFactory';\nexport { DevToolsPluginClient } from './DevToolsPluginClient';\n\n// Export the EventSubscription type if people need to use explicit type from `addMessageListener`\nexport type { EventSubscription } from './DevToolsPluginClient';\n"]}
@@ -0,0 +1,6 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/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"}
@@ -0,0 +1,25 @@
1
+ let enableLogging = false;
2
+ export function log(...params) {
3
+ if (enableLogging) {
4
+ console.log(...params);
5
+ }
6
+ }
7
+ export function debug(...params) {
8
+ if (enableLogging) {
9
+ console.debug(...params);
10
+ }
11
+ }
12
+ export function info(...params) {
13
+ if (enableLogging) {
14
+ console.info(...params);
15
+ }
16
+ }
17
+ export function warn(...params) {
18
+ if (enableLogging) {
19
+ console.warn(...params);
20
+ }
21
+ }
22
+ export function setEnableLogging(enabled) {
23
+ enableLogging = enabled;
24
+ }
25
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B,MAAM,UAAU,GAAG,CAAC,GAAG,MAAsC;IAC3D,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;IACzB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,GAAG,MAAwC;IAC/D,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,GAAG,MAAuC;IAC7D,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,GAAG,MAAuC;IAC7D,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,aAAa,GAAG,OAAO,CAAC;AAC1B,CAAC","sourcesContent":["let enableLogging = false;\n\nexport function log(...params: Parameters<typeof console.log>) {\n if (enableLogging) {\n console.log(...params);\n }\n}\n\nexport function debug(...params: Parameters<typeof console.debug>) {\n if (enableLogging) {\n console.debug(...params);\n }\n}\n\nexport function info(...params: Parameters<typeof console.info>) {\n if (enableLogging) {\n console.info(...params);\n }\n}\n\nexport function warn(...params: Parameters<typeof console.info>) {\n if (enableLogging) {\n console.warn(...params);\n }\n}\n\nexport function setEnableLogging(enabled: boolean) {\n enableLogging = enabled;\n}\n"]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Converts a Blob to an ArrayBuffer.
3
+ */
4
+ export declare function blobToArrayBufferAsync(blob: Blob): Promise<ArrayBuffer>;
5
+ /**
6
+ * Converts a Blob to an ArrayBuffer using the FileReader API.
7
+ */
8
+ export declare function legacyBlobToArrayBufferAsync(blob: Blob): Promise<ArrayBuffer>;
9
+ //# sourceMappingURL=blobUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blobUtils.d.ts","sourceRoot":"","sources":["../../src/utils/blobUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CAKvE;AAED;;GAEG;AACH,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,CASnF"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Converts a Blob to an ArrayBuffer.
3
+ */
4
+ export function blobToArrayBufferAsync(blob) {
5
+ if (typeof blob.arrayBuffer === 'function') {
6
+ return blob.arrayBuffer();
7
+ }
8
+ return legacyBlobToArrayBufferAsync(blob);
9
+ }
10
+ /**
11
+ * Converts a Blob to an ArrayBuffer using the FileReader API.
12
+ */
13
+ export async function legacyBlobToArrayBufferAsync(blob) {
14
+ return new Promise((resolve, reject) => {
15
+ const reader = new FileReader();
16
+ reader.onload = () => {
17
+ resolve(reader.result);
18
+ };
19
+ reader.onerror = reject;
20
+ reader.readAsArrayBuffer(blob);
21
+ });
22
+ }
23
+ //# sourceMappingURL=blobUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blobUtils.js","sourceRoot":"","sources":["../../src/utils/blobUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAU;IAC/C,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC;IACD,OAAO,4BAA4B,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAAC,IAAU;IAC3D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAChC,MAAM,CAAC,MAAM,GAAG,GAAG,EAAE;YACnB,OAAO,CAAC,MAAM,CAAC,MAAqB,CAAC,CAAC;QACxC,CAAC,CAAC;QACF,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC;QACxB,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * Converts a Blob to an ArrayBuffer.\n */\nexport function blobToArrayBufferAsync(blob: Blob): Promise<ArrayBuffer> {\n if (typeof blob.arrayBuffer === 'function') {\n return blob.arrayBuffer();\n }\n return legacyBlobToArrayBufferAsync(blob);\n}\n\n/**\n * Converts a Blob to an ArrayBuffer using the FileReader API.\n */\nexport async function legacyBlobToArrayBufferAsync(blob: Blob): Promise<ArrayBuffer> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => {\n resolve(reader.result as ArrayBuffer);\n };\n reader.onerror = reject;\n reader.readAsArrayBuffer(blob);\n });\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@expo/devtools",
3
+ "version": "0.0.1",
4
+ "description": "DevTools plugin helpers for Expo",
5
+ "main": "build/index.js",
6
+ "types": "build/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./build/index.d.ts",
10
+ "default": "./build/index.js"
11
+ },
12
+ "./package.json": "./package.json"
13
+ },
14
+ "scripts": {
15
+ "build": "expo-module build",
16
+ "clean": "expo-module clean",
17
+ "lint": "expo-module lint",
18
+ "test": "expo-module test",
19
+ "prepare": "expo-module prepare",
20
+ "prepublishOnly": "expo-module prepublishOnly",
21
+ "typecheck": "expo-module typecheck"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "https://github.com/expo/expo.git",
26
+ "directory": "packages/@expo/devtools"
27
+ },
28
+ "keywords": [
29
+ "expo",
30
+ "react-native",
31
+ "react",
32
+ "devtools",
33
+ "plugins",
34
+ "dev-plugins",
35
+ "cli-extensions"
36
+ ],
37
+ "license": "MIT",
38
+ "bugs": {
39
+ "url": "https://github.com/expo/expo/issues"
40
+ },
41
+ "homepage": "https://github.com/expo/expo/tree/main/packages/@expo/devtools#readme",
42
+ "files": [
43
+ "build"
44
+ ],
45
+ "dependencies": {
46
+ "chalk": "^4.1.2"
47
+ },
48
+ "devDependencies": {
49
+ "expo-module-scripts": "^4.1.7",
50
+ "ws": "^8.18.0"
51
+ },
52
+ "peerDependencies": {
53
+ "react": "*",
54
+ "react-native": "*"
55
+ },
56
+ "peerDependenciesMeta": {
57
+ "react": {
58
+ "optional": true
59
+ },
60
+ "react-native": {
61
+ "optional": true
62
+ }
63
+ }
64
+ }