@fressh/react-native-terminal 0.1.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.
Files changed (73) hide show
  1. package/README.md +182 -0
  2. package/ReactNativeTerminal.podspec +82 -0
  3. package/android/CMakeLists.txt +76 -0
  4. package/android/build.gradle +121 -0
  5. package/android/fix-prefab.gradle +51 -0
  6. package/android/src/main/assets/fonts/DejaVuSansMono.ttf +0 -0
  7. package/android/src/main/cpp/cpp-adapter.cpp +180 -0
  8. package/android/src/main/java/com/margelo/nitro/fressh/HybridTerminal.kt +146 -0
  9. package/android/src/main/java/com/margelo/nitro/fressh/ReactNativeTerminalModule.kt +43 -0
  10. package/android/src/main/java/com/margelo/nitro/fressh/ReactNativeTerminalPackage.kt +32 -0
  11. package/android/src/main/jniLibs/arm64-v8a/libshim_uniffi.so +0 -0
  12. package/android/src/main/jniLibs/x86_64/libshim_uniffi.so +0 -0
  13. package/babel.config.js +12 -0
  14. package/cpp/README.md +14 -0
  15. package/cpp/generated/shim_uniffi.cpp +4246 -0
  16. package/cpp/generated/shim_uniffi.hpp +364 -0
  17. package/ios/FresshTerminalRenderABI.h +46 -0
  18. package/ios/HybridTerminal.swift +144 -0
  19. package/ios/ReactNativeTerminalUniffi.mm +77 -0
  20. package/ios/fetch-angle.sh +39 -0
  21. package/ios/fonts/DejaVuSansMono.ttf +0 -0
  22. package/libEGL.xcframework/Info.plist +44 -0
  23. package/libEGL.xcframework/ios-arm64/libEGL.framework/Info.plist +0 -0
  24. package/libEGL.xcframework/ios-arm64/libEGL.framework/libEGL +0 -0
  25. package/libEGL.xcframework/ios-arm64_x86_64-simulator/libEGL.framework/Info.plist +0 -0
  26. package/libEGL.xcframework/ios-arm64_x86_64-simulator/libEGL.framework/libEGL +0 -0
  27. package/libGLESv2.xcframework/Info.plist +44 -0
  28. package/libGLESv2.xcframework/ios-arm64/libGLESv2.framework/Info.plist +0 -0
  29. package/libGLESv2.xcframework/ios-arm64/libGLESv2.framework/libGLESv2 +0 -0
  30. package/libGLESv2.xcframework/ios-arm64_x86_64-simulator/libGLESv2.framework/Info.plist +0 -0
  31. package/libGLESv2.xcframework/ios-arm64_x86_64-simulator/libGLESv2.framework/libGLESv2 +0 -0
  32. package/nitro/Terminal.nitro.ts +40 -0
  33. package/nitrogen/generated/.gitattributes +1 -0
  34. package/nitrogen/generated/android/ReactNativeTerminal+autolinking.cmake +83 -0
  35. package/nitrogen/generated/android/ReactNativeTerminal+autolinking.gradle +27 -0
  36. package/nitrogen/generated/android/ReactNativeTerminalOnLoad.cpp +56 -0
  37. package/nitrogen/generated/android/ReactNativeTerminalOnLoad.hpp +34 -0
  38. package/nitrogen/generated/android/c++/JHybridTerminalSpec.cpp +76 -0
  39. package/nitrogen/generated/android/c++/JHybridTerminalSpec.hpp +68 -0
  40. package/nitrogen/generated/android/c++/views/JHybridTerminalStateUpdater.cpp +64 -0
  41. package/nitrogen/generated/android/c++/views/JHybridTerminalStateUpdater.hpp +49 -0
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/fressh/HybridTerminalSpec.kt +69 -0
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/fressh/ReactNativeTerminalOnLoad.kt +35 -0
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/fressh/views/HybridTerminalManager.kt +80 -0
  45. package/nitrogen/generated/android/kotlin/com/margelo/nitro/fressh/views/HybridTerminalStateUpdater.kt +23 -0
  46. package/nitrogen/generated/ios/ReactNativeTerminal+autolinking.rb +62 -0
  47. package/nitrogen/generated/ios/ReactNativeTerminal-Swift-Cxx-Bridge.cpp +33 -0
  48. package/nitrogen/generated/ios/ReactNativeTerminal-Swift-Cxx-Bridge.hpp +57 -0
  49. package/nitrogen/generated/ios/ReactNativeTerminal-Swift-Cxx-Umbrella.hpp +43 -0
  50. package/nitrogen/generated/ios/ReactNativeTerminalAutolinking.mm +33 -0
  51. package/nitrogen/generated/ios/ReactNativeTerminalAutolinking.swift +26 -0
  52. package/nitrogen/generated/ios/c++/HybridTerminalSpecSwift.cpp +11 -0
  53. package/nitrogen/generated/ios/c++/HybridTerminalSpecSwift.hpp +96 -0
  54. package/nitrogen/generated/ios/c++/views/HybridTerminalComponent.mm +132 -0
  55. package/nitrogen/generated/ios/swift/HybridTerminalSpec.swift +57 -0
  56. package/nitrogen/generated/ios/swift/HybridTerminalSpec_cxx.swift +204 -0
  57. package/nitrogen/generated/shared/c++/HybridTerminalSpec.cpp +26 -0
  58. package/nitrogen/generated/shared/c++/HybridTerminalSpec.hpp +68 -0
  59. package/nitrogen/generated/shared/c++/views/HybridTerminalComponent.cpp +110 -0
  60. package/nitrogen/generated/shared/c++/views/HybridTerminalComponent.hpp +113 -0
  61. package/nitrogen/generated/shared/json/TerminalConfig.json +12 -0
  62. package/package.json +97 -0
  63. package/react-native.config.js +12 -0
  64. package/shim_uniffi.xcframework/Info.plist +44 -0
  65. package/shim_uniffi.xcframework/ios-arm64/libshim_uniffi.a +0 -0
  66. package/shim_uniffi.xcframework/ios-arm64_x86_64-simulator/libshim_uniffi.a +0 -0
  67. package/src/Terminal.tsx +135 -0
  68. package/src/generated/shim_uniffi-ffi.ts +320 -0
  69. package/src/generated/shim_uniffi.ts +2527 -0
  70. package/src/index.ts +52 -0
  71. package/src/ssh.ts +239 -0
  72. package/tsconfig.json +31 -0
  73. package/ubrn.config.yaml +24 -0
