@teardown/react-native 1.2.15 → 1.2.20
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.
- package/dist/components/debugger-ui.d.ts +7 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/teardown-logo.d.ts +4 -0
- package/dist/containers/index.d.ts +1 -0
- package/dist/containers/teardown.container.d.ts +11 -0
- package/dist/debugger.d.ts +13 -0
- package/dist/index.d.ts +3 -0
- package/dist/plugins/http.plugin.d.ts +23 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/logging.plugin.d.ts +9 -0
- package/dist/plugins/websocket.plugin.d.ts +17 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/teardown.service.d.ts +10 -0
- package/dist/teardown.client.d.ts +44 -0
- package/package.json +8 -8
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
export type DebuggerUiPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center-left' | 'center-right';
|
|
3
|
+
export type DebuggerUiOptions = {
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
position?: DebuggerUiPosition;
|
|
6
|
+
};
|
|
7
|
+
export declare const DebuggerUi: FunctionComponent<DebuggerUiOptions>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './debugger-ui';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './teardown.container';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FunctionComponent, PropsWithChildren } from "react";
|
|
2
|
+
import type { PluginTuple, TeardownClient } from "../teardown.client";
|
|
3
|
+
import type { DebuggerUiOptions } from "../components";
|
|
4
|
+
export type TeardownContainerOptions = {
|
|
5
|
+
debugger: DebuggerUiOptions;
|
|
6
|
+
};
|
|
7
|
+
export type TeardownContainerProps<T extends readonly PluginTuple[]> = PropsWithChildren<{
|
|
8
|
+
client: TeardownClient<T>;
|
|
9
|
+
options?: TeardownContainerOptions;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const TeardownContainer: FunctionComponent<TeardownContainerProps<any>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ClientWebsocketEvents, type ConnectionEstablishedWebsocketEvent, WebsocketClient, type WebsocketClientOptions, type WebsocketConnectionStatus } from "@teardown/websocket";
|
|
2
|
+
export type DebuggerStatus = WebsocketConnectionStatus;
|
|
3
|
+
export type DebuggerOptions = WebsocketClientOptions & {
|
|
4
|
+
deviceName?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class Debugger extends WebsocketClient<ClientWebsocketEvents> {
|
|
7
|
+
private readonly customDeviceName?;
|
|
8
|
+
constructor(options?: DebuggerOptions);
|
|
9
|
+
private getDeviceName;
|
|
10
|
+
onConnectionEstablished(event: ConnectionEstablishedWebsocketEvent): Promise<void>;
|
|
11
|
+
getHostFromUrl(url: string): string;
|
|
12
|
+
getHost(): string;
|
|
13
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TeardownClient } from "../teardown.client";
|
|
2
|
+
import { type DefaultPluginOptions, Plugin } from "../teardown.client";
|
|
3
|
+
export type HTTPPluginOptions = DefaultPluginOptions<{
|
|
4
|
+
ignoreURLs?: RegExp[];
|
|
5
|
+
}>;
|
|
6
|
+
export declare class HTTPPlugin extends Plugin {
|
|
7
|
+
private client;
|
|
8
|
+
private requests;
|
|
9
|
+
private ignoreURLs;
|
|
10
|
+
constructor(options?: HTTPPluginOptions);
|
|
11
|
+
install(client: TeardownClient<any>): void;
|
|
12
|
+
enableXHRInterceptor(): void;
|
|
13
|
+
disableInterception(): void;
|
|
14
|
+
private shouldIgnoreURL;
|
|
15
|
+
private xhrOpenCallback;
|
|
16
|
+
private xhrRequestHeaderCallback;
|
|
17
|
+
private xhrSendCallback;
|
|
18
|
+
private serializeRequestBody;
|
|
19
|
+
private xhrResponseCallback;
|
|
20
|
+
private parseResponseHeaders;
|
|
21
|
+
private parseResponseBody;
|
|
22
|
+
private sendHTTPEvent;
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IPlugin, TeardownClient } from "../teardown.client";
|
|
2
|
+
export declare class LoggingPlugin implements IPlugin {
|
|
3
|
+
private client;
|
|
4
|
+
private originalConsoleMethods;
|
|
5
|
+
private createConsoleProxy;
|
|
6
|
+
constructor();
|
|
7
|
+
install(client: TeardownClient<any>): void;
|
|
8
|
+
uninstall(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IPlugin, TeardownClient } from "../teardown.client";
|
|
2
|
+
export declare class WebSocketPlugin implements IPlugin {
|
|
3
|
+
private logger;
|
|
4
|
+
private client;
|
|
5
|
+
private sockets;
|
|
6
|
+
constructor();
|
|
7
|
+
install(client: TeardownClient<any>): void;
|
|
8
|
+
private setupWebSocketInterceptor;
|
|
9
|
+
private wsConnectCallback;
|
|
10
|
+
private wsSendCallback;
|
|
11
|
+
private wsOnMessageCallback;
|
|
12
|
+
private wsOnCloseCallback;
|
|
13
|
+
private sendOpenEvent;
|
|
14
|
+
private sendMessageEvent;
|
|
15
|
+
private sendCloseEvent;
|
|
16
|
+
disableInterception(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './teardown.service';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PluginTuple, TeardownClient } from "../teardown.client";
|
|
2
|
+
export type TeardownServiceContextType<T extends readonly PluginTuple[]> = {
|
|
3
|
+
client: TeardownClient<T>;
|
|
4
|
+
};
|
|
5
|
+
export declare const TeardownService: {
|
|
6
|
+
Context: import("react").Context<TeardownServiceContextType<any> | null>;
|
|
7
|
+
Provider: import("react").Provider<TeardownServiceContextType<any> | null>;
|
|
8
|
+
useState<T extends readonly PluginTuple[]>(): TeardownServiceContextType<T>;
|
|
9
|
+
useProvidedState<T extends readonly PluginTuple[]>(client: TeardownClient<T>): TeardownServiceContextType<T>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Logger } from "@teardown/logger";
|
|
2
|
+
import { Debugger, type DebuggerOptions } from "./debugger";
|
|
3
|
+
export interface IPlugin {
|
|
4
|
+
install?(client: TeardownClient<any>): void;
|
|
5
|
+
uninstall?(): void;
|
|
6
|
+
}
|
|
7
|
+
export type DefaultPluginOptions<T> = {
|
|
8
|
+
debug?: boolean;
|
|
9
|
+
} & T;
|
|
10
|
+
export type PluginOptions<T> = DefaultPluginOptions<{
|
|
11
|
+
key: string;
|
|
12
|
+
}> & T;
|
|
13
|
+
export declare abstract class Plugin<T = any> {
|
|
14
|
+
protected logger: Logger;
|
|
15
|
+
protected constructor(options: PluginOptions<T>);
|
|
16
|
+
install?(client: TeardownClient<any>): void;
|
|
17
|
+
uninstall?(): void;
|
|
18
|
+
}
|
|
19
|
+
export type PluginTuple = readonly [string, IPlugin];
|
|
20
|
+
type InferPluginFromTuple<T extends PluginTuple> = {
|
|
21
|
+
[K in T[0]]: Omit<T[1], "install" | "uninstall">;
|
|
22
|
+
};
|
|
23
|
+
type InferPluginsFromArray<T extends readonly PluginTuple[]> = UnionToIntersection<InferPluginFromTuple<T[number]>>;
|
|
24
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
25
|
+
export type TeardownClientOptions<T extends readonly PluginTuple[]> = {
|
|
26
|
+
plugins?: T;
|
|
27
|
+
debuggerEnabled?: boolean;
|
|
28
|
+
loggingEnabled?: boolean;
|
|
29
|
+
} & DebuggerOptions;
|
|
30
|
+
export declare class TeardownClient<T extends readonly PluginTuple[]> {
|
|
31
|
+
readonly options?: TeardownClientOptions<T> | undefined;
|
|
32
|
+
logger: Logger;
|
|
33
|
+
debugger: Debugger | null;
|
|
34
|
+
private readonly plugins;
|
|
35
|
+
api: InferPluginsFromArray<T>;
|
|
36
|
+
constructor(options?: TeardownClientOptions<T> | undefined);
|
|
37
|
+
private installPlugin;
|
|
38
|
+
private uninstallPlugin;
|
|
39
|
+
private uninstallAllPlugins;
|
|
40
|
+
private reinstallPlugins;
|
|
41
|
+
shutdown(): void;
|
|
42
|
+
}
|
|
43
|
+
export declare const createTeardownClient: <Plugins extends readonly PluginTuple[]>(plugins: Plugins) => TeardownClient<Plugins>;
|
|
44
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teardown/react-native",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.20",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
|
-
"build": "tsc",
|
|
8
|
-
"dev": "tsc --
|
|
7
|
+
"build": "tsc ",
|
|
8
|
+
"dev": "tsc --watch"
|
|
9
9
|
},
|
|
10
10
|
"main": "./dist/index.js",
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"dist/**/*"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@teardown/logger": "1.2.
|
|
18
|
-
"@teardown/util": "1.2.
|
|
19
|
-
"@teardown/websocket": "1.2.
|
|
17
|
+
"@teardown/logger": "1.2.20",
|
|
18
|
+
"@teardown/util": "1.2.20",
|
|
19
|
+
"@teardown/websocket": "1.2.20"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@teardown/config": "1.2.
|
|
23
|
-
"@teardown/react-native-ui": "1.2.
|
|
22
|
+
"@teardown/config": "1.2.20",
|
|
23
|
+
"@teardown/react-native-ui": "1.2.20",
|
|
24
24
|
"@types/react": "^18.3.1",
|
|
25
25
|
"@types/react-native": "^0.73.0",
|
|
26
26
|
"metro-config": "^0.81.0",
|