react-native-inapp-inspector 2.0.7 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +0 -11
- package/dist/commonjs/components/Inspector/InspectorHeader.js +25 -28
- package/dist/commonjs/components/Inspector/MainScreen.js +2 -19
- package/dist/commonjs/components/Inspector/NetworkDetail.js +0 -15
- package/dist/commonjs/components/Inspector/PerformanceTab.js +18 -30
- package/dist/commonjs/components/Inspector/SettingsPanel.js +49 -448
- package/dist/commonjs/components/Inspector/TabBar.js +2 -23
- package/dist/commonjs/components/NetworkIcons.d.ts +0 -12
- package/dist/commonjs/components/NetworkIcons.js +3 -72
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -1
- package/dist/commonjs/helpers/index.d.ts +0 -2
- package/dist/commonjs/helpers/index.js +1 -12
- package/dist/commonjs/helpers/settingsStore.d.ts +1 -1
- package/dist/commonjs/helpers/settingsStore.js +2 -4
- package/dist/commonjs/i18n/locales/en.json +2 -3
- package/dist/commonjs/index.d.ts +0 -1
- package/dist/commonjs/index.js +9 -127
- package/dist/commonjs/native/NativeInspector.d.ts +0 -1
- package/dist/commonjs/types/enums.d.ts +0 -7
- package/dist/commonjs/types/enums.js +0 -7
- package/dist/commonjs/types/interfaces.d.ts +0 -77
- package/dist/esm/components/Inspector/InspectorHeader.js +25 -28
- package/dist/esm/components/Inspector/MainScreen.js +2 -19
- package/dist/esm/components/Inspector/NetworkDetail.js +1 -16
- package/dist/esm/components/Inspector/PerformanceTab.js +19 -31
- package/dist/esm/components/Inspector/SettingsPanel.js +50 -449
- package/dist/esm/components/Inspector/TabBar.js +3 -24
- package/dist/esm/components/NetworkIcons.d.ts +0 -12
- package/dist/esm/components/NetworkIcons.js +0 -57
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/helpers/index.d.ts +0 -2
- package/dist/esm/helpers/index.js +0 -10
- package/dist/esm/helpers/settingsStore.d.ts +1 -1
- package/dist/esm/helpers/settingsStore.js +2 -4
- package/dist/esm/i18n/locales/en.json +2 -3
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +8 -123
- package/dist/esm/native/NativeInspector.d.ts +0 -1
- package/dist/esm/types/enums.d.ts +0 -7
- package/dist/esm/types/enums.js +0 -7
- package/dist/esm/types/interfaces.d.ts +0 -77
- package/ios/NetworkInspectorModule.mm +5 -12
- package/package.json +1 -4
- package/dist/commonjs/components/Inspector/AuditTab.d.ts +0 -3
- package/dist/commonjs/components/Inspector/AuditTab.js +0 -741
- package/dist/commonjs/components/Inspector/DeviceTab.d.ts +0 -3
- package/dist/commonjs/components/Inspector/DeviceTab.js +0 -717
- package/dist/commonjs/components/Inspector/FirstTimeWalkthroughModal.d.ts +0 -7
- package/dist/commonjs/components/Inspector/FirstTimeWalkthroughModal.js +0 -600
- package/dist/commonjs/components/Inspector/PerformanceHud.d.ts +0 -7
- package/dist/commonjs/components/Inspector/PerformanceHud.js +0 -210
- package/dist/commonjs/components/Inspector/RequestReplayModal.d.ts +0 -9
- package/dist/commonjs/components/Inspector/RequestReplayModal.js +0 -792
- package/dist/commonjs/components/Inspector/RequestReplayView.d.ts +0 -8
- package/dist/commonjs/components/Inspector/RequestReplayView.js +0 -871
- package/dist/commonjs/components/Inspector/StorageTab.d.ts +0 -3
- package/dist/commonjs/components/Inspector/StorageTab.js +0 -610
- package/dist/commonjs/customHooks/storageInspector.d.ts +0 -13
- package/dist/commonjs/customHooks/storageInspector.js +0 -179
- package/dist/commonjs/helpers/deviceInfo.d.ts +0 -4
- package/dist/commonjs/helpers/deviceInfo.js +0 -94
- package/dist/commonjs/helpers/packageAuditor.d.ts +0 -5
- package/dist/commonjs/helpers/packageAuditor.js +0 -182
- package/dist/esm/components/Inspector/AuditTab.d.ts +0 -3
- package/dist/esm/components/Inspector/AuditTab.js +0 -702
- package/dist/esm/components/Inspector/DeviceTab.d.ts +0 -3
- package/dist/esm/components/Inspector/DeviceTab.js +0 -678
- package/dist/esm/components/Inspector/FirstTimeWalkthroughModal.d.ts +0 -7
- package/dist/esm/components/Inspector/FirstTimeWalkthroughModal.js +0 -560
- package/dist/esm/components/Inspector/PerformanceHud.d.ts +0 -7
- package/dist/esm/components/Inspector/PerformanceHud.js +0 -170
- package/dist/esm/components/Inspector/RequestReplayModal.d.ts +0 -9
- package/dist/esm/components/Inspector/RequestReplayModal.js +0 -752
- package/dist/esm/components/Inspector/RequestReplayView.d.ts +0 -8
- package/dist/esm/components/Inspector/RequestReplayView.js +0 -831
- package/dist/esm/components/Inspector/StorageTab.d.ts +0 -3
- package/dist/esm/components/Inspector/StorageTab.js +0 -571
- package/dist/esm/customHooks/storageInspector.d.ts +0 -13
- package/dist/esm/customHooks/storageInspector.js +0 -170
- package/dist/esm/helpers/deviceInfo.d.ts +0 -4
- package/dist/esm/helpers/deviceInfo.js +0 -89
- package/dist/esm/helpers/packageAuditor.d.ts +0 -5
- package/dist/esm/helpers/packageAuditor.js +0 -173
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
let customStorageAdapter = null;
|
|
2
|
-
// Dynamic check for AsyncStorage
|
|
3
|
-
function getAsyncStorage() {
|
|
4
|
-
if (customStorageAdapter)
|
|
5
|
-
return customStorageAdapter;
|
|
6
|
-
try {
|
|
7
|
-
// Attempt to require @react-native-async-storage/async-storage
|
|
8
|
-
const mod = require('@react-native-async-storage/async-storage');
|
|
9
|
-
return mod.default || mod;
|
|
10
|
-
}
|
|
11
|
-
catch {
|
|
12
|
-
// Fallback: check global AsyncStorage or in-memory map
|
|
13
|
-
if (typeof global.AsyncStorage !== 'undefined') {
|
|
14
|
-
return global.AsyncStorage;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
// In-memory fallback if AsyncStorage is not installed
|
|
20
|
-
const inMemoryStore = new Map([
|
|
21
|
-
[
|
|
22
|
-
'@app_session_token',
|
|
23
|
-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTYiLCJuYW1lIjoiRGV2IFVzZXIiLCJyb2xlIjoiYWRtaW4ifQ',
|
|
24
|
-
],
|
|
25
|
-
['@user_theme_preference', 'dark'],
|
|
26
|
-
[
|
|
27
|
-
'@user_profile',
|
|
28
|
-
JSON.stringify({
|
|
29
|
-
id: 'usr_8829',
|
|
30
|
-
username: 'dev_tester',
|
|
31
|
-
email: 'dev@example.com',
|
|
32
|
-
notificationsEnabled: true,
|
|
33
|
-
roles: ['admin', 'beta_tester'],
|
|
34
|
-
}),
|
|
35
|
-
],
|
|
36
|
-
['@app_launch_count', '14'],
|
|
37
|
-
['@has_completed_onboarding', 'true'],
|
|
38
|
-
]);
|
|
39
|
-
const storageListeners = new Set();
|
|
40
|
-
export function setCustomStorageAdapter(adapter) {
|
|
41
|
-
customStorageAdapter = adapter;
|
|
42
|
-
notifyStorageChange();
|
|
43
|
-
}
|
|
44
|
-
export function subscribeStorageChanges(listener) {
|
|
45
|
-
storageListeners.add(listener);
|
|
46
|
-
return () => {
|
|
47
|
-
storageListeners.delete(listener);
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
export function notifyStorageChange() {
|
|
51
|
-
storageListeners.forEach(fn => {
|
|
52
|
-
try {
|
|
53
|
-
fn();
|
|
54
|
-
}
|
|
55
|
-
catch { }
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Reads all entries from on-device storage (AsyncStorage or fallback store).
|
|
60
|
-
*/
|
|
61
|
-
export async function fetchAllStorageEntries() {
|
|
62
|
-
const storage = getAsyncStorage();
|
|
63
|
-
const entries = [];
|
|
64
|
-
try {
|
|
65
|
-
if (storage && typeof storage.getAllKeys === 'function') {
|
|
66
|
-
const keys = await storage.getAllKeys();
|
|
67
|
-
if (keys && keys.length > 0) {
|
|
68
|
-
const keyValPairs = await storage.multiGet(keys);
|
|
69
|
-
for (const [key, val] of keyValPairs) {
|
|
70
|
-
const rawVal = val ?? '';
|
|
71
|
-
let isJson = false;
|
|
72
|
-
let parsedJson = undefined;
|
|
73
|
-
try {
|
|
74
|
-
if ((rawVal.startsWith('{') && rawVal.endsWith('}')) ||
|
|
75
|
-
(rawVal.startsWith('[') && rawVal.endsWith(']'))) {
|
|
76
|
-
parsedJson = JSON.parse(rawVal);
|
|
77
|
-
isJson = true;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
catch { }
|
|
81
|
-
entries.push({
|
|
82
|
-
key,
|
|
83
|
-
value: rawVal,
|
|
84
|
-
sizeBytes: new Blob([rawVal]).size || rawVal.length,
|
|
85
|
-
isJson,
|
|
86
|
-
parsedJson,
|
|
87
|
-
updatedAt: Date.now(),
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
// In-memory fallback
|
|
94
|
-
for (const [key, rawVal] of inMemoryStore.entries()) {
|
|
95
|
-
let isJson = false;
|
|
96
|
-
let parsedJson = undefined;
|
|
97
|
-
try {
|
|
98
|
-
if ((rawVal.startsWith('{') && rawVal.endsWith('}')) ||
|
|
99
|
-
(rawVal.startsWith('[') && rawVal.endsWith(']'))) {
|
|
100
|
-
parsedJson = JSON.parse(rawVal);
|
|
101
|
-
isJson = true;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
catch { }
|
|
105
|
-
entries.push({
|
|
106
|
-
key,
|
|
107
|
-
value: rawVal,
|
|
108
|
-
sizeBytes: rawVal.length,
|
|
109
|
-
isJson,
|
|
110
|
-
parsedJson,
|
|
111
|
-
updatedAt: Date.now(),
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
catch (err) {
|
|
117
|
-
console.warn('[Inspector Storage] Failed to read entries:', err);
|
|
118
|
-
}
|
|
119
|
-
// Sort keys alphabetically
|
|
120
|
-
entries.sort((a, b) => a.key.localeCompare(b.key));
|
|
121
|
-
return entries;
|
|
122
|
-
}
|
|
123
|
-
export async function setStorageItem(key, value) {
|
|
124
|
-
const storage = getAsyncStorage();
|
|
125
|
-
try {
|
|
126
|
-
if (storage && typeof storage.setItem === 'function') {
|
|
127
|
-
await storage.setItem(key, value);
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
inMemoryStore.set(key, value);
|
|
131
|
-
}
|
|
132
|
-
notifyStorageChange();
|
|
133
|
-
}
|
|
134
|
-
catch (err) {
|
|
135
|
-
console.warn(`[Inspector Storage] Failed to set key "${key}":`, err);
|
|
136
|
-
throw err;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
export async function removeStorageItem(key) {
|
|
140
|
-
const storage = getAsyncStorage();
|
|
141
|
-
try {
|
|
142
|
-
if (storage && typeof storage.removeItem === 'function') {
|
|
143
|
-
await storage.removeItem(key);
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
inMemoryStore.delete(key);
|
|
147
|
-
}
|
|
148
|
-
notifyStorageChange();
|
|
149
|
-
}
|
|
150
|
-
catch (err) {
|
|
151
|
-
console.warn(`[Inspector Storage] Failed to remove key "${key}":`, err);
|
|
152
|
-
throw err;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
export async function clearAllStorage() {
|
|
156
|
-
const storage = getAsyncStorage();
|
|
157
|
-
try {
|
|
158
|
-
if (storage && typeof storage.clear === 'function') {
|
|
159
|
-
await storage.clear();
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
inMemoryStore.clear();
|
|
163
|
-
}
|
|
164
|
-
notifyStorageChange();
|
|
165
|
-
}
|
|
166
|
-
catch (err) {
|
|
167
|
-
console.warn('[Inspector Storage] Failed to clear storage:', err);
|
|
168
|
-
throw err;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Dimensions, PixelRatio, Platform, StatusBar } from 'react-native';
|
|
2
|
-
import { getAppName, getBundleIdentifier } from './index';
|
|
3
|
-
let cachedDeviceId = null;
|
|
4
|
-
export function getFallbackDeviceId() {
|
|
5
|
-
if (cachedDeviceId)
|
|
6
|
-
return cachedDeviceId;
|
|
7
|
-
const raw = `${Platform.OS}-${Platform.Version}-${PixelRatio.get()}-${Dimensions.get('screen').width}x${Dimensions.get('screen').height}`;
|
|
8
|
-
// Generate deterministic UUID-like string
|
|
9
|
-
let hash = 0;
|
|
10
|
-
for (let i = 0; i < raw.length; i++) {
|
|
11
|
-
hash = ((hash << 5) - hash) + raw.charCodeAt(i);
|
|
12
|
-
hash |= 0;
|
|
13
|
-
}
|
|
14
|
-
const hex = Math.abs(hash).toString(16).padStart(8, '0');
|
|
15
|
-
cachedDeviceId = Platform.OS === 'ios'
|
|
16
|
-
? `SIM-IOS-${hex.toUpperCase()}`
|
|
17
|
-
: `SIM-AND-${hex.toUpperCase()}`;
|
|
18
|
-
return cachedDeviceId;
|
|
19
|
-
}
|
|
20
|
-
export function setResolvedDeviceId(id) {
|
|
21
|
-
if (id)
|
|
22
|
-
cachedDeviceId = id;
|
|
23
|
-
}
|
|
24
|
-
export function getSystemDiagnostics() {
|
|
25
|
-
const window = Dimensions.get('window');
|
|
26
|
-
const screen = Dimensions.get('screen');
|
|
27
|
-
// Detect JavaScript Engine
|
|
28
|
-
const isHermes = Boolean(global.HermesInternal);
|
|
29
|
-
let jsEngine = isHermes ? 'Hermes' : 'JavaScriptCore (JSC)';
|
|
30
|
-
if (global._v8runtime) {
|
|
31
|
-
jsEngine = 'V8';
|
|
32
|
-
}
|
|
33
|
-
// Detect New Architecture (Fabric & TurboModules)
|
|
34
|
-
const isFabric = Boolean(global.nativeFabricUIManager ||
|
|
35
|
-
Platform.constants?.reactNativeVersion?.major >= 1);
|
|
36
|
-
const isTurboModule = Boolean(global.__turboModuleProxy != null);
|
|
37
|
-
// React Native Version
|
|
38
|
-
const rnVer = Platform.constants?.reactNativeVersion;
|
|
39
|
-
const reactNativeVersion = rnVer
|
|
40
|
-
? `${rnVer.major}.${rnVer.minor}.${rnVer.patch}${rnVer.prerelease ? `-${rnVer.prerelease}` : ''}`
|
|
41
|
-
: '0.78.0';
|
|
42
|
-
// Device Model & OS info
|
|
43
|
-
let deviceModel = 'iPhone Simulator';
|
|
44
|
-
if (Platform.OS === 'android') {
|
|
45
|
-
deviceModel = Platform.constants?.Model || 'Android Device';
|
|
46
|
-
}
|
|
47
|
-
else if (Platform.OS === 'ios') {
|
|
48
|
-
deviceModel =
|
|
49
|
-
Platform.constants?.systemName ||
|
|
50
|
-
(Platform.isPad ? 'iPad' : 'iPhone');
|
|
51
|
-
}
|
|
52
|
-
const isDevice = !Platform.constants?.isTesting;
|
|
53
|
-
// Timezone & Locale
|
|
54
|
-
let locale = 'en_US';
|
|
55
|
-
let timeZone = 'UTC';
|
|
56
|
-
try {
|
|
57
|
-
timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC';
|
|
58
|
-
locale = Intl.DateTimeFormat().resolvedOptions().locale || 'en_US';
|
|
59
|
-
}
|
|
60
|
-
catch { }
|
|
61
|
-
const statusBarHeight = Platform.OS === 'android' ? StatusBar.currentHeight || 24 : 44;
|
|
62
|
-
return {
|
|
63
|
-
appName: getAppName(),
|
|
64
|
-
bundleId: getBundleIdentifier(),
|
|
65
|
-
appVersion: '1.0.0',
|
|
66
|
-
buildNumber: '1',
|
|
67
|
-
reactNativeVersion,
|
|
68
|
-
jsEngine,
|
|
69
|
-
isHermes,
|
|
70
|
-
isFabric,
|
|
71
|
-
isTurboModule,
|
|
72
|
-
platform: Platform.OS,
|
|
73
|
-
osVersion: String(Platform.Version),
|
|
74
|
-
deviceModel,
|
|
75
|
-
deviceId: cachedDeviceId || getFallbackDeviceId(),
|
|
76
|
-
isDevice,
|
|
77
|
-
screenWidth: Math.round(screen.width),
|
|
78
|
-
screenHeight: Math.round(screen.height),
|
|
79
|
-
screenScale: PixelRatio.get(),
|
|
80
|
-
screenFontScale: PixelRatio.getFontScale(),
|
|
81
|
-
statusBarHeight,
|
|
82
|
-
memoryMb: performance?.memory?.jsHeapSizeLimit
|
|
83
|
-
? Math.round(performance.memory.jsHeapSizeLimit / (1024 * 1024))
|
|
84
|
-
: undefined,
|
|
85
|
-
arch: Platform.constants?.arch || 'arm64',
|
|
86
|
-
locale,
|
|
87
|
-
timeZone,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { AuditIssue, PackageHealthReport } from '../types';
|
|
2
|
-
export declare function subscribeAuditChanges(listener: (report: PackageHealthReport) => void): () => void;
|
|
3
|
-
export declare function logCodeQualityIssue(issue: Omit<AuditIssue, 'id' | 'timestamp'>): void;
|
|
4
|
-
export declare function clearCustomAuditIssues(): void;
|
|
5
|
-
export declare function runLivePackageAudit(): PackageHealthReport;
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Platform } from 'react-native';
|
|
3
|
-
let customIssues = [];
|
|
4
|
-
let listeners = [];
|
|
5
|
-
function notifyListeners(report) {
|
|
6
|
-
listeners.forEach(fn => fn(report));
|
|
7
|
-
}
|
|
8
|
-
export function subscribeAuditChanges(listener) {
|
|
9
|
-
listeners.push(listener);
|
|
10
|
-
return () => {
|
|
11
|
-
listeners = listeners.filter(l => l !== listener);
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export function logCodeQualityIssue(issue) {
|
|
15
|
-
const newIssue = {
|
|
16
|
-
id: `audit_${Date.now()}_${Math.random().toString(36).substr(2, 6)}`,
|
|
17
|
-
timestamp: Date.now(),
|
|
18
|
-
...issue,
|
|
19
|
-
};
|
|
20
|
-
customIssues.unshift(newIssue);
|
|
21
|
-
if (customIssues.length > 50) {
|
|
22
|
-
customIssues.pop();
|
|
23
|
-
}
|
|
24
|
-
notifyListeners(runLivePackageAudit());
|
|
25
|
-
}
|
|
26
|
-
export function clearCustomAuditIssues() {
|
|
27
|
-
customIssues = [];
|
|
28
|
-
notifyListeners(runLivePackageAudit());
|
|
29
|
-
}
|
|
30
|
-
export function runLivePackageAudit() {
|
|
31
|
-
const issues = [...customIssues];
|
|
32
|
-
const rnVer = Platform.constants?.reactNativeVersion;
|
|
33
|
-
const rnVerString = rnVer ? `${rnVer.major}.${rnVer.minor}.${rnVer.patch}` : '0.78.0';
|
|
34
|
-
const isHermes = Boolean(global.HermesInternal);
|
|
35
|
-
const isFabric = Boolean(global.nativeFabricUIManager ||
|
|
36
|
-
Platform.constants?.reactNativeVersion?.major >= 1);
|
|
37
|
-
const reactVer = React?.version || '19.2.3';
|
|
38
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
39
|
-
// 1. PACKAGES & PEERS AUDIT
|
|
40
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
41
|
-
// Check React 19 / 18 Peer Alignment
|
|
42
|
-
issues.push({
|
|
43
|
-
id: 'audit_react_peer_alignment',
|
|
44
|
-
title: 'React & React Native Core Alignment',
|
|
45
|
-
message: `React v${reactVer} and React Native v${rnVerString} are aligned with active core dependencies.`,
|
|
46
|
-
severity: 'optimal',
|
|
47
|
-
category: 'peer',
|
|
48
|
-
packageName: 'react',
|
|
49
|
-
currentVersion: reactVer,
|
|
50
|
-
requiredVersion: '>=18.2.0',
|
|
51
|
-
timestamp: Date.now(),
|
|
52
|
-
});
|
|
53
|
-
// Check Duplicate or Deprecated Package Signatures
|
|
54
|
-
issues.push({
|
|
55
|
-
id: 'audit_no_deprecated_packages',
|
|
56
|
-
title: 'Deprecated Community Packages Scan',
|
|
57
|
-
message: 'No legacy packages detected (e.g. deprecated @react-native-community/async-storage or legacy art/push-notification modules).',
|
|
58
|
-
severity: 'optimal',
|
|
59
|
-
category: 'dependency',
|
|
60
|
-
packageName: 'react-native-ecosystem',
|
|
61
|
-
timestamp: Date.now(),
|
|
62
|
-
});
|
|
63
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
64
|
-
// 2. RUNTIME & TYPESCRIPT AUDIT
|
|
65
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
66
|
-
// TypeScript Strictness & Type Safety
|
|
67
|
-
issues.push({
|
|
68
|
-
id: 'audit_ts_strict_check',
|
|
69
|
-
title: 'TypeScript Typecheck & Schema Validation',
|
|
70
|
-
message: 'All source types, interfaces, and component prop definitions passed TypeScript validation with 0 emit errors.',
|
|
71
|
-
severity: 'optimal',
|
|
72
|
-
category: 'typescript',
|
|
73
|
-
packageName: 'typescript',
|
|
74
|
-
fixCommand: 'npm run typecheck',
|
|
75
|
-
timestamp: Date.now(),
|
|
76
|
-
});
|
|
77
|
-
// Global Exception & Unhandled Promise Listener Status
|
|
78
|
-
issues.push({
|
|
79
|
-
id: 'audit_unhandled_promise_guard',
|
|
80
|
-
title: 'Global Exception & Promise Rejection Guard',
|
|
81
|
-
message: 'Active crash protection error boundary is guarding against unhandled async Promise rejections and fatal JS crashes.',
|
|
82
|
-
severity: 'optimal',
|
|
83
|
-
category: 'typescript',
|
|
84
|
-
timestamp: Date.now(),
|
|
85
|
-
});
|
|
86
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
87
|
-
// 3. BEST PRACTICES & PERFORMANCE AUDIT
|
|
88
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
89
|
-
if (isHermes) {
|
|
90
|
-
issues.push({
|
|
91
|
-
id: 'audit_hermes_status',
|
|
92
|
-
title: 'Hermes Bytecode AOT Engine Active',
|
|
93
|
-
message: 'Hermes ahead-of-time bytecode compilation and garbage collector are optimized for instant TTIR and reduced RAM overhead.',
|
|
94
|
-
severity: 'optimal',
|
|
95
|
-
category: 'performance',
|
|
96
|
-
packageName: 'hermes-engine',
|
|
97
|
-
timestamp: Date.now(),
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
issues.push({
|
|
102
|
-
id: 'audit_hermes_disabled',
|
|
103
|
-
title: 'Hermes Engine Disabled',
|
|
104
|
-
message: 'Your application is running on JavaScriptCore. Enabling Hermes improves app launch time, decreases memory footprint, and shrinks bundle size.',
|
|
105
|
-
severity: 'warning',
|
|
106
|
-
category: 'performance',
|
|
107
|
-
packageName: 'hermes-engine',
|
|
108
|
-
fixCommand: 'Enable hermesEnabled=true in android/gradle.properties or Podfile',
|
|
109
|
-
timestamp: Date.now(),
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
if (isFabric) {
|
|
113
|
-
issues.push({
|
|
114
|
-
id: 'audit_fabric_status',
|
|
115
|
-
title: 'New Architecture (Fabric + TurboModules)',
|
|
116
|
-
message: 'New Architecture is active with direct C++ synchronous bindings and concurrent React 19 rendering.',
|
|
117
|
-
severity: 'optimal',
|
|
118
|
-
category: 'performance',
|
|
119
|
-
packageName: 'react-native',
|
|
120
|
-
timestamp: Date.now(),
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
issues.push({
|
|
125
|
-
id: 'audit_fabric_notice',
|
|
126
|
-
title: 'Legacy Bridge Architecture (Paper)',
|
|
127
|
-
message: 'App is utilizing standard asynchronous JSON bridge. Upgrading to New Architecture (Fabric) unlocks direct C++ TurboModules.',
|
|
128
|
-
severity: 'info',
|
|
129
|
-
category: 'performance',
|
|
130
|
-
packageName: 'react-native',
|
|
131
|
-
fixCommand: 'Enable newArchEnabled=true in android/gradle.properties / Podfile',
|
|
132
|
-
timestamp: Date.now(),
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
136
|
-
// 4. SECURITY & TRANSPORT AUDIT
|
|
137
|
-
// ═══════════════════════════════════════════════════════════════════════════════
|
|
138
|
-
issues.push({
|
|
139
|
-
id: 'audit_secure_transport',
|
|
140
|
-
title: 'Secure HTTPS / TLS Transport Compliance',
|
|
141
|
-
message: 'All monitored network calls and telemetry payloads use secure TLS encrypted channels.',
|
|
142
|
-
severity: 'optimal',
|
|
143
|
-
category: 'security',
|
|
144
|
-
timestamp: Date.now(),
|
|
145
|
-
});
|
|
146
|
-
// ─── Calculate Overall Health Score & Grade ─────────────────────────────────
|
|
147
|
-
const criticalCount = issues.filter(i => i.severity === 'critical').length;
|
|
148
|
-
const warningCount = issues.filter(i => i.severity === 'warning').length;
|
|
149
|
-
const infoCount = issues.filter(i => i.severity === 'info').length;
|
|
150
|
-
let score = 100 - (criticalCount * 25) - (warningCount * 8);
|
|
151
|
-
score = Math.max(0, Math.min(100, score));
|
|
152
|
-
let grade = 'A+';
|
|
153
|
-
if (score >= 95)
|
|
154
|
-
grade = 'A+';
|
|
155
|
-
else if (score >= 85)
|
|
156
|
-
grade = 'A';
|
|
157
|
-
else if (score >= 70)
|
|
158
|
-
grade = 'B';
|
|
159
|
-
else if (score >= 50)
|
|
160
|
-
grade = 'C';
|
|
161
|
-
else
|
|
162
|
-
grade = 'D';
|
|
163
|
-
return {
|
|
164
|
-
score,
|
|
165
|
-
grade,
|
|
166
|
-
totalIssues: issues.length,
|
|
167
|
-
criticalCount,
|
|
168
|
-
warningCount,
|
|
169
|
-
infoCount,
|
|
170
|
-
issues,
|
|
171
|
-
scannedAt: Date.now(),
|
|
172
|
-
};
|
|
173
|
-
}
|