@@ -0,0 +1,364 @@
1
+ // This file was autogenerated by some hot garbage in the
2
+ // `uniffi-bindgen-react-native` crate. Trust me, you don't want to mess with
3
+ // it!
4
+ #pragma once
5
+ #include "UniffiCallInvoker.h"
6
+ #include <ReactCommon/CallInvoker.h>
7
+ #include <iostream>
8
+ #include <jsi/jsi.h>
9
+ #include <map>
10
+ #include <memory>
11
+
12
+ namespace react = facebook::react;
13
+ namespace jsi = facebook::jsi;
14
+
15
+ class NativeShimUniffi : public jsi::HostObject {
16
+ private:
17
+ // For calling back into JS from Rust.
18
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker;
19
+
20
+ protected:
21
+ std::map<std::string, jsi::Value> props;
22
+ jsi::Value cpp_uniffi_internal_fn_func_ffi__string_to_byte_length(
23
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
24
+ size_t count);
25
+ jsi::Value cpp_uniffi_internal_fn_func_ffi__string_to_buffer(
26
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
27
+ size_t count);
28
+ jsi::Value cpp_uniffi_internal_fn_func_ffi__string_from_buffer(
29
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
30
+ size_t count);
31
+ jsi::Value cpp_uniffi_internal_fn_func_ffi__read_string_from_buffer(
32
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
33
+ size_t count);
34
+ jsi::Value cpp_uniffi_shim_uniffi_fn_clone_fressheventlistener(
35
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
36
+ size_t count);
37
+ jsi::Value cpp_uniffi_shim_uniffi_fn_free_fressheventlistener(
38
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
39
+ size_t count);
40
+ jsi::Value cpp_uniffi_shim_uniffi_fn_init_callback_vtable_fressheventlistener(
41
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
42
+ size_t count);
43
+ jsi::Value cpp_uniffi_shim_uniffi_fn_method_fressheventlistener_on_event(
44
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
45
+ size_t count);
46
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_close_preview(
47
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
48
+ size_t count);
49
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_close_shell(
50
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
51
+ size_t count);
52
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_connect(jsi::Runtime &rt,
53
+ const jsi::Value &thisVal,
54
+ const jsi::Value *args,
55
+ size_t count);
56
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_create_preview(
57
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
58
+ size_t count);
59
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_disconnect(
60
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
61
+ size_t count);
62
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_generate_key_pair(
63
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
64
+ size_t count);
65
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_resize(jsi::Runtime &rt,
66
+ const jsi::Value &thisVal,
67
+ const jsi::Value *args,
68
+ size_t count);
69
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_respond_to_host_key(
70
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
71
+ size_t count);
72
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_run_command(
73
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
74
+ size_t count);
75
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_scroll(jsi::Runtime &rt,
76
+ const jsi::Value &thisVal,
77
+ const jsi::Value *args,
78
+ size_t count);
79
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_selection_clear(
80
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
81
+ size_t count);
82
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_selection_start(
83
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
84
+ size_t count);
85
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_selection_text(
86
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
87
+ size_t count);
88
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_selection_update(
89
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
90
+ size_t count);
91
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_send_data(jsi::Runtime &rt,
92
+ const jsi::Value &thisVal,
93
+ const jsi::Value *args,
94
+ size_t count);
95
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_set_event_listener(
96
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
97
+ size_t count);
98
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_start_shell(
99
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
100
+ size_t count);
101
+ jsi::Value cpp_uniffi_shim_uniffi_fn_func_validate_private_key(
102
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
103
+ size_t count);
104
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_poll_u8(jsi::Runtime &rt,
105
+ const jsi::Value &thisVal,
106
+ const jsi::Value *args,
107
+ size_t count);
108
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_cancel_u8(
109
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
110
+ size_t count);
111
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_free_u8(jsi::Runtime &rt,
112
+ const jsi::Value &thisVal,
113
+ const jsi::Value *args,
114
+ size_t count);
115
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_complete_u8(
116
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
117
+ size_t count);
118
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_poll_i8(jsi::Runtime &rt,
119
+ const jsi::Value &thisVal,
120
+ const jsi::Value *args,
121
+ size_t count);
122
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_cancel_i8(
123
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
124
+ size_t count);
125
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_free_i8(jsi::Runtime &rt,
126
+ const jsi::Value &thisVal,
127
+ const jsi::Value *args,
128
+ size_t count);
129
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_complete_i8(
130
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
131
+ size_t count);
132
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_poll_u16(jsi::Runtime &rt,
133
+ const jsi::Value &thisVal,
134
+ const jsi::Value *args,
135
+ size_t count);
136
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_cancel_u16(
137
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
138
+ size_t count);
139
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_free_u16(jsi::Runtime &rt,
140
+ const jsi::Value &thisVal,
141
+ const jsi::Value *args,
142
+ size_t count);
143
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_complete_u16(
144
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
145
+ size_t count);
146
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_poll_i16(jsi::Runtime &rt,
147
+ const jsi::Value &thisVal,
148
+ const jsi::Value *args,
149
+ size_t count);
150
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_cancel_i16(
151
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
152
+ size_t count);
153
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_free_i16(jsi::Runtime &rt,
154
+ const jsi::Value &thisVal,
155
+ const jsi::Value *args,
156
+ size_t count);
157
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_complete_i16(
158
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
159
+ size_t count);
160
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_poll_u32(jsi::Runtime &rt,
161
+ const jsi::Value &thisVal,
162
+ const jsi::Value *args,
163
+ size_t count);
164
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_cancel_u32(
165
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
166
+ size_t count);
167
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_free_u32(jsi::Runtime &rt,
168
+ const jsi::Value &thisVal,
169
+ const jsi::Value *args,
170
+ size_t count);
171
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_complete_u32(
172
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
173
+ size_t count);
174
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_poll_i32(jsi::Runtime &rt,
175
+ const jsi::Value &thisVal,
176
+ const jsi::Value *args,
177
+ size_t count);
178
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_cancel_i32(
179
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
180
+ size_t count);
181
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_free_i32(jsi::Runtime &rt,
182
+ const jsi::Value &thisVal,
183
+ const jsi::Value *args,
184
+ size_t count);
185
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_complete_i32(
186
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
187
+ size_t count);
188
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_poll_u64(jsi::Runtime &rt,
189
+ const jsi::Value &thisVal,
190
+ const jsi::Value *args,
191
+ size_t count);
192
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_cancel_u64(
193
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
194
+ size_t count);
195
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_free_u64(jsi::Runtime &rt,
196
+ const jsi::Value &thisVal,
197
+ const jsi::Value *args,
198
+ size_t count);
199
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_complete_u64(
200
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
201
+ size_t count);
202
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_poll_i64(jsi::Runtime &rt,
203
+ const jsi::Value &thisVal,
204
+ const jsi::Value *args,
205
+ size_t count);
206
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_cancel_i64(
207
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
208
+ size_t count);
209
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_free_i64(jsi::Runtime &rt,
210
+ const jsi::Value &thisVal,
211
+ const jsi::Value *args,
212
+ size_t count);
213
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_complete_i64(
214
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
215
+ size_t count);
216
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_poll_f32(jsi::Runtime &rt,
217
+ const jsi::Value &thisVal,
218
+ const jsi::Value *args,
219
+ size_t count);
220
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_cancel_f32(
221
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
222
+ size_t count);
223
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_free_f32(jsi::Runtime &rt,
224
+ const jsi::Value &thisVal,
225
+ const jsi::Value *args,
226
+ size_t count);
227
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_complete_f32(
228
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
229
+ size_t count);
230
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_poll_f64(jsi::Runtime &rt,
231
+ const jsi::Value &thisVal,
232
+ const jsi::Value *args,
233
+ size_t count);
234
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_cancel_f64(
235
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
236
+ size_t count);
237
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_free_f64(jsi::Runtime &rt,
238
+ const jsi::Value &thisVal,
239
+ const jsi::Value *args,
240
+ size_t count);
241
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_complete_f64(
242
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
243
+ size_t count);
244
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_poll_rust_buffer(
245
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
246
+ size_t count);
247
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_cancel_rust_buffer(
248
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
249
+ size_t count);
250
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_free_rust_buffer(
251
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
252
+ size_t count);
253
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_complete_rust_buffer(
254
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
255
+ size_t count);
256
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_poll_void(
257
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
258
+ size_t count);
259
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_cancel_void(
260
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
261
+ size_t count);
262
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_free_void(
263
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
264
+ size_t count);
265
+ jsi::Value cpp_ffi_shim_uniffi_rust_future_complete_void(
266
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
267
+ size_t count);
268
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_close_preview(
269
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
270
+ size_t count);
271
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_close_shell(
272
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
273
+ size_t count);
274
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_connect(
275
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
276
+ size_t count);
277
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_create_preview(
278
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
279
+ size_t count);
280
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_disconnect(
281
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
282
+ size_t count);
283
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_generate_key_pair(
284
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
285
+ size_t count);
286
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_resize(
287
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
288
+ size_t count);
289
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_respond_to_host_key(
290
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
291
+ size_t count);
292
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_run_command(
293
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
294
+ size_t count);
295
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_scroll(
296
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
297
+ size_t count);
298
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_selection_clear(
299
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
300
+ size_t count);
301
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_selection_start(
302
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
303
+ size_t count);
304
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_selection_text(
305
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
306
+ size_t count);
307
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_selection_update(
308
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
309
+ size_t count);
310
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_send_data(
311
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
312
+ size_t count);
313
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_set_event_listener(
314
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
315
+ size_t count);
316
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_start_shell(
317
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
318
+ size_t count);
319
+ jsi::Value cpp_uniffi_shim_uniffi_checksum_func_validate_private_key(
320
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
321
+ size_t count);
322
+ jsi::Value
323
+ cpp_uniffi_shim_uniffi_checksum_method_fressheventlistener_on_event(
324
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
325
+ size_t count);
326
+ jsi::Value cpp_ffi_shim_uniffi_uniffi_contract_version(
327
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
328
+ size_t count);
329
+ jsi::Value
330
+ cpp_uniffi_internal_fn_method_fressheventlistener_ffi__bless_pointer(
331
+ jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args,
332
+ size_t count);
333
+
334
+ public:
335
+ NativeShimUniffi(
336
+ jsi::Runtime &rt,
337
+ std::shared_ptr<uniffi_runtime::UniffiCallInvoker> callInvoker);
338
+ virtual ~NativeShimUniffi();
339
+
340
+ /**
341
+ * The entry point into the crate.
342
+ *
343
+ * React Native must call `NativeShimUniffi.registerModule(rt, callInvoker)`
344
+ * before using the Javascript interface.
345
+ */
346
+ static void registerModule(jsi::Runtime &rt,
347
+ std::shared_ptr<react::CallInvoker> callInvoker);
348
+
349
+ /**
350
+ * Some cleanup into the crate goes here.
351
+ *
352
+ * Current implementation is empty, however, this is not guaranteed to always
353
+ * be the case.
354
+ *
355
+ * Clients should call `NativeShimUniffi.unregisterModule(rt)` after final use
356
+ * where possible.
357
+ */
358
+ static void unregisterModule(jsi::Runtime &rt);
359
+
360
+ virtual jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &name);
361
+ virtual void set(jsi::Runtime &rt, const jsi::PropNameID &name,
362
+ const jsi::Value &value);
363
+ virtual std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &rt);
364
+ };
@@ -0,0 +1,46 @@
1
+ // Render-plane C-ABI declarations (the iOS analogue of the `extern "C"` block in
2
+ // Android's cpp-adapter.cpp). Lets HybridTerminal.swift call the Rust render
3
+ // entry points in shim_uniffi.xcframework. Symbols are defined in
4
+ // shim-uniffi/src/render.rs; the staticlib is linked via the podspec.
5
+ //
6
+ // `window` is a `CAMetalLayer*` on iOS (ANGLE→Metal, §5). The handle is opaque.
7
+
8
+ #ifndef FRESSH_TERMINAL_RENDER_ABI_H
9
+ #define FRESSH_TERMINAL_RENDER_ABI_H
10
+
11
+ #include <stddef.h>
12
+ #include <stdint.h>
13
+
14
+ #ifdef __cplusplus
15
+ extern "C" {
16
+ #endif
17
+
18
+ /// Create an EGL/GLES2 (ANGLE→Metal) renderer for `window` (a `CAMetalLayer*`),
19
+ /// optionally bound to `shell_id`. Returns NULL on failure (see the unified log).
20
+ void *fressh_terminal_attach(void *window, const char *font_path,
21
+ const char *config_json, const char *shell_id);
22
+
23
+ /// (Re)bind the view to a shell id (e.g. once `startShell` resolves on the JS side).
24
+ void fressh_terminal_set_shell(void *handle, const char *shell_id);
25
+
26
+ /// Apply a new render config (JSON, physical px) at runtime.
27
+ void fressh_terminal_set_config(void *handle, const char *config_json);
28
+
29
+ /// Draw one frame (the bound shell's `Term`, or a cleared frame). Call per vsync.
30
+ void fressh_terminal_draw(void *handle);
31
+
32
+ /// Re-sync the renderer to the surface's current size (call on layout changes).
33
+ void fressh_terminal_resize(void *handle);
34
+
35
+ /// Send user input (stdin) to the bound shell.
36
+ void fressh_terminal_send_input(void *handle, const uint8_t *data, size_t len);
37
+
38
+ /// Drop the renderer/EGL context. The shell's `Term` stays alive in the registry,
39
+ /// so re-attaching to the same `shellId` resumes instantly (§9).
40
+ void fressh_terminal_destroy(void *handle);
41
+
42
+ #ifdef __cplusplus
43
+ }
44
+ #endif
45
+
46
+ #endif /* FRESSH_TERMINAL_RENDER_ABI_H */
@@ -0,0 +1,144 @@
1
+ import NitroModules
2
+ import QuartzCore
3
+ import UIKit
4
+
5
+ /// CAMetalLayer-backed view that drives the Rust render C-ABI (ANGLE→Metal, §5) —
6
+ /// the iOS analogue of HybridTerminal.kt's `SurfaceView` + `Choreographer` loop.
7
+ ///
8
+ /// On first layout it `fressh_terminal_attach`es its `CAMetalLayer` to ANGLE,
9
+ /// runs a `CADisplayLink` (vsync) loop → `fressh_terminal_draw` (which looks the
10
+ /// shell's durable `Term` up from fressh-core's registry by `shellId` and draws it
11
+ /// — the byte stream never reaches JS), and forwards shellId/config/resize/teardown
12
+ /// to the C-ABI. Changing `shellId` rebinds (instant reattach, full scrollback, §9).
13
+ final class TerminalMetalView: UIView {
14
+ // The view's backing layer IS a CAMetalLayer — what ANGLE renders into via Metal.
15
+ override class var layerClass: AnyClass { CAMetalLayer.self }
16
+ private var metalLayer: CAMetalLayer { layer as! CAMetalLayer }
17
+
18
+ /// Opaque Rust render handle (nil = not attached).
19
+ private var handle: UnsafeMutableRawPointer?
20
+ private var displayLink: CADisplayLink?
21
+
22
+ /// Bundled monospace font file path (no fontconfig on mobile, §6/§8).
23
+ var fontPath: String = ""
24
+
25
+ /// Render config JSON (physical px), assembled by the JS `<Terminal config>` wrapper.
26
+ var configJson: String? {
27
+ didSet {
28
+ guard let handle else { return }
29
+ withOptCString(configJson) { fressh_terminal_set_config(handle, $0) }
30
+ }
31
+ }
32
+
33
+ /// The durable shell to render. Rebinds the live view without a remount.
34
+ var shellId: String? {
35
+ didSet {
36
+ guard let handle else { return }
37
+ withOptCString(shellId) { fressh_terminal_set_shell(handle, $0) }
38
+ }
39
+ }
40
+
41
+ override func didMoveToWindow() {
42
+ super.didMoveToWindow()
43
+ if window == nil { teardown() } else { attachIfNeeded() }
44
+ }
45
+
46
+ override func layoutSubviews() {
47
+ super.layoutSubviews()
48
+ syncDrawableSize()
49
+ // Attach once we have real bounds; afterwards just keep the grid in lockstep
50
+ // with the on-screen size (keyboard open/close), mirroring the Android resize poll.
51
+ if handle != nil {
52
+ fressh_terminal_resize(handle)
53
+ } else {
54
+ attachIfNeeded()
55
+ }
56
+ }
57
+
58
+ /// Keep the Metal drawable in physical px (logical bounds × screen scale).
59
+ private func syncDrawableSize() {
60
+ let scale = window?.screen.scale ?? UIScreen.main.scale
61
+ metalLayer.contentsScale = scale
62
+ let size = CGSize(width: bounds.width * scale, height: bounds.height * scale)
63
+ if size.width > 0, size.height > 0 { metalLayer.drawableSize = size }
64
+ }
65
+
66
+ private func attachIfNeeded() {
67
+ guard handle == nil, window != nil, bounds.width > 0, bounds.height > 0 else { return }
68
+ syncDrawableSize()
69
+ let layerPtr = Unmanaged.passUnretained(metalLayer).toOpaque()
70
+ handle = resolveFontPath().withCString { fp in
71
+ withOptCString(configJson) { cfg in
72
+ withOptCString(shellId) { sid in
73
+ fressh_terminal_attach(layerPtr, fp, cfg, sid)
74
+ }
75
+ }
76
+ }
77
+ if handle != nil { startRenderLoop() }
78
+ }
79
+
80
+ private func startRenderLoop() {
81
+ let link = CADisplayLink(target: self, selector: #selector(onFrame))
82
+ link.add(to: .main, forMode: .common)
83
+ displayLink = link
84
+ }
85
+
86
+ @objc private func onFrame() {
87
+ guard let handle else { return }
88
+ fressh_terminal_draw(handle)
89
+ }
90
+
91
+ /// Drop the renderer/EGL context. The shell's `Term` survives in the registry,
92
+ /// so a later attach to the same `shellId` resumes instantly (§9).
93
+ func teardown() {
94
+ displayLink?.invalidate()
95
+ displayLink = nil
96
+ if let handle {
97
+ fressh_terminal_destroy(handle)
98
+ self.handle = nil
99
+ }
100
+ }
101
+
102
+ /// The native renderer needs a font *file* path. Fall back to the bundled
103
+ /// DejaVu Sans Mono shipped in the podspec resource bundle.
104
+ private func resolveFontPath() -> String {
105
+ if !fontPath.isEmpty { return fontPath }
106
+ let owner = Bundle(for: TerminalMetalView.self)
107
+ if let bundleURL = owner.url(forResource: "FresshTerminalFonts", withExtension: "bundle"),
108
+ let resources = Bundle(url: bundleURL),
109
+ let font = resources.path(forResource: "DejaVuSansMono", ofType: "ttf")
110
+ {
111
+ return font
112
+ }
113
+ return owner.path(forResource: "DejaVuSansMono", ofType: "ttf") ?? ""
114
+ }
115
+
116
+ deinit { teardown() }
117
+ }
118
+
119
+ /// Call `body` with a C string for `s`, or NULL when `s` is nil.
120
+ private func withOptCString<R>(_ s: String?, _ body: (UnsafePointer<CChar>?) -> R) -> R {
121
+ if let s { return s.withCString { body($0) } }
122
+ return body(nil)
123
+ }
124
+
125
+ /// iOS implementation of the `Terminal` Nitro HybridView (the render plane, §10).
126
+ /// Owns the `CAMetalLayer` view and forwards props to it.
127
+ class HybridTerminal: HybridTerminalSpec {
128
+ private let metalView = TerminalMetalView()
129
+ var view: UIView { metalView }
130
+
131
+ var fontPath: String = "" {
132
+ didSet { metalView.fontPath = fontPath }
133
+ }
134
+ var configJson: String? {
135
+ didSet { metalView.configJson = configJson }
136
+ }
137
+ var shellId: String? {
138
+ didSet { metalView.shellId = shellId }
139
+ }
140
+
141
+ func onDropView() {
142
+ metalView.teardown()
143
+ }
144
+ }
@@ -0,0 +1,77 @@
1
+ // Control-plane installer (iOS) — the analogue of Android's
2
+ // ReactNativeTerminalModule.kt + cpp-adapter.cpp `nativeInstallRustCrate` (§5/§8).
3
+ //
4
+ // JS calls `ReactNativeTerminalUniffi.installRustCrate()` once at startup
5
+ // (src/ssh.ts → ensureNativeInstalled). That installs the
6
+ // `globalThis.NativeShimUniffi` host object the ubrn-generated TS bindings call;
7
+ // without it the first uniffi call throws "Cannot read property
8
+ // 'ubrn_uniffi_shim_uniffi_fn_func_*' of undefined".
9
+ //
10
+ // We hand-wire this (rather than `ubrn build`'s generated TurboModule) so the
11
+ // Rust links into the SAME pod/binary as the Nitro render view → ONE copy of
12
+ // fressh-core's registry statics (§8). We call the lower-level
13
+ // `NativeShimUniffi::registerModule` primitive directly, exactly like Android.
14
+ //
15
+ // Mechanism: a non-codegen C++ TurboModule. The install host function receives
16
+ // the `jsi::Runtime&` directly (no fragile bridge-runtime lookup, which is awkward
17
+ // in bridgeless mode) and the CallInvoker from `params.jsInvoker`.
18
+ //
19
+ // CRITICAL: the class MUST conform to `RCTTurboModule`. RCTTurboModuleManager gates
20
+ // the whole getTurboModule: path on `conformsToProtocol:@protocol(RCTTurboModule)`
21
+ // (RCTTurboModuleManager.mm) — without it the module is treated as a legacy interop
22
+ // module, getTurboModule: is never called, and the `methodMap_` methods (incl.
23
+ // installRustCrate) never surface to JS. This app is new-arch only (Nitro mandates
24
+ // it), so no old-arch fallback is needed.
25
+
26
+ #import <Foundation/Foundation.h>
27
+ #import <React/RCTBridgeModule.h>
28
+ #import <ReactCommon/RCTTurboModule.h>
29
+
30
+ #include <memory>
31
+
32
+ #include "shim_uniffi.hpp" // ::NativeShimUniffi::registerModule
33
+
34
+ namespace fressh_terminal_install {
35
+ using namespace facebook;
36
+ using namespace facebook::react;
37
+
38
+ // TurboModule carrying the CallInvoker so the install host function can hand it to
39
+ // registerModule (Rust uses it to call back into JS for the event sink).
40
+ class ReactNativeTerminalUniffiModule : public ObjCTurboModule {
41
+ public:
42
+ ReactNativeTerminalUniffiModule(const ObjCTurboModule::InitParams &params);
43
+ std::shared_ptr<CallInvoker> callInvoker;
44
+ };
45
+
46
+ // Installs globalThis.NativeShimUniffi. Synchronous: ssh.ts uses the bindings
47
+ // immediately after this returns. Returns true on success (parity with Android's
48
+ // boolean nativeInstallRustCrate).
49
+ static jsi::Value installRustCrate(jsi::Runtime &rt, TurboModule &turboModule,
50
+ const jsi::Value * /*args*/, size_t /*count*/) {
51
+ auto &tm = static_cast<ReactNativeTerminalUniffiModule &>(turboModule);
52
+ ::NativeShimUniffi::registerModule(rt, tm.callInvoker);
53
+ return jsi::Value(true);
54
+ }
55
+
56
+ ReactNativeTerminalUniffiModule::ReactNativeTerminalUniffiModule(
57
+ const ObjCTurboModule::InitParams &params)
58
+ : ObjCTurboModule(params), callInvoker(params.jsInvoker) {
59
+ methodMap_["installRustCrate"] = MethodMetadata{0, installRustCrate};
60
+ }
61
+ } // namespace fressh_terminal_install
62
+
63
+ @interface ReactNativeTerminalUniffi : NSObject <RCTBridgeModule, RCTTurboModule>
64
+ @end
65
+
66
+ @implementation ReactNativeTerminalUniffi
67
+
68
+ // Module name = "ReactNativeTerminalUniffi" (matches the TurboModuleRegistry lookup
69
+ // in ssh.ts and the Android ReactNativeTerminalModule.NAME).
70
+ RCT_EXPORT_MODULE()
71
+
72
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
73
+ (const facebook::react::ObjCTurboModule::InitParams &)params {
74
+ return std::make_shared<fressh_terminal_install::ReactNativeTerminalUniffiModule>(params);
75
+ }
76
+
77
+ @end
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # Vendor prebuilt ANGLE (libEGL + libGLESv2, Metal backend) for iOS — the GLES2
4
+ # driver our renderer runs over on iOS (Strategy A + ANGLE→Metal, §2/§5). ANGLE
5
+ # has no published iOS dylibs from Google; we use the kivy/angle-builder release,
6
+ # which packages mainline ANGLE as `libEGL.xcframework` + `libGLESv2.xcframework`
7
+ # (each device + arm64/x64 simulator), with the dlopen-able dynamic libs our
8
+ # `khronos-egl` `dynamic` path resolves at runtime.
9
+ #
10
+ # Extracts the two xcframeworks to the PACKAGE ROOT, where they are COMMITTED
11
+ # (stable third-party prebuilts — see .gitignore, which ignores only the
12
+ # rust-derived shim_uniffi.xcframework). So this only needs re-running when bumping
13
+ # the pinned tag, NOT on every clean checkout. Pin the tag; bump deliberately. Run
14
+ # from the package dir: `bun run angle:fetch`.
15
+
16
+ set -euo pipefail
17
+
18
+ # Pinned ANGLE release (kivy/angle-builder). Bump intentionally + re-verify.
19
+ ANGLE_REPO="kivy/angle-builder"
20
+ ANGLE_TAG="chromium-7151_rev1"
21
+ ANGLE_ASSET="angle-iphoneall-universal.tar.gz" # device + arm64/x64 sim, universal
22
+
23
+ # Package root = parent of this script's ios/ dir.
24
+ PKG_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
25
+ TMP="$(mktemp -d)"
26
+ trap 'rm -rf "$TMP"' EXIT
27
+
28
+ echo "▸ Downloading ANGLE ${ANGLE_TAG}/${ANGLE_ASSET}"
29
+ gh release download "$ANGLE_TAG" -R "$ANGLE_REPO" -p "$ANGLE_ASSET" -D "$TMP"
30
+
31
+ echo "▸ Extracting libEGL.xcframework + libGLESv2.xcframework → ${PKG_DIR}"
32
+ tar xzf "$TMP/$ANGLE_ASSET" -C "$TMP"
33
+ for fw in libEGL.xcframework libGLESv2.xcframework; do
34
+ rm -rf "${PKG_DIR:?}/${fw}"
35
+ cp -R "$TMP/$fw" "$PKG_DIR/$fw"
36
+ echo " ✓ $fw"
37
+ done
38
+
39
+ echo "✓ ANGLE vendored at ${PKG_DIR} (libEGL.xcframework, libGLESv2.xcframework)"
Binary file