WIP: Refactor and polyfill updates
- Add crypto polyfill for Expo - Update daemon client and websocket server - Simplify codex agent tests
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
// Polyfill crypto.randomUUID for React Native before any other imports
|
||||
import { polyfillCrypto } from "./src/polyfills/crypto";
|
||||
polyfillCrypto();
|
||||
|
||||
// Configure Unistyles before Expo Router pulls in any components using StyleSheet.
|
||||
import "./src/styles/unistyles";
|
||||
import "expo-router/entry";
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
"expo-build-properties": "^1.0.9",
|
||||
"expo-clipboard": "~8.0.7",
|
||||
"expo-constants": "~18.0.9",
|
||||
"expo-crypto": "^15.0.8",
|
||||
"expo-dev-client": "^6.0.15",
|
||||
"expo-file-system": "~19.0.17",
|
||||
"expo-font": "~14.0.9",
|
||||
|
||||
@@ -103,11 +103,14 @@ const userMessageStylesheet = StyleSheet.create((theme) => ({
|
||||
borderTopRightRadius: theme.borderRadius.sm,
|
||||
paddingHorizontal: theme.spacing[4],
|
||||
paddingVertical: theme.spacing[4],
|
||||
minWidth: 0,
|
||||
flexShrink: 1,
|
||||
},
|
||||
text: {
|
||||
color: theme.colors.foreground,
|
||||
fontSize: theme.fontSize.base,
|
||||
lineHeight: 22,
|
||||
overflowWrap: "anywhere",
|
||||
},
|
||||
bubblePressed: {
|
||||
opacity: 0.85,
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import * as ExpoCrypto from "expo-crypto";
|
||||
|
||||
declare global {
|
||||
interface Crypto {
|
||||
randomUUID(): `${string}-${string}-${string}-${string}-${string}`;
|
||||
}
|
||||
}
|
||||
|
||||
export function polyfillCrypto(): void {
|
||||
if (typeof globalThis.crypto === "undefined") {
|
||||
(globalThis as any).crypto = {};
|
||||
}
|
||||
|
||||
if (typeof globalThis.crypto.randomUUID !== "function") {
|
||||
globalThis.crypto.randomUUID = () =>
|
||||
ExpoCrypto.randomUUID() as `${string}-${string}-${string}-${string}-${string}`;
|
||||
}
|
||||
|
||||
if (typeof globalThis.crypto.getRandomValues !== "function") {
|
||||
globalThis.crypto.getRandomValues = <T extends ArrayBufferView>(array: T): T => {
|
||||
return ExpoCrypto.getRandomValues(array as any) as T;
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user