@ceraph/react-native-mcp 0.3.3 → 0.4.5
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/README.md +335 -68
- package/dist/babel-plugin/index.cjs +1 -0
- package/dist/babel-plugin/index.js +1 -0
- package/dist/cli.d.ts +3 -1
- package/dist/cli.js +1 -47
- package/dist/index.d.ts +106 -1
- package/dist/index.js +2 -1651
- package/dist/shim/async-storage-ops.d.ts +26 -0
- package/dist/shim/async-storage-ops.js +1 -0
- package/dist/shim/boot.d.ts +9 -0
- package/dist/shim/boot.js +1 -141
- package/dist/shim/camera.js +1 -62
- package/dist/shim/command-poll.d.ts +18 -0
- package/dist/shim/command-poll.js +1 -0
- package/dist/shim/config.js +1 -56
- package/dist/shim/console-capture.d.ts +16 -0
- package/dist/shim/console-capture.js +1 -0
- package/dist/shim/deep-link.js +1 -25
- package/dist/shim/dev-guard.js +1 -3
- package/dist/shim/dev-host.d.ts +1 -0
- package/dist/shim/dev-host.js +1 -0
- package/dist/shim/error-handler.js +1 -66
- package/dist/shim/fetch-interceptor.js +1 -93
- package/dist/shim/index.d.ts +3 -0
- package/dist/shim/index.js +1 -6
- package/dist/shim/keep-awake.js +1 -118
- package/dist/shim/network-ownership.d.ts +4 -0
- package/dist/shim/network-ownership.js +1 -0
- package/dist/shim/optimistic-observer.d.ts +29 -0
- package/dist/shim/optimistic-observer.js +1 -0
- package/dist/shim/reload.js +1 -76
- package/dist/shim/reset.d.ts +30 -0
- package/dist/shim/reset.js +1 -0
- package/dist/shim/signal-capture.d.ts +8 -0
- package/dist/shim/signal-capture.js +1 -15
- package/dist/shim/signal-transport.d.ts +14 -1
- package/dist/shim/signal-transport.js +1 -43
- package/dist/shim/xhr-interceptor.d.ts +39 -0
- package/dist/shim/xhr-interceptor.js +1 -0
- package/package.json +40 -11
- package/dist/app-lifecycle.d.ts +0 -50
- package/dist/app-lifecycle.js +0 -487
- package/dist/camera-image-writer.d.ts +0 -43
- package/dist/camera-image-writer.js +0 -280
- package/dist/camera-registry-sync.d.ts +0 -18
- package/dist/camera-registry-sync.js +0 -117
- package/dist/device-autonomy.d.ts +0 -30
- package/dist/device-autonomy.js +0 -117
- package/dist/error-parser.d.ts +0 -51
- package/dist/error-parser.js +0 -275
- package/dist/expo-manager.d.ts +0 -62
- package/dist/expo-manager.js +0 -447
- package/dist/init/ast-camera.d.ts +0 -29
- package/dist/init/ast-camera.js +0 -267
- package/dist/init/ast-layout.d.ts +0 -15
- package/dist/init/ast-layout.js +0 -167
- package/dist/init/claude-hook-constants.d.ts +0 -9
- package/dist/init/claude-hook-constants.js +0 -91
- package/dist/init/lan-ip.d.ts +0 -11
- package/dist/init/lan-ip.js +0 -51
- package/dist/init/monorepo.d.ts +0 -13
- package/dist/init/monorepo.js +0 -185
- package/dist/init/oauth.d.ts +0 -52
- package/dist/init/oauth.js +0 -220
- package/dist/init/package-manager.d.ts +0 -11
- package/dist/init/package-manager.js +0 -60
- package/dist/init/prompt.d.ts +0 -12
- package/dist/init/prompt.js +0 -68
- package/dist/init/shell-profile.d.ts +0 -22
- package/dist/init/shell-profile.js +0 -85
- package/dist/init/steps.d.ts +0 -135
- package/dist/init/steps.js +0 -399
- package/dist/init/url-scheme.d.ts +0 -42
- package/dist/init/url-scheme.js +0 -187
- package/dist/init/walkthrough.d.ts +0 -76
- package/dist/init/walkthrough.js +0 -340
- package/dist/init.d.ts +0 -8
- package/dist/init.js +0 -395
- package/dist/iproxy-manager.d.ts +0 -32
- package/dist/iproxy-manager.js +0 -216
- package/dist/mac-caffeinate.d.ts +0 -10
- package/dist/mac-caffeinate.js +0 -56
- package/dist/permission-interceptor.d.ts +0 -29
- package/dist/permission-interceptor.js +0 -185
- package/dist/prebuild-detector.d.ts +0 -19
- package/dist/prebuild-detector.js +0 -174
- package/dist/preflight.d.ts +0 -34
- package/dist/preflight.js +0 -847
- package/dist/screen.d.ts +0 -184
- package/dist/screen.js +0 -931
- package/dist/signal-listener.d.ts +0 -27
- package/dist/signal-listener.js +0 -135
- package/dist/simulator-boot.d.ts +0 -52
- package/dist/simulator-boot.js +0 -227
- package/dist/target.d.ts +0 -48
- package/dist/target.js +0 -267
- package/dist/uninstall/cli-runner.d.ts +0 -32
- package/dist/uninstall/cli-runner.js +0 -223
- package/dist/uninstall/footprint.d.ts +0 -40
- package/dist/uninstall/footprint.js +0 -288
- package/dist/uninstall/mcp-tools.d.ts +0 -14
- package/dist/uninstall/mcp-tools.js +0 -175
- package/dist/uninstall/revert-auth.d.ts +0 -22
- package/dist/uninstall/revert-auth.js +0 -31
- package/dist/uninstall/revert-boot.d.ts +0 -24
- package/dist/uninstall/revert-boot.js +0 -242
- package/dist/uninstall/revert-camera.d.ts +0 -12
- package/dist/uninstall/revert-camera.js +0 -199
- package/dist/uninstall/revert-ceraph-dir.d.ts +0 -27
- package/dist/uninstall/revert-ceraph-dir.js +0 -38
- package/dist/uninstall/revert-claude-hooks.d.ts +0 -19
- package/dist/uninstall/revert-claude-hooks.js +0 -191
- package/dist/uninstall/revert-gitignore.d.ts +0 -17
- package/dist/uninstall/revert-gitignore.js +0 -43
- package/dist/uninstall/revert-mcp-clients.d.ts +0 -57
- package/dist/uninstall/revert-mcp-clients.js +0 -194
- package/dist/uninstall/revert-package.d.ts +0 -34
- package/dist/uninstall/revert-package.js +0 -98
- package/dist/uninstall/revert-scheme.d.ts +0 -36
- package/dist/uninstall/revert-scheme.js +0 -139
- package/dist/uninstall/revert-signal-host-env.d.ts +0 -31
- package/dist/uninstall/revert-signal-host-env.js +0 -61
- package/dist/uninstall/walkthrough.d.ts +0 -80
- package/dist/uninstall/walkthrough.js +0 -1244
- package/dist/utils/atomic-write.d.ts +0 -1
- package/dist/utils/atomic-write.js +0 -30
- package/dist/wait-for-device.d.ts +0 -68
- package/dist/wait-for-device.js +0 -368
- package/dist/wda-manager.d.ts +0 -38
- package/dist/wda-manager.js +0 -186
- package/dist/wda-simulator.d.ts +0 -28
- package/dist/wda-simulator.js +0 -257
package/dist/shim/keep-awake.js
CHANGED
|
@@ -1,118 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
let resolvedProvider;
|
|
3
|
-
let resolvedProviderId;
|
|
4
|
-
let active = false;
|
|
5
|
-
export function _resetForTesting() {
|
|
6
|
-
resolvedProvider = undefined;
|
|
7
|
-
resolvedProviderId = undefined;
|
|
8
|
-
active = false;
|
|
9
|
-
}
|
|
10
|
-
export function _setProviderForTesting(provider) {
|
|
11
|
-
resolvedProvider = provider;
|
|
12
|
-
resolvedProviderId = provider ? "test-injected" : null;
|
|
13
|
-
active = false;
|
|
14
|
-
}
|
|
15
|
-
function resolveProvider() {
|
|
16
|
-
const req = globalThis.require;
|
|
17
|
-
if (typeof req === "function") {
|
|
18
|
-
try {
|
|
19
|
-
const mod = req("expo-keep-awake");
|
|
20
|
-
if (mod) {
|
|
21
|
-
const activate = typeof mod.activateKeepAwakeAsync === "function"
|
|
22
|
-
? () => {
|
|
23
|
-
void mod.activateKeepAwakeAsync?.();
|
|
24
|
-
}
|
|
25
|
-
: typeof mod.activateKeepAwake === "function"
|
|
26
|
-
? () => mod.activateKeepAwake()
|
|
27
|
-
: undefined;
|
|
28
|
-
const deactivate = typeof mod.deactivateKeepAwake === "function"
|
|
29
|
-
? () => mod.deactivateKeepAwake()
|
|
30
|
-
: undefined;
|
|
31
|
-
if (activate) {
|
|
32
|
-
return {
|
|
33
|
-
provider: { activate, deactivate },
|
|
34
|
-
id: "expo-keep-awake",
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
const mod = req("react-native-keep-awake");
|
|
43
|
-
const candidate = (mod && mod.default) ??
|
|
44
|
-
mod;
|
|
45
|
-
if (candidate && typeof candidate.activate === "function") {
|
|
46
|
-
return { provider: candidate, id: "react-native-keep-awake" };
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
catch {
|
|
50
|
-
}
|
|
51
|
-
try {
|
|
52
|
-
const rn = req("react-native");
|
|
53
|
-
const nm = rn?.NativeModules?.RNCKeepAwake;
|
|
54
|
-
if (nm && typeof nm.activate === "function") {
|
|
55
|
-
return { provider: nm, id: "RNCKeepAwake" };
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
export function enableKeepAwake() {
|
|
64
|
-
if (!isDevRuntime())
|
|
65
|
-
return { applied: false, provider: null };
|
|
66
|
-
if (active) {
|
|
67
|
-
return { applied: true, provider: providerIdForResult() };
|
|
68
|
-
}
|
|
69
|
-
if (resolvedProvider === undefined) {
|
|
70
|
-
const resolution = resolveProvider();
|
|
71
|
-
if (resolution) {
|
|
72
|
-
resolvedProvider = resolution.provider;
|
|
73
|
-
resolvedProviderId = resolution.id;
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
resolvedProvider = null;
|
|
77
|
-
resolvedProviderId = null;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if (!resolvedProvider || typeof resolvedProvider.activate !== "function") {
|
|
81
|
-
return { applied: false, provider: null };
|
|
82
|
-
}
|
|
83
|
-
try {
|
|
84
|
-
resolvedProvider.activate();
|
|
85
|
-
active = true;
|
|
86
|
-
return { applied: true, provider: providerIdForResult() };
|
|
87
|
-
}
|
|
88
|
-
catch (err) {
|
|
89
|
-
const consoleObj = globalThis.console;
|
|
90
|
-
consoleObj?.warn?.(`[ceraph] keep-awake: provider activate() threw — ${err.message ?? "unknown"}`);
|
|
91
|
-
return { applied: false, provider: null };
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
export function disableKeepAwake() {
|
|
95
|
-
if (!active)
|
|
96
|
-
return;
|
|
97
|
-
active = false;
|
|
98
|
-
const provider = resolvedProvider;
|
|
99
|
-
if (!provider || typeof provider.deactivate !== "function")
|
|
100
|
-
return;
|
|
101
|
-
try {
|
|
102
|
-
provider.deactivate();
|
|
103
|
-
}
|
|
104
|
-
catch {
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
function providerIdForResult() {
|
|
108
|
-
if (!resolvedProvider)
|
|
109
|
-
return null;
|
|
110
|
-
switch (resolvedProviderId) {
|
|
111
|
-
case "expo-keep-awake":
|
|
112
|
-
case "react-native-keep-awake":
|
|
113
|
-
case "RNCKeepAwake":
|
|
114
|
-
return resolvedProviderId;
|
|
115
|
-
default:
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
1
|
+
import{NativeModules}from'react-native';import{isDevRuntime}from'./dev-guard.js';let resolvedProvider,resolvedProviderId,active=![];export function _resetForTesting(){resolvedProvider=undefined,resolvedProviderId=undefined,active=![];}export function _setProviderForTesting(a){resolvedProvider=a,resolvedProviderId=a?'test-injected':null,active=![];}function resolveProvider(){try{const a=require('expo-keep-awake');if(a){const b=typeof a['activateKeepAwakeAsync']==='function'?()=>{void a['activateKeepAwakeAsync']?.();}:typeof a['activateKeepAwake']==='function'?()=>a['activateKeepAwake']():undefined,c=typeof a['deactivateKeepAwake']==='function'?()=>a['deactivateKeepAwake']():undefined;if(b)return{'provider':{'activate':b,'deactivate':c},'id':'expo-keep-awake'};}}catch{}try{const d=require('react-native-keep-awake'),e=(d&&d['default'])??d;if(e&&typeof e['activate']==='function')return{'provider':e,'id':'react-native-keep-awake'};}catch{}try{const f=NativeModules?.['RNCKeepAwake'];if(f&&typeof f['activate']==='function')return{'provider':f,'id':'RNCKeepAwake'};}catch{}return null;}export function enableKeepAwake(){if(!isDevRuntime())return{'applied':![],'provider':null};if(active)return{'applied':!![],'provider':providerIdForResult()};if(resolvedProvider===undefined){const a=resolveProvider();a?(resolvedProvider=a['provider'],resolvedProviderId=a['id']):(resolvedProvider=null,resolvedProviderId=null);}if(!resolvedProvider||typeof resolvedProvider['activate']!=='function')return{'applied':![],'provider':null};try{return resolvedProvider['activate'](),active=!![],{'applied':!![],'provider':providerIdForResult()};}catch(b){const c=globalThis['console'];return c?.['warn']?.('[ceraph]\x20keep-awake:\x20provider\x20activate()\x20threw\x20—\x20'+(b['message']??'unknown')),{'applied':![],'provider':null};}}export function disableKeepAwake(){if(!active)return;active=![];const a=resolvedProvider;if(!a||typeof a['deactivate']!=='function')return;try{a['deactivate']();}catch{}}function providerIdForResult(){if(!resolvedProvider)return null;switch(resolvedProviderId){case'expo-keep-awake':case'react-native-keep-awake':case'RNCKeepAwake':return resolvedProviderId;default:return null;}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let fetchInvocationDepth=0x0;export function beginFetchInvocation(){fetchInvocationDepth++;}export function endFetchInvocation(){if(fetchInvocationDepth>0x0)fetchInvocationDepth--;}export function isInsideFetchInvocation(){return fetchInvocationDepth>0x0;}export function _resetForTesting(){fetchInvocationDepth=0x0;}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type TransportOptions } from "./signal-transport.js";
|
|
2
|
+
interface KeyEntry {
|
|
3
|
+
ts: number;
|
|
4
|
+
prev: string;
|
|
5
|
+
next: string;
|
|
6
|
+
}
|
|
7
|
+
export interface OptimisticObserverOptions {
|
|
8
|
+
transport?: TransportOptions;
|
|
9
|
+
}
|
|
10
|
+
export declare function installOptimisticObserver(opts?: OptimisticObserverOptions): boolean;
|
|
11
|
+
export declare function notifyOptimisticUpdate(key: string, prev: string, next: string): void;
|
|
12
|
+
export interface RollbackAnalysisResult {
|
|
13
|
+
rolledBackKeys: Array<{
|
|
14
|
+
key: string;
|
|
15
|
+
prev: string;
|
|
16
|
+
next: string;
|
|
17
|
+
durationMs: number;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export declare function analyzeRollbacks(entries: Array<{
|
|
21
|
+
key: string;
|
|
22
|
+
prev: string;
|
|
23
|
+
next: string;
|
|
24
|
+
ts: number;
|
|
25
|
+
}>): RollbackAnalysisResult;
|
|
26
|
+
export declare function pushEntry(key: string, prev: string, next: string, ts: number): void;
|
|
27
|
+
export declare function _resetForTesting(): void;
|
|
28
|
+
export declare function _bufferForTesting(): Map<string, KeyEntry[]>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isDevRuntime}from'./dev-guard.js';import{postSignal}from'./signal-transport.js';const MAX_BUFFER_PER_KEY=0x10,MAX_KEYS=0x100,ROLLBACK_WINDOW_MS=0x1388;let buffer=new Map(),installed=![],activeTransport;export function installOptimisticObserver(a={}){if(!isDevRuntime())return![];activeTransport=a['transport'];if(installed)return!![];return installed=!![],tryInstallDevtoolsBridge(),!![];}export function notifyOptimisticUpdate(a,b,c){if(!isDevRuntime())return;if(!installed)return;if(b===c)return;pushEntry(a,b,c,Date['now']());}export function analyzeRollbacks(a){if(a['length']===0x0)return{'rolledBackKeys':[]};const b=new Map();for(const d of a){const f=b['get'](d['key'])??[];f['push']({'prev':d['prev'],'next':d['next'],'ts':d['ts']}),b['set'](d['key'],f);}const c=[];for(const [g,h]of b){for(let k=0x0;k<h['length'];k++){const l=h[k];if(l['prev']===l['next'])continue;for(let m=k+0x1;m<h['length'];m++){const n=h[m];if(n['prev']===l['next']&&n['next']===l['prev']){c['push']({'key':g,'prev':l['prev'],'next':l['next'],'durationMs':n['ts']-l['ts']}),k=h['length'];break;}}}}return{'rolledBackKeys':c};}export function pushEntry(a,b,c,d){pruneStaleEntries(d);const e=buffer['get'](a)??[];e['push']({'ts':d,'prev':b,'next':c});if(e['length']>MAX_BUFFER_PER_KEY)e['shift']();buffer['set'](a,e);if(buffer['size']>MAX_KEYS){let f,g=Number['POSITIVE_INFINITY'];for(const [h,j]of buffer){const m=j[j['length']-0x1]?.['ts']??0x0;m<g&&(g=m,f=h);}if(f)buffer['delete'](f);}for(let n=e['length']-0x2;n>=0x0;n--){const o=e[n];if(o['prev']===c&&o['next']===b){void postSignal({'kind':'optimistic-rollback','message':'optimistic\x20rollback\x20observed\x20on\x20'+a,'timestampMs':d,'elementKey':a,'prevText':b,'nextText':c,'durationMs':d-o['ts']},activeTransport);return;}}}function pruneStaleEntries(a){for(const [b,c]of buffer){while(c['length']>0x0&&a-c[0x0]['ts']>ROLLBACK_WINDOW_MS){c['shift']();}if(c['length']===0x0)buffer['delete'](b);}}function tryInstallDevtoolsBridge(){const a=globalThis['__REACT_DEVTOOLS_GLOBAL_HOOK__'];if(!a)return![];const b=new Map();function c(g){if(!g||typeof g!=='object')return;const h=g;if(h['memoizedProps']&&typeof h['memoizedProps']['children']==='string'){const i=d(h),j=h['memoizedProps']['children'],k=b['get'](i);k!==undefined&&k!==j&&pushEntry(i,k,j,Date['now']()),b['set'](i,j);}if(h['child'])c(h['child']);if(h['sibling'])c(h['sibling']);}function d(g){const h=typeof g['type']==='string'?g['type']:typeof g['type']==='function'?g['type']['displayName']??g['type']['name']??'fn':'host',i=typeof g['key']==='string'?'['+g['key']+']':'';return''+h+i;}function e(g,h){try{const i=h;c(i?.['current']);}catch{}}if(typeof a['sub']==='function')try{return a['sub']('commit',e),!![];}catch{}const f=a['onCommitFiberRoot'];return a['onCommitFiberRoot']=(g,h)=>{try{f?.(g,h);}catch{}e(g,h);},!![];}export function _resetForTesting(){buffer=new Map(),installed=![],activeTransport=undefined;}export function _bufferForTesting(){return buffer;}
|
package/dist/shim/reload.js
CHANGED
|
@@ -1,76 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
let installed = false;
|
|
3
|
-
let currentSubscription;
|
|
4
|
-
export function triggerJsReload(deps = {}) {
|
|
5
|
-
if (!isDevRuntime())
|
|
6
|
-
return false;
|
|
7
|
-
try {
|
|
8
|
-
const devSettings = deps.devSettings ?? loadDevSettings();
|
|
9
|
-
if (devSettings && typeof devSettings.reload === "function") {
|
|
10
|
-
devSettings.reload();
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
}
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
export function installReloadListener(deps = {}) {
|
|
19
|
-
const noop = {
|
|
20
|
-
installed: false,
|
|
21
|
-
remove: () => undefined,
|
|
22
|
-
};
|
|
23
|
-
if (!isDevRuntime())
|
|
24
|
-
return noop;
|
|
25
|
-
currentSubscription?.remove?.();
|
|
26
|
-
currentSubscription = undefined;
|
|
27
|
-
let linking;
|
|
28
|
-
try {
|
|
29
|
-
linking = deps.linking ?? loadLinking();
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
return noop;
|
|
33
|
-
}
|
|
34
|
-
if (!linking || typeof linking.addEventListener !== "function") {
|
|
35
|
-
return noop;
|
|
36
|
-
}
|
|
37
|
-
const sub = linking.addEventListener("url", (event) => {
|
|
38
|
-
if (typeof event?.url !== "string")
|
|
39
|
-
return;
|
|
40
|
-
if (event.url === "ceraph://reload" || event.url.startsWith("ceraph://reload?")) {
|
|
41
|
-
triggerJsReload(deps);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
currentSubscription = sub;
|
|
45
|
-
installed = true;
|
|
46
|
-
return {
|
|
47
|
-
installed: true,
|
|
48
|
-
remove: () => {
|
|
49
|
-
sub?.remove?.();
|
|
50
|
-
if (currentSubscription === sub)
|
|
51
|
-
currentSubscription = undefined;
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function loadDevSettings() {
|
|
56
|
-
const req = globalThis.require;
|
|
57
|
-
if (typeof req !== "function")
|
|
58
|
-
return undefined;
|
|
59
|
-
const mod = req("react-native");
|
|
60
|
-
return mod?.DevSettings;
|
|
61
|
-
}
|
|
62
|
-
function loadLinking() {
|
|
63
|
-
const req = globalThis.require;
|
|
64
|
-
if (typeof req !== "function")
|
|
65
|
-
return undefined;
|
|
66
|
-
const mod = req("react-native");
|
|
67
|
-
return mod?.Linking;
|
|
68
|
-
}
|
|
69
|
-
export function _resetForTesting() {
|
|
70
|
-
currentSubscription?.remove?.();
|
|
71
|
-
currentSubscription = undefined;
|
|
72
|
-
installed = false;
|
|
73
|
-
}
|
|
74
|
-
export function _isInstalledForTesting() {
|
|
75
|
-
return installed;
|
|
76
|
-
}
|
|
1
|
+
import{DevSettings as a,Linking as b}from'react-native';import{isDevRuntime}from'./dev-guard.js';let installed=![],currentSubscription;export function triggerJsReload(c={}){if(!isDevRuntime())return![];try{const d=c['devSettings']??loadDevSettings();if(d&&typeof d['reload']==='function')return d['reload'](),!![];}catch{}return![];}export function installReloadListener(c={}){const d={'installed':![],'remove':()=>undefined};if(!isDevRuntime())return d;currentSubscription?.['remove']?.(),currentSubscription=undefined;let e;try{e=c['linking']??loadLinking();}catch{return d;}if(!e||typeof e['addEventListener']!=='function')return d;const f=e['addEventListener']('url',g=>{if(typeof g?.['url']!=='string')return;(g['url']==='ceraph://reload'||g['url']['startsWith']('ceraph://reload?'))&&triggerJsReload(c);});return currentSubscription=f,installed=!![],{'installed':!![],'remove':()=>{f?.['remove']?.();if(currentSubscription===f)currentSubscription=undefined;}};}function loadDevSettings(){return a;}function loadLinking(){return b;}export function _resetForTesting(){currentSubscription?.['remove']?.(),currentSubscription=undefined,installed=![];}export function _isInstalledForTesting(){return installed;}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
interface AsyncStorageLike {
|
|
2
|
+
clear: () => Promise<void>;
|
|
3
|
+
}
|
|
4
|
+
interface LinkingLike {
|
|
5
|
+
addEventListener: (type: "url", handler: (event: {
|
|
6
|
+
url: string;
|
|
7
|
+
}) => void) => {
|
|
8
|
+
remove?: () => void;
|
|
9
|
+
} | undefined;
|
|
10
|
+
}
|
|
11
|
+
interface ResetDeps {
|
|
12
|
+
asyncStorage?: AsyncStorageLike | null;
|
|
13
|
+
linking?: LinkingLike;
|
|
14
|
+
}
|
|
15
|
+
export interface ClearAppStorageResult {
|
|
16
|
+
cleared: boolean;
|
|
17
|
+
hooksRun: number;
|
|
18
|
+
hooksFailed: number;
|
|
19
|
+
reason?: string;
|
|
20
|
+
}
|
|
21
|
+
type ResetHook = () => void | Promise<void>;
|
|
22
|
+
export declare function registerResetHook(hook: ResetHook): () => void;
|
|
23
|
+
export declare function clearAppStorage(deps?: ResetDeps): Promise<ClearAppStorageResult>;
|
|
24
|
+
export interface InstallResetListenerResult {
|
|
25
|
+
installed: boolean;
|
|
26
|
+
remove: () => void;
|
|
27
|
+
}
|
|
28
|
+
export declare function installResetListener(deps?: ResetDeps): InstallResetListenerResult;
|
|
29
|
+
export declare function _resetForTesting(): void;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Linking as a}from'react-native';import{isDevRuntime}from'./dev-guard.js';const hooks=new Set();let currentSubscription;export function registerResetHook(b){return hooks['add'](b),()=>{hooks['delete'](b);};}export async function clearAppStorage(b={}){if(!isDevRuntime())return{'cleared':![],'hooksRun':0x0,'hooksFailed':0x0,'reason':'production'};let c=0x0,d=0x0;for(const f of Array['from'](hooks)){c++;try{await f();}catch{d++;}}const e=b['asyncStorage']===null?null:b['asyncStorage']??loadAsyncStorage();if(!e)return{'cleared':![],'hooksRun':c,'hooksFailed':d,'reason':'AsyncStorage\x20not\x20installed'};try{return await e['clear'](),{'cleared':!![],'hooksRun':c,'hooksFailed':d};}catch(g){return{'cleared':![],'hooksRun':c,'hooksFailed':d,'reason':g['message']??'AsyncStorage.clear()\x20failed'};}}export function installResetListener(b={}){const c={'installed':![],'remove':()=>undefined};if(!isDevRuntime())return c;currentSubscription?.['remove']?.(),currentSubscription=undefined;let d;try{d=b['linking']??loadLinking();}catch{return c;}if(!d||typeof d['addEventListener']!=='function')return c;const e=d['addEventListener']('url',f=>{if(typeof f?.['url']!=='string')return;(f['url']==='ceraph://reset'||f['url']['startsWith']('ceraph://reset?'))&&void clearAppStorage(b);});return currentSubscription=e,{'installed':!![],'remove':()=>{e?.['remove']?.();if(currentSubscription===e)currentSubscription=undefined;}};}function loadAsyncStorage(){try{const b=require('@react-native-async-storage/async-storage');if(!b)return undefined;if('clear'in b&&typeof b['clear']==='function')return b;const c=b['default'];if(c&&typeof c['clear']==='function')return c;return undefined;}catch{return undefined;}}function loadLinking(){return a;}export function _resetForTesting(){hooks['clear'](),currentSubscription?.['remove']?.(),currentSubscription=undefined;}
|
|
@@ -2,10 +2,18 @@ import type { TransportOptions } from "./signal-transport.js";
|
|
|
2
2
|
export interface InstallSignalCaptureOptions {
|
|
3
3
|
transport?: TransportOptions;
|
|
4
4
|
installReloadListener?: boolean;
|
|
5
|
+
installResetListener?: boolean;
|
|
6
|
+
installOptimisticObserver?: boolean;
|
|
7
|
+
installCommandPoll?: boolean;
|
|
5
8
|
}
|
|
6
9
|
export interface InstallSignalCaptureResult {
|
|
7
10
|
errorHandler: boolean;
|
|
8
11
|
fetchInterceptor: boolean;
|
|
12
|
+
xhrInterceptor: boolean;
|
|
13
|
+
consoleCapture: boolean;
|
|
9
14
|
reloadListener: boolean;
|
|
15
|
+
resetListener: boolean;
|
|
16
|
+
optimisticObserver: boolean;
|
|
17
|
+
commandPoll: boolean;
|
|
10
18
|
}
|
|
11
19
|
export declare function installSignalCapture(opts?: InstallSignalCaptureOptions): InstallSignalCaptureResult;
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { installFetchInterceptor } from "./fetch-interceptor.js";
|
|
3
|
-
import { installReloadListener } from "./reload.js";
|
|
4
|
-
export function installSignalCapture(opts = {}) {
|
|
5
|
-
const wantReload = opts.installReloadListener !== false;
|
|
6
|
-
let reloadListener = false;
|
|
7
|
-
if (wantReload) {
|
|
8
|
-
reloadListener = installReloadListener().installed;
|
|
9
|
-
}
|
|
10
|
-
return {
|
|
11
|
-
errorHandler: installErrorHandler({ transport: opts.transport }),
|
|
12
|
-
fetchInterceptor: installFetchInterceptor({ transport: opts.transport }),
|
|
13
|
-
reloadListener,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
1
|
+
import{installConsoleCapture}from'./console-capture.js';import{installErrorHandler}from'./error-handler.js';import{installFetchInterceptor}from'./fetch-interceptor.js';import{installOptimisticObserver}from'./optimistic-observer.js';import{installReloadListener}from'./reload.js';import{installResetListener}from'./reset.js';import{installCommandPoll}from'./command-poll.js';import{resolveDevServerHost}from'./dev-host.js';import{installXhrInterceptor}from'./xhr-interceptor.js';function fetchIsXhrBacked(a){if(typeof a['XMLHttpRequest']!=='function')return![];const b=a['fetch'];if(typeof b!=='function')return![];const c=b,d=c['__ceraphOriginalFetch']??c;return d['polyfill']===!![];}export function installSignalCapture(a={}){const b=a['transport']?.['host'],c=b??resolveDevServerHost(),d={...a['transport'],...c?{'host':c}:{}},e=a['installReloadListener']!==![];let f=![];e&&(f=installReloadListener()['installed']);const g=a['installResetListener']!==![];let h=![];g&&(h=installResetListener()['installed']);const i=a['installOptimisticObserver']!==![];let j=![];i&&(j=installOptimisticObserver({'transport':d}));const k=a['installCommandPoll']!==![];let l=![];k&&(l=installCommandPoll({'host':d['host'],'port':d['port']})['installed']);const m=globalThis,n=fetchIsXhrBacked(m),o=typeof m['XMLHttpRequest']==='function';let p=![],q=![];return n?q=installXhrInterceptor({'transport':d}):(p=installFetchInterceptor({'transport':d}),o&&(q=installXhrInterceptor({'transport':d}))),{'errorHandler':installErrorHandler({'transport':d}),'fetchInterceptor':p,'xhrInterceptor':q,'consoleCapture':installConsoleCapture({'transport':d}),'reloadListener':f,'resetListener':h,'optimisticObserver':j,'commandPoll':l};}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type SignalKind = "js-error" | "unhandled-rejection" | "network-error" | "network-4xx";
|
|
1
|
+
export type SignalKind = "js-error" | "unhandled-rejection" | "network-error" | "network-4xx" | "mutation-fired" | "optimistic-rollback" | "console-error" | "async-storage-read" | "storage-ack" | "testid-sentinel";
|
|
2
2
|
export interface SignalPayload {
|
|
3
3
|
kind: SignalKind;
|
|
4
4
|
message: string;
|
|
@@ -8,10 +8,23 @@ export interface SignalPayload {
|
|
|
8
8
|
status?: number;
|
|
9
9
|
method?: string;
|
|
10
10
|
durationMs?: number;
|
|
11
|
+
elementKey?: string;
|
|
12
|
+
prevText?: string;
|
|
13
|
+
nextText?: string;
|
|
14
|
+
key?: string;
|
|
15
|
+
valueHash?: string;
|
|
16
|
+
storageAckSuccess?: boolean;
|
|
17
|
+
storageAckCount?: number;
|
|
18
|
+
storageAckKeys?: string[];
|
|
19
|
+
storageAckRequestId?: string;
|
|
20
|
+
pluginVersion?: string;
|
|
21
|
+
babelConfigHash?: string;
|
|
11
22
|
}
|
|
12
23
|
export interface TransportOptions {
|
|
13
24
|
host?: string;
|
|
14
25
|
port?: number;
|
|
15
26
|
rethrowOnFailure?: boolean;
|
|
16
27
|
}
|
|
28
|
+
export declare function signalEndpointUrl(opts?: TransportOptions): string;
|
|
29
|
+
export declare function isSignalEndpointUrl(url: string, opts?: TransportOptions): boolean;
|
|
17
30
|
export declare function postSignal(payload: SignalPayload, opts?: TransportOptions): Promise<void>;
|
|
@@ -1,43 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
const DEFAULT_HOST = "localhost";
|
|
3
|
-
const DEFAULT_PORT = 8101;
|
|
4
|
-
const POST_TIMEOUT_MS = 1500;
|
|
5
|
-
function resolveEndpoint(opts = {}) {
|
|
6
|
-
let envHost;
|
|
7
|
-
let envPort;
|
|
8
|
-
if (typeof globalThis !== "undefined") {
|
|
9
|
-
const proc = globalThis.process;
|
|
10
|
-
envHost = proc?.env?.CERAPH_SIGNAL_HOST;
|
|
11
|
-
envPort = proc?.env?.CERAPH_SIGNAL_PORT;
|
|
12
|
-
}
|
|
13
|
-
const host = opts.host ?? envHost ?? DEFAULT_HOST;
|
|
14
|
-
const port = opts.port ?? (envPort ? Number.parseInt(envPort, 10) : DEFAULT_PORT);
|
|
15
|
-
return { host, port: Number.isFinite(port) ? port : DEFAULT_PORT };
|
|
16
|
-
}
|
|
17
|
-
export async function postSignal(payload, opts = {}) {
|
|
18
|
-
if (!isDevRuntime())
|
|
19
|
-
return;
|
|
20
|
-
const { host, port } = resolveEndpoint(opts);
|
|
21
|
-
const controller = new AbortController();
|
|
22
|
-
const timer = setTimeout(() => controller.abort(), POST_TIMEOUT_MS);
|
|
23
|
-
try {
|
|
24
|
-
const fetchFn = globalThis.fetch;
|
|
25
|
-
if (typeof fetchFn !== "function")
|
|
26
|
-
return;
|
|
27
|
-
await fetchFn(`http://${host}:${port}/signal`, {
|
|
28
|
-
method: "POST",
|
|
29
|
-
headers: { "Content-Type": "application/json" },
|
|
30
|
-
body: JSON.stringify(payload),
|
|
31
|
-
signal: controller.signal,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
catch (err) {
|
|
35
|
-
if (opts.rethrowOnFailure)
|
|
36
|
-
throw err;
|
|
37
|
-
const consoleObj = globalThis.console;
|
|
38
|
-
consoleObj?.warn?.(`[ceraph] signal transport: failed to post ${payload.kind} (${err.message ?? "unknown"})`);
|
|
39
|
-
}
|
|
40
|
-
finally {
|
|
41
|
-
clearTimeout(timer);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
1
|
+
import{isDevRuntime}from'./dev-guard.js';import{resolveDevServerHost}from'./dev-host.js';const DEFAULT_HOST='localhost',DEFAULT_PORT=0x1fa5,POST_TIMEOUT_MS=0x5dc;function resolveEndpoint(a={}){let b,c;if(typeof globalThis!=='undefined'){const f=globalThis['process'];b=f?.['env']?.['CERAPH_SIGNAL_HOST'],c=f?.['env']?.['CERAPH_SIGNAL_PORT'];}const d=a['host']??b??resolveDevServerHost()??DEFAULT_HOST,e=a['port']??(c?Number['parseInt'](c,0xa):DEFAULT_PORT);return{'host':d,'port':Number['isFinite'](e)?e:DEFAULT_PORT};}export function signalEndpointUrl(a={}){const {host:b,port:c}=resolveEndpoint(a);return'http://'+b+':'+c+'/signal';}export function isSignalEndpointUrl(a,b={}){const {port:c}=resolveEndpoint(b);return a['endsWith'](':'+c+'/signal');}export async function postSignal(a,b={}){if(!isDevRuntime())return;const c=signalEndpointUrl(b),d=new AbortController(),e=setTimeout(()=>d['abort'](),POST_TIMEOUT_MS);try{const f=globalThis['fetch'],g=f?.['__ceraphOriginalFetch']??f;if(typeof g!=='function')return;await g(c,{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify'](a),'signal':d['signal']});}catch(h){if(b['rethrowOnFailure'])throw h;const i=globalThis['console'];i?.['warn']?.('[ceraph]\x20signal\x20transport:\x20failed\x20to\x20post\x20'+a['kind']+'\x20('+(h['message']??'unknown')+')');}finally{clearTimeout(e);}}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type TransportOptions } from "./signal-transport.js";
|
|
2
|
+
interface XhrInstanceLike {
|
|
3
|
+
status: number;
|
|
4
|
+
addEventListener: (type: string, handler: () => void) => void;
|
|
5
|
+
removeEventListener?: (type: string, handler: () => void) => void;
|
|
6
|
+
}
|
|
7
|
+
interface XhrRequestRecord {
|
|
8
|
+
method: string;
|
|
9
|
+
url: string;
|
|
10
|
+
startedAt: number;
|
|
11
|
+
fetchOwned: boolean;
|
|
12
|
+
reported: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface TrackedXhr extends XhrInstanceLike {
|
|
15
|
+
__ceraphMethod?: string;
|
|
16
|
+
__ceraphUrl?: string;
|
|
17
|
+
__ceraphActiveReq?: XhrRequestRecord;
|
|
18
|
+
__ceraphTeardown?: () => void;
|
|
19
|
+
}
|
|
20
|
+
type OpenFn = (this: TrackedXhr, ...args: unknown[]) => unknown;
|
|
21
|
+
type SendFn = (this: TrackedXhr, ...args: unknown[]) => unknown;
|
|
22
|
+
export interface XhrConstructorLike {
|
|
23
|
+
new (): unknown;
|
|
24
|
+
prototype: {
|
|
25
|
+
open: OpenFn;
|
|
26
|
+
send: SendFn;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface InstallXhrInterceptorOptions {
|
|
30
|
+
transport?: TransportOptions;
|
|
31
|
+
globalRef?: {
|
|
32
|
+
XMLHttpRequest?: XhrConstructorLike;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export declare function installXhrInterceptor(opts?: InstallXhrInterceptorOptions): boolean;
|
|
36
|
+
export declare function _uninstallForTesting(globalRef?: {
|
|
37
|
+
XMLHttpRequest?: XhrConstructorLike;
|
|
38
|
+
}): void;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isDevRuntime}from'./dev-guard.js';import{isInsideFetchInvocation}from'./network-ownership.js';import{postSignal,isSignalEndpointUrl}from'./signal-transport.js';const MUTATING_METHODS=new Set(['POST','PUT','PATCH','DELETE']);export function installXhrInterceptor(a={}){if(!isDevRuntime())return![];const b=a['globalRef']??globalThis,c=b['XMLHttpRequest'];if(!c||typeof c!=='function'||!c['prototype'])return![];const d=c['prototype'];if(typeof d['open']!=='function'||typeof d['send']!=='function')return![];const e=d['open'],f=d['send'],g=e['__ceraphOriginalOpen']??e,h=f['__ceraphOriginalSend']??f,i=function(...k){try{teardownActive(this);const [l,m]=k;this['__ceraphMethod']=typeof l==='string'?l['toUpperCase']():'GET',this['__ceraphUrl']=typeof m==='string'?m:safeString(m);}catch{}return g['apply'](this,k);},j=function(...k){try{teardownActive(this);const l={'method':this['__ceraphMethod']??'GET','url':this['__ceraphUrl']??'<unknown-url>','startedAt':Date['now'](),'fetchOwned':isInsideFetchInvocation(),'reported':![]};this['__ceraphActiveReq']=l,this['__ceraphTeardown']=attachTerminalListeners(this,l,a['transport']);}catch{}return h['apply'](this,k);};return i['__ceraphOriginalOpen']=g,j['__ceraphOriginalSend']=h,d['open']=i,d['send']=j,!![];}function teardownActive(a){a['__ceraphTeardown']&&(a['__ceraphTeardown'](),a['__ceraphTeardown']=undefined),a['__ceraphActiveReq']=undefined;}function attachTerminalListeners(a,b,c){const d=()=>reportOutcome(a,b,c,undefined),e=()=>reportOutcome(a,b,c,'error'),f=()=>reportOutcome(a,b,c,'timeout'),g=()=>reportOutcome(a,b,c,'abort');return a['addEventListener']('load',d),a['addEventListener']('error',e),a['addEventListener']('timeout',f),a['addEventListener']('abort',g),()=>{if(typeof a['removeEventListener']!=='function')return;a['removeEventListener']('load',d),a['removeEventListener']('error',e),a['removeEventListener']('timeout',f),a['removeEventListener']('abort',g);};}function reportOutcome(a,b,c,d){try{if(b['reported'])return;b['reported']=!![];if(b['fetchOwned'])return;const e=b['url'];if(isSignalEndpointUrl(e,c))return;const f=b['method'],g=Date['now']()-b['startedAt'];if(d!==undefined){void postSignal({'kind':'network-error','message':f+'\x20'+e+'\x20failed:\x20'+d,'timestampMs':Date['now'](),'url':e,'method':f,...g!==undefined?{'durationMs':g}:{}},c);return;}const h=a['status'];if(h>=0x1f4)void postSignal({'kind':'network-error','message':f+'\x20'+e+'\x20→\x20'+h,'timestampMs':Date['now'](),'url':e,'status':h,'method':f,...g!==undefined?{'durationMs':g}:{}},c);else{if(h>=0x190)void postSignal({'kind':'network-4xx','message':f+'\x20'+e+'\x20→\x20'+h,'timestampMs':Date['now'](),'url':e,'status':h,'method':f,...g!==undefined?{'durationMs':g}:{}},c);else h>=0xc8&&MUTATING_METHODS['has'](f)&&void postSignal({'kind':'mutation-fired','message':f+'\x20'+e+'\x20→\x20'+h,'timestampMs':Date['now'](),'url':e,'status':h,'method':f,...g!==undefined?{'durationMs':g}:{}},c);}}catch{}}function safeString(a){try{return String(a);}catch{return'<unknown-url>';}}export function _uninstallForTesting(a=globalThis){const b=a['XMLHttpRequest']?.['prototype'];if(!b)return;const c=b['open'],d=b['send'];if(c?.['__ceraphOriginalOpen'])b['open']=c['__ceraphOriginalOpen'];if(d?.['__ceraphOriginalSend'])b['send']=d['__ceraphOriginalSend'];}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ceraph/react-native-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "MCP server for React Native and Expo development workflow",
|
|
5
|
+
"author": "Ike Studios LLC",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"react-native",
|
|
7
8
|
"expo",
|
|
@@ -27,6 +28,10 @@
|
|
|
27
28
|
"bugs": {
|
|
28
29
|
"url": "https://github.com/ceraph-dev/community/issues"
|
|
29
30
|
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/ceraph-dev/community.git"
|
|
34
|
+
},
|
|
30
35
|
"type": "module",
|
|
31
36
|
"main": "./dist/index.js",
|
|
32
37
|
"types": "./dist/index.d.ts",
|
|
@@ -36,12 +41,19 @@
|
|
|
36
41
|
"exports": {
|
|
37
42
|
".": {
|
|
38
43
|
"types": "./dist/index.d.ts",
|
|
39
|
-
"import": "./dist/index.js"
|
|
44
|
+
"import": "./dist/index.js",
|
|
45
|
+
"default": "./dist/index.js"
|
|
40
46
|
},
|
|
41
47
|
"./shim": {
|
|
42
48
|
"types": "./dist/shim/index.d.ts",
|
|
49
|
+
"react-native": "./dist/shim/index.js",
|
|
43
50
|
"import": "./dist/shim/index.js",
|
|
44
|
-
"
|
|
51
|
+
"default": "./dist/shim/index.js"
|
|
52
|
+
},
|
|
53
|
+
"./babel-plugin": {
|
|
54
|
+
"types": "./dist/babel-plugin/index.d.ts",
|
|
55
|
+
"import": "./dist/babel-plugin/index.js",
|
|
56
|
+
"require": "./dist/babel-plugin/index.cjs"
|
|
45
57
|
}
|
|
46
58
|
},
|
|
47
59
|
"files": [
|
|
@@ -50,11 +62,6 @@
|
|
|
50
62
|
"README.md",
|
|
51
63
|
"LICENSE"
|
|
52
64
|
],
|
|
53
|
-
"scripts": {
|
|
54
|
-
"build": "tsc && tsc -p tsconfig.shim.json",
|
|
55
|
-
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.shim.json",
|
|
56
|
-
"test": "vitest run --passWithNoTests"
|
|
57
|
-
},
|
|
58
65
|
"dependencies": {
|
|
59
66
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
60
67
|
"plist": "^3.1.1",
|
|
@@ -62,11 +69,15 @@
|
|
|
62
69
|
"zod": "^3.25.0"
|
|
63
70
|
},
|
|
64
71
|
"peerDependencies": {
|
|
72
|
+
"@babel/core": ">=7",
|
|
65
73
|
"expo-camera": "*",
|
|
66
74
|
"react": "*",
|
|
67
75
|
"react-native": "*"
|
|
68
76
|
},
|
|
69
77
|
"peerDependenciesMeta": {
|
|
78
|
+
"@babel/core": {
|
|
79
|
+
"optional": true
|
|
80
|
+
},
|
|
70
81
|
"react": {
|
|
71
82
|
"optional": true
|
|
72
83
|
},
|
|
@@ -78,10 +89,20 @@
|
|
|
78
89
|
}
|
|
79
90
|
},
|
|
80
91
|
"devDependencies": {
|
|
92
|
+
"@babel/core": "^7.25.0",
|
|
93
|
+
"@babel/plugin-syntax-jsx": "^7.25.0",
|
|
94
|
+
"@babel/preset-typescript": "^7.25.0",
|
|
95
|
+
"@babel/types": "^7.25.0",
|
|
96
|
+
"@types/babel__core": "^7.20.5",
|
|
81
97
|
"@types/node": "^22",
|
|
82
98
|
"@types/plist": "^3.0.5",
|
|
99
|
+
"javascript-obfuscator": "^5.4.3",
|
|
100
|
+
"tsup": "^8.5.0",
|
|
101
|
+
"tsx": "^4",
|
|
83
102
|
"typescript": "^5.7",
|
|
84
|
-
"vitest": "^3"
|
|
103
|
+
"vitest": "^3",
|
|
104
|
+
"@ceraph/core": "0.1.0",
|
|
105
|
+
"@ceraph/graph": "0.1.0"
|
|
85
106
|
},
|
|
86
107
|
"engines": {
|
|
87
108
|
"node": ">=18"
|
|
@@ -89,5 +110,13 @@
|
|
|
89
110
|
"publishConfig": {
|
|
90
111
|
"access": "public"
|
|
91
112
|
},
|
|
92
|
-
"license": "FSL-1.1-MIT"
|
|
93
|
-
|
|
113
|
+
"license": "FSL-1.1-MIT",
|
|
114
|
+
"scripts": {
|
|
115
|
+
"build": "rm -rf dist && tsup && tsc -p tsconfig.shim.json",
|
|
116
|
+
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.shim.json",
|
|
117
|
+
"test": "vitest run --passWithNoTests",
|
|
118
|
+
"check:catalog-key": "tsx scripts/check-catalog-key.ts",
|
|
119
|
+
"obfuscate": "tsx scripts/obfuscate.ts",
|
|
120
|
+
"postinstall": "node -e \"try{var e=process.env;if(e.CI||e.CERAPH_SKIP_POSTINSTALL||require('fs').existsSync(process.cwd()+'/../../pnpm-workspace.yaml'))process.exit(0);process.stderr.write('\\n[@ceraph/react-native-mcp] installed. To finish setup run: npx @ceraph/react-native-mcp init\\n (MCP config, sign-in, the runtime-error hook, and your Mac LAN IP. Build/run/device tools work without it.)\\n\\n')}catch(_){}\""
|
|
121
|
+
}
|
|
122
|
+
}
|
package/dist/app-lifecycle.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { ScreenManager } from "./screen.js";
|
|
2
|
-
import type { TargetResolver } from "./target.js";
|
|
3
|
-
export interface InstalledApp {
|
|
4
|
-
bundleId: string;
|
|
5
|
-
name: string;
|
|
6
|
-
version?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface LifecycleResult {
|
|
9
|
-
success: boolean;
|
|
10
|
-
transport: "devicectl" | "idb" | "simctl" | "wda" | "none";
|
|
11
|
-
error?: string;
|
|
12
|
-
details?: Record<string, unknown>;
|
|
13
|
-
}
|
|
14
|
-
export declare function parseSimctlListapps(stdout: string): InstalledApp[];
|
|
15
|
-
export declare class AppLifecycle {
|
|
16
|
-
private screen?;
|
|
17
|
-
private targetResolver?;
|
|
18
|
-
private udid;
|
|
19
|
-
private udidResolved;
|
|
20
|
-
private udidResolvedAt;
|
|
21
|
-
private static readonly UDID_TTL_MS;
|
|
22
|
-
private udidInflight;
|
|
23
|
-
private devicectlAvailable;
|
|
24
|
-
private idbAvailable;
|
|
25
|
-
private installedAppsCache;
|
|
26
|
-
private readonly INSTALLED_CACHE_MS;
|
|
27
|
-
constructor(screen?: ScreenManager | undefined, targetResolver?: TargetResolver | undefined);
|
|
28
|
-
setTargetResolver(resolver: TargetResolver): void;
|
|
29
|
-
private pickTransport;
|
|
30
|
-
getUdid(): Promise<string | null>;
|
|
31
|
-
private checkDevicectl;
|
|
32
|
-
private checkIdb;
|
|
33
|
-
launchApp(bundleId: string): Promise<LifecycleResult>;
|
|
34
|
-
terminateApp(bundleId: string): Promise<LifecycleResult>;
|
|
35
|
-
activateApp(bundleId: string): Promise<LifecycleResult>;
|
|
36
|
-
listInstalledApps(): Promise<{
|
|
37
|
-
success: boolean;
|
|
38
|
-
apps: InstalledApp[];
|
|
39
|
-
error?: string;
|
|
40
|
-
}>;
|
|
41
|
-
private listInstalledAppsSimulator;
|
|
42
|
-
getActiveApp(): Promise<{
|
|
43
|
-
success: boolean;
|
|
44
|
-
bundleId?: string;
|
|
45
|
-
pid?: number;
|
|
46
|
-
name?: string;
|
|
47
|
-
error?: string;
|
|
48
|
-
}>;
|
|
49
|
-
reset(): void;
|
|
50
|
-
}
|