@nativescript/canvas 2.0.0-alpha.5 → 2.0.0-alpha.50

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 (542) hide show
  1. package/Canvas/common.d.ts +213 -25
  2. package/Canvas/common.js +702 -452
  3. package/Canvas/common.js.map +1 -1
  4. package/Canvas/index.android.d.ts +12 -1
  5. package/Canvas/index.android.js +162 -49
  6. package/Canvas/index.android.js.map +1 -1
  7. package/Canvas/index.d.ts +13 -0
  8. package/Canvas/index.ios.d.ts +9 -4
  9. package/Canvas/index.ios.js +166 -103
  10. package/Canvas/index.ios.js.map +1 -1
  11. package/Canvas2D/CanvasGradient/index.d.ts +1 -3
  12. package/Canvas2D/CanvasGradient/index.js +1 -10
  13. package/Canvas2D/CanvasGradient/index.js.map +1 -1
  14. package/Canvas2D/CanvasPattern/index.d.ts +1 -3
  15. package/Canvas2D/CanvasPattern/index.js +1 -10
  16. package/Canvas2D/CanvasPattern/index.js.map +1 -1
  17. package/Canvas2D/CanvasRenderingContext2D/index.d.ts +7 -3
  18. package/Canvas2D/CanvasRenderingContext2D/index.js +132 -233
  19. package/Canvas2D/CanvasRenderingContext2D/index.js.map +1 -1
  20. package/Canvas2D/DOMMatrix/index.js +3 -3
  21. package/Canvas2D/DOMMatrix/index.js.map +1 -1
  22. package/Canvas2D/ImageData/index.js +6 -6
  23. package/Canvas2D/ImageData/index.js.map +1 -1
  24. package/Canvas2D/Path2D/index.d.ts +0 -2
  25. package/Canvas2D/Path2D/index.js +32 -42
  26. package/Canvas2D/Path2D/index.js.map +1 -1
  27. package/Dom/Paint.js +2 -3
  28. package/Dom/Paint.js.map +1 -1
  29. package/Dom/shapes/Circle.js +1 -2
  30. package/Dom/shapes/Circle.js.map +1 -1
  31. package/Dom/shapes/Points.js +1 -2
  32. package/Dom/shapes/Points.js.map +1 -1
  33. package/ImageAsset/index.d.ts +2 -2
  34. package/ImageAsset/index.js +33 -37
  35. package/ImageAsset/index.js.map +1 -1
  36. package/ImageBitmap/index.d.ts +0 -2
  37. package/ImageBitmap/index.js +47 -33
  38. package/ImageBitmap/index.js.map +1 -1
  39. package/LICENSE +201 -0
  40. package/SVG/SVG.js +1 -1
  41. package/SVG/SVG.js.map +1 -1
  42. package/TextDecoder/index.d.ts +0 -2
  43. package/TextDecoder/index.js +3 -12
  44. package/TextDecoder/index.js.map +1 -1
  45. package/TextEncoder/index.d.ts +0 -2
  46. package/TextEncoder/index.js +4 -13
  47. package/TextEncoder/index.js.map +1 -1
  48. package/WebGL/WebGLExtensions/index.d.ts +4 -12
  49. package/WebGL/WebGLExtensions/index.js +27 -77
  50. package/WebGL/WebGLExtensions/index.js.map +1 -1
  51. package/WebGL/WebGLProgram.d.ts +0 -1
  52. package/WebGL/WebGLProgram.js +0 -3
  53. package/WebGL/WebGLProgram.js.map +1 -1
  54. package/WebGL/WebGLRenderingContext/common.d.ts +1 -3
  55. package/WebGL/WebGLRenderingContext/common.js +3 -13
  56. package/WebGL/WebGLRenderingContext/common.js.map +1 -1
  57. package/WebGL/WebGLRenderingContext/index.d.ts +19 -17
  58. package/WebGL/WebGLRenderingContext/index.js +354 -728
  59. package/WebGL/WebGLRenderingContext/index.js.map +1 -1
  60. package/WebGL2/WebGL2RenderingContext/common.d.ts +2 -2
  61. package/WebGL2/WebGL2RenderingContext/common.js +2 -2
  62. package/WebGL2/WebGL2RenderingContext/common.js.map +1 -1
  63. package/WebGL2/WebGL2RenderingContext/index.d.ts +1 -1
  64. package/WebGL2/WebGL2RenderingContext/index.js +116 -285
  65. package/WebGL2/WebGL2RenderingContext/index.js.map +1 -1
  66. package/angular/esm2020/index.mjs +4 -4
  67. package/angular/fesm2015/nativescript-canvas-angular.mjs +4 -4
  68. package/angular/fesm2020/nativescript-canvas-angular.mjs +4 -4
  69. package/angular/package.json +2 -2
  70. package/index.js.map +1 -1
  71. package/package.json +3 -2
  72. package/platforms/android/canvas-release.aar +0 -0
  73. package/platforms/android/include.gradle +15 -0
  74. package/platforms/ios/CanvasNative.xcframework/Info.plist +5 -5
  75. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/CanvasNative +0 -0
  76. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative-Swift.h +135 -68
  77. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/CanvasNative.h +10 -0
  78. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_ios.h +144 -0
  79. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Headers/canvas_native.h +2774 -70
  80. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Info.plist +0 -0
  81. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  82. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.abi.json +5851 -2555
  83. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.private.swiftinterface +44 -24
  84. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  85. package/platforms/ios/CanvasNative.xcframework/ios-arm64/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios.swiftinterface +44 -24
  86. package/platforms/ios/CanvasNative.xcframework/ios-arm64/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  87. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/CanvasNative +0 -0
  88. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative-Swift.h +270 -136
  89. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/CanvasNative.h +10 -0
  90. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_ios.h +144 -0
  91. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Headers/canvas_native.h +2774 -70
  92. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Info.plist +0 -0
  93. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/arm64-apple-ios-simulator.swiftsourceinfo +0 -0
  94. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo +0 -0
  95. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.abi.json +5851 -2555
  96. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +44 -24
  97. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  98. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/arm64-apple-ios-simulator.swiftinterface +44 -24
  99. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.abi.json +5851 -2555
  100. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +44 -24
  101. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  102. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/Modules/CanvasNative.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +44 -24
  103. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/CanvasNative.framework/_CodeSignature/CodeResources +42 -31
  104. package/platforms/ios/CanvasNative.xcframework/ios-arm64_x86_64-simulator/dSYMs/CanvasNative.framework.dSYM/Contents/Resources/DWARF/CanvasNative +0 -0
  105. package/platforms/ios/Podfile +5 -2
  106. package/platforms/ios/build.xcconfig +3 -3
  107. package/platforms/ios/src/CanvasModule.h +0 -2
  108. package/platforms/ios/src/CanvasModule.mm +4 -4
  109. package/platforms/ios/src/NSOperationQueueWrapper.h +11 -0
  110. package/platforms/ios/src/NSOperationQueueWrapper.mm +74 -0
  111. package/platforms/ios/src/cpp/Caches.cpp +35 -0
  112. package/platforms/ios/src/cpp/Caches.h +190 -0
  113. package/platforms/ios/src/cpp/CanvasJSIModule.cpp +1593 -0
  114. package/platforms/ios/src/cpp/CanvasJSIModule.h +16 -34
  115. package/platforms/ios/src/cpp/Common.h +30 -0
  116. package/platforms/ios/src/cpp/ConcurrentMap.h +54 -0
  117. package/platforms/ios/src/cpp/Helpers.h +336 -38
  118. package/platforms/ios/src/cpp/ImageAssetImpl.cpp +802 -0
  119. package/platforms/ios/src/cpp/ImageAssetImpl.h +46 -12
  120. package/platforms/ios/src/cpp/ImageBitmapImpl.cpp +189 -0
  121. package/platforms/ios/src/cpp/ImageBitmapImpl.h +42 -16
  122. package/platforms/ios/src/cpp/JSICallback.h +83 -5
  123. package/platforms/ios/src/cpp/JSIReadFileCallback.h +86 -6
  124. package/platforms/ios/src/cpp/JSIRuntime.cpp +21 -0
  125. package/platforms/ios/src/cpp/JSIRuntime.h +7 -0
  126. package/platforms/ios/src/cpp/ObjectWrapperImpl.h +31 -0
  127. package/platforms/ios/src/cpp/OneByteStringResource.cpp +55 -0
  128. package/platforms/ios/src/cpp/OneByteStringResource.h +36 -0
  129. package/platforms/ios/src/cpp/PerIsolateData.cpp +49 -0
  130. package/platforms/ios/src/cpp/PerIsolateData.h +54 -0
  131. package/platforms/ios/src/cpp/RafImpl.cpp +8 -0
  132. package/platforms/ios/src/cpp/RafImpl.h +11 -8
  133. package/platforms/ios/src/cpp/TextDecoderImpl.cpp +193 -0
  134. package/platforms/ios/src/cpp/TextDecoderImpl.h +23 -13
  135. package/platforms/ios/src/cpp/TextEncoderImpl.cpp +139 -0
  136. package/platforms/ios/src/cpp/TextEncoderImpl.h +21 -12
  137. package/platforms/ios/src/cpp/URLImpl.cpp +464 -0
  138. package/platforms/ios/src/cpp/URLImpl.h +121 -0
  139. package/platforms/ios/src/cpp/canvas2d/CanvasGradient.cpp +71 -0
  140. package/platforms/ios/src/cpp/canvas2d/CanvasGradient.h +29 -13
  141. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.cpp +89 -0
  142. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.h +49 -12
  143. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.cpp +2841 -0
  144. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.h +1331 -21
  145. package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.cpp +207 -0
  146. package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.h +27 -13
  147. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.cpp +807 -0
  148. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.h +173 -13
  149. package/platforms/ios/src/cpp/canvas2d/Path2D.cpp +499 -0
  150. package/platforms/ios/src/cpp/canvas2d/Path2D.h +422 -12
  151. package/platforms/ios/src/cpp/canvas2d/TextMetricsImpl.cpp +253 -0
  152. package/platforms/ios/src/cpp/canvas2d/TextMetricsImpl.h +51 -12
  153. package/platforms/ios/src/cpp/gl.h +57 -7
  154. package/platforms/ios/src/cpp/gl3stub.c +425 -0
  155. package/platforms/ios/src/cpp/gl3stub.h +665 -0
  156. package/platforms/ios/src/cpp/gles3jni.h +37 -0
  157. package/platforms/ios/src/cpp/include/robin_hood.h +2544 -0
  158. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.cpp +91 -0
  159. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.h +33 -13
  160. package/platforms/ios/src/cpp/webgl/WebGLBuffer.h +42 -7
  161. package/platforms/ios/src/cpp/webgl/WebGLFramebuffer.h +47 -11
  162. package/platforms/ios/src/cpp/webgl/WebGLProgram.h +41 -6
  163. package/platforms/ios/src/cpp/webgl/WebGLRenderbuffer.h +41 -7
  164. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.cpp +6845 -0
  165. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.h +3217 -388
  166. package/platforms/ios/src/cpp/webgl/{WebGLRenderingContextBase.mm → WebGLRenderingContextBase.cpp} +18 -17
  167. package/platforms/ios/src/cpp/webgl/WebGLRenderingContextBase.h +16 -36
  168. package/platforms/ios/src/cpp/webgl/WebGLShader.h +41 -7
  169. package/platforms/ios/src/cpp/webgl/WebGLShaderPrecisionFormatImpl.cpp +50 -0
  170. package/platforms/ios/src/cpp/webgl/WebGLShaderPrecisionFormatImpl.h +67 -12
  171. package/platforms/ios/src/cpp/webgl/WebGLTexture.h +41 -7
  172. package/platforms/ios/src/cpp/webgl/WebGLUniformLocation.h +45 -9
  173. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.cpp +126 -0
  174. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.h +26 -12
  175. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.cpp +35 -0
  176. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.h +26 -6
  177. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.cpp +41 -0
  178. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.h +26 -6
  179. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.cpp +306 -0
  180. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.h +47 -13
  181. package/platforms/ios/src/cpp/webgl/extensions/EXT_sRGBImpl.h +49 -6
  182. package/platforms/ios/src/cpp/webgl/extensions/EXT_shader_texture_lodImpl.h +37 -15
  183. package/platforms/ios/src/cpp/webgl/extensions/EXT_texture_filter_anisotropicImpl.h +47 -6
  184. package/platforms/ios/src/cpp/webgl/extensions/OES_element_index_uintImpl.h +49 -6
  185. package/platforms/ios/src/cpp/webgl/extensions/OES_fbo_render_mipmap.h +41 -16
  186. package/platforms/ios/src/cpp/webgl/extensions/OES_standard_derivativesImpl.h +44 -6
  187. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_floatImpl.h +39 -16
  188. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_float_linearImpl.h +37 -16
  189. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_floatImpl.h +42 -6
  190. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_float_linearImpl.h +40 -16
  191. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.cpp +102 -0
  192. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.h +69 -14
  193. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_color_buffer_floatImpl.h +51 -8
  194. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_atcImpl.h +49 -6
  195. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etc1Impl.h +49 -8
  196. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etcImpl.h +76 -6
  197. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_pvrtcImpl.h +57 -6
  198. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tcImpl.h +53 -6
  199. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tc_srgbImpl.h +59 -6
  200. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_depth_textureImpl.h +46 -6
  201. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.cpp +35 -0
  202. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.h +131 -14
  203. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_lose_contextImpl.cpp +32 -0
  204. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_lose_contextImpl.h +61 -13
  205. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.cpp +4533 -0
  206. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.h +1427 -342
  207. package/platforms/ios/src/cpp/webgl2/WebGLQuery.h +41 -4
  208. package/platforms/ios/src/cpp/webgl2/WebGLSampler.h +42 -3
  209. package/platforms/ios/src/cpp/webgl2/WebGLSyncImpl.h +45 -11
  210. package/platforms/ios/src/cpp/webgl2/WebGLTransformFeedback.h +43 -4
  211. package/platforms/ios/src/cpp/webgl2/WebGLVertexArrayObject.h +44 -4
  212. package/platforms/ios/src/module.modulemap +1 -0
  213. package/{pods → src-native/ios}/NativeScript.podspec +12 -25
  214. package/typings/objc!CanvasNative.d.ts +2038 -0
  215. package/typings/objc!CanvasNative.js +1 -0
  216. package/typings/objc!CanvasNative.js.map +1 -0
  217. package/utils.d.ts +3 -1
  218. package/utils.js +7 -20
  219. package/utils.js.map +1 -1
  220. package/angular/nativescript-canvas-angular.d.ts +0 -5
  221. package/platforms/ios/src/cpp/CanvasJSIModule.mm +0 -1105
  222. package/platforms/ios/src/cpp/ImageAssetImpl.mm +0 -417
  223. package/platforms/ios/src/cpp/ImageBitmapImpl.mm +0 -126
  224. package/platforms/ios/src/cpp/RafImpl.mm +0 -10
  225. package/platforms/ios/src/cpp/TextDecoderImpl.mm +0 -97
  226. package/platforms/ios/src/cpp/TextEncoderImpl.mm +0 -60
  227. package/platforms/ios/src/cpp/VecMutableBuffer.h +0 -46
  228. package/platforms/ios/src/cpp/canvas-cxx/src/lib.rs.cc +0 -6132
  229. package/platforms/ios/src/cpp/canvas-cxx/src/lib.rs.h +0 -2859
  230. package/platforms/ios/src/cpp/canvas2d/CanvasGradient.mm +0 -42
  231. package/platforms/ios/src/cpp/canvas2d/CanvasPattern.mm +0 -49
  232. package/platforms/ios/src/cpp/canvas2d/CanvasRenderingContext2DImpl.mm +0 -1975
  233. package/platforms/ios/src/cpp/canvas2d/ImageDataImpl.mm +0 -68
  234. package/platforms/ios/src/cpp/canvas2d/MatrixImpl.mm +0 -149
  235. package/platforms/ios/src/cpp/canvas2d/Path2D.mm +0 -335
  236. package/platforms/ios/src/cpp/canvas2d/TextMetricsImpl.mm +0 -68
  237. package/platforms/ios/src/cpp/rust/cxx.cc +0 -793
  238. package/platforms/ios/src/cpp/rust/cxx.h +0 -1111
  239. package/platforms/ios/src/cpp/webgl/WebGLActiveInfoImpl.mm +0 -39
  240. package/platforms/ios/src/cpp/webgl/WebGLRenderingContext.mm +0 -5958
  241. package/platforms/ios/src/cpp/webgl/WebGLShaderPrecisionFormatImpl.mm +0 -40
  242. package/platforms/ios/src/cpp/webgl/extensions/ANGLE_instanced_arraysImpl.mm +0 -108
  243. package/platforms/ios/src/cpp/webgl/extensions/EXT_blend_minmaxImpl.mm +0 -28
  244. package/platforms/ios/src/cpp/webgl/extensions/EXT_color_buffer_half_floatImpl.mm +0 -42
  245. package/platforms/ios/src/cpp/webgl/extensions/EXT_disjoint_timer_queryImpl.mm +0 -295
  246. package/platforms/ios/src/cpp/webgl/extensions/EXT_sRGBImpl.mm +0 -40
  247. package/platforms/ios/src/cpp/webgl/extensions/EXT_texture_filter_anisotropicImpl.mm +0 -37
  248. package/platforms/ios/src/cpp/webgl/extensions/OES_element_index_uintImpl.mm +0 -28
  249. package/platforms/ios/src/cpp/webgl/extensions/OES_standard_derivativesImpl.mm +0 -31
  250. package/platforms/ios/src/cpp/webgl/extensions/OES_texture_half_floatImpl.mm +0 -28
  251. package/platforms/ios/src/cpp/webgl/extensions/OES_vertex_array_objectImpl.mm +0 -127
  252. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_color_buffer_floatImpl.mm +0 -45
  253. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_atcImpl.mm +0 -45
  254. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etc1Impl.mm +0 -31
  255. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_etcImpl.mm +0 -70
  256. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_pvrtcImpl.mm +0 -47
  257. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tcImpl.mm +0 -46
  258. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_compressed_texture_s3tc_srgbImpl.mm +0 -49
  259. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_depth_textureImpl.mm +0 -30
  260. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_draw_buffersImpl.mm +0 -177
  261. package/platforms/ios/src/cpp/webgl/extensions/WEBGL_lose_contextImpl.mm +0 -64
  262. package/platforms/ios/src/cpp/webgl2/WebGL2RenderingContext.mm +0 -4556
  263. package/pods/Headers/jsi/decorator.h +0 -770
  264. package/pods/Headers/jsi/instrumentation.h +0 -117
  265. package/pods/Headers/jsi/jsi-inl.h +0 -338
  266. package/pods/Headers/jsi/jsi.h +0 -1571
  267. package/pods/Headers/jsi/jsilib.h +0 -59
  268. package/pods/Headers/jsi/threadsafe.h +0 -79
  269. package/pods/Headers/v8runtime/HostProxy.h +0 -71
  270. package/pods/Headers/v8runtime/JSIV8ValueConverter.h +0 -74
  271. package/pods/Headers/v8runtime/V8PointerValue.h +0 -44
  272. package/pods/Headers/v8runtime/V8Runtime.h +0 -240
  273. package/pods/Headers/v8runtime/V8RuntimeConfig.h +0 -26
  274. package/pods/Headers/v8runtime/V8RuntimeFactory.h +0 -21
  275. /package/platforms/ios/src/cpp/{OnRafCallback.mm → OnRafCallback.cpp} +0 -0
  276. /package/{pods → src-native/ios}/Headers/include/APIDesign.md +0 -0
  277. /package/{pods → src-native/ios}/Headers/include/DEPS +0 -0
  278. /package/{pods → src-native/ios}/Headers/include/DIR_METADATA +0 -0
  279. /package/{pods → src-native/ios}/Headers/include/OWNERS +0 -0
  280. /package/{pods → src-native/ios}/Headers/include/cppgc/DEPS +0 -0
  281. /package/{pods → src-native/ios}/Headers/include/cppgc/OWNERS +0 -0
  282. /package/{pods → src-native/ios}/Headers/include/cppgc/README.md +0 -0
  283. /package/{pods → src-native/ios}/Headers/include/cppgc/allocation.h +0 -0
  284. /package/{pods → src-native/ios}/Headers/include/cppgc/common.h +0 -0
  285. /package/{pods → src-native/ios}/Headers/include/cppgc/cross-thread-persistent.h +0 -0
  286. /package/{pods → src-native/ios}/Headers/include/cppgc/custom-space.h +0 -0
  287. /package/{pods → src-native/ios}/Headers/include/cppgc/default-platform.h +0 -0
  288. /package/{pods → src-native/ios}/Headers/include/cppgc/ephemeron-pair.h +0 -0
  289. /package/{pods → src-native/ios}/Headers/include/cppgc/explicit-management.h +0 -0
  290. /package/{pods → src-native/ios}/Headers/include/cppgc/garbage-collected.h +0 -0
  291. /package/{pods → src-native/ios}/Headers/include/cppgc/heap-consistency.h +0 -0
  292. /package/{pods → src-native/ios}/Headers/include/cppgc/heap-state.h +0 -0
  293. /package/{pods → src-native/ios}/Headers/include/cppgc/heap-statistics.h +0 -0
  294. /package/{pods → src-native/ios}/Headers/include/cppgc/heap.h +0 -0
  295. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/api-constants.h +0 -0
  296. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/atomic-entry-flag.h +0 -0
  297. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/caged-heap-local-data.h +0 -0
  298. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/compiler-specific.h +0 -0
  299. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/finalizer-trait.h +0 -0
  300. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/gc-info.h +0 -0
  301. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/logging.h +0 -0
  302. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/name-trait.h +0 -0
  303. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/persistent-node.h +0 -0
  304. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/pointer-policies.h +0 -0
  305. /package/{pods → src-native/ios}/Headers/include/cppgc/internal/write-barrier.h +0 -0
  306. /package/{pods → src-native/ios}/Headers/include/cppgc/liveness-broker.h +0 -0
  307. /package/{pods → src-native/ios}/Headers/include/cppgc/macros.h +0 -0
  308. /package/{pods → src-native/ios}/Headers/include/cppgc/member.h +0 -0
  309. /package/{pods → src-native/ios}/Headers/include/cppgc/name-provider.h +0 -0
  310. /package/{pods → src-native/ios}/Headers/include/cppgc/object-size-trait.h +0 -0
  311. /package/{pods → src-native/ios}/Headers/include/cppgc/persistent.h +0 -0
  312. /package/{pods → src-native/ios}/Headers/include/cppgc/platform.h +0 -0
  313. /package/{pods → src-native/ios}/Headers/include/cppgc/prefinalizer.h +0 -0
  314. /package/{pods → src-native/ios}/Headers/include/cppgc/process-heap-statistics.h +0 -0
  315. /package/{pods → src-native/ios}/Headers/include/cppgc/sentinel-pointer.h +0 -0
  316. /package/{pods → src-native/ios}/Headers/include/cppgc/source-location.h +0 -0
  317. /package/{pods → src-native/ios}/Headers/include/cppgc/testing.h +0 -0
  318. /package/{pods → src-native/ios}/Headers/include/cppgc/trace-trait.h +0 -0
  319. /package/{pods → src-native/ios}/Headers/include/cppgc/type-traits.h +0 -0
  320. /package/{pods → src-native/ios}/Headers/include/cppgc/visitor.h +0 -0
  321. /package/{pods → src-native/ios}/Headers/include/js_protocol-1.2.json +0 -0
  322. /package/{pods → src-native/ios}/Headers/include/js_protocol-1.3.json +0 -0
  323. /package/{pods → src-native/ios}/Headers/include/js_protocol.pdl +0 -0
  324. /package/{pods → src-native/ios}/Headers/include/libffi/arm64/ffi.h +0 -0
  325. /package/{pods → src-native/ios}/Headers/include/libffi/arm64/ffitarget.h +0 -0
  326. /package/{pods → src-native/ios}/Headers/include/libffi/x86_64/ffi.h +0 -0
  327. /package/{pods → src-native/ios}/Headers/include/libffi/x86_64/ffitarget.h +0 -0
  328. /package/{pods → src-native/ios}/Headers/include/libffi.h +0 -0
  329. /package/{pods → src-native/ios}/Headers/include/libplatform/DEPS +0 -0
  330. /package/{pods → src-native/ios}/Headers/include/libplatform/libplatform-export.h +0 -0
  331. /package/{pods → src-native/ios}/Headers/include/libplatform/libplatform.h +0 -0
  332. /package/{pods → src-native/ios}/Headers/include/libplatform/v8-tracing.h +0 -0
  333. /package/{pods → src-native/ios}/Headers/include/v8-array-buffer.h +0 -0
  334. /package/{pods → src-native/ios}/Headers/include/v8-callbacks.h +0 -0
  335. /package/{pods → src-native/ios}/Headers/include/v8-container.h +0 -0
  336. /package/{pods → src-native/ios}/Headers/include/v8-context.h +0 -0
  337. /package/{pods → src-native/ios}/Headers/include/v8-cppgc.h +0 -0
  338. /package/{pods → src-native/ios}/Headers/include/v8-data.h +0 -0
  339. /package/{pods → src-native/ios}/Headers/include/v8-date.h +0 -0
  340. /package/{pods → src-native/ios}/Headers/include/v8-debug.h +0 -0
  341. /package/{pods → src-native/ios}/Headers/include/v8-embedder-heap.h +0 -0
  342. /package/{pods → src-native/ios}/Headers/include/v8-embedder-state-scope.h +0 -0
  343. /package/{pods → src-native/ios}/Headers/include/v8-exception.h +0 -0
  344. /package/{pods → src-native/ios}/Headers/include/v8-extension.h +0 -0
  345. /package/{pods → src-native/ios}/Headers/include/v8-external.h +0 -0
  346. /package/{pods → src-native/ios}/Headers/include/v8-fast-api-calls.h +0 -0
  347. /package/{pods → src-native/ios}/Headers/include/v8-forward.h +0 -0
  348. /package/{pods → src-native/ios}/Headers/include/v8-function-callback.h +0 -0
  349. /package/{pods → src-native/ios}/Headers/include/v8-function.h +0 -0
  350. /package/{pods → src-native/ios}/Headers/include/v8-initialization.h +0 -0
  351. /package/{pods → src-native/ios}/Headers/include/v8-inspector-protocol.h +0 -0
  352. /package/{pods → src-native/ios}/Headers/include/v8-inspector.h +0 -0
  353. /package/{pods → src-native/ios}/Headers/include/v8-internal.h +0 -0
  354. /package/{pods → src-native/ios}/Headers/include/v8-isolate.h +0 -0
  355. /package/{pods → src-native/ios}/Headers/include/v8-json.h +0 -0
  356. /package/{pods → src-native/ios}/Headers/include/v8-local-handle.h +0 -0
  357. /package/{pods → src-native/ios}/Headers/include/v8-locker.h +0 -0
  358. /package/{pods → src-native/ios}/Headers/include/v8-maybe.h +0 -0
  359. /package/{pods → src-native/ios}/Headers/include/v8-memory-span.h +0 -0
  360. /package/{pods → src-native/ios}/Headers/include/v8-message.h +0 -0
  361. /package/{pods → src-native/ios}/Headers/include/v8-metrics.h +0 -0
  362. /package/{pods → src-native/ios}/Headers/include/v8-microtask-queue.h +0 -0
  363. /package/{pods → src-native/ios}/Headers/include/v8-microtask.h +0 -0
  364. /package/{pods → src-native/ios}/Headers/include/v8-object.h +0 -0
  365. /package/{pods → src-native/ios}/Headers/include/v8-persistent-handle.h +0 -0
  366. /package/{pods → src-native/ios}/Headers/include/v8-platform.h +0 -0
  367. /package/{pods → src-native/ios}/Headers/include/v8-primitive-object.h +0 -0
  368. /package/{pods → src-native/ios}/Headers/include/v8-primitive.h +0 -0
  369. /package/{pods → src-native/ios}/Headers/include/v8-profiler.h +0 -0
  370. /package/{pods → src-native/ios}/Headers/include/v8-promise.h +0 -0
  371. /package/{pods → src-native/ios}/Headers/include/v8-proxy.h +0 -0
  372. /package/{pods → src-native/ios}/Headers/include/v8-regexp.h +0 -0
  373. /package/{pods → src-native/ios}/Headers/include/v8-script.h +0 -0
  374. /package/{pods → src-native/ios}/Headers/include/v8-snapshot.h +0 -0
  375. /package/{pods → src-native/ios}/Headers/include/v8-statistics.h +0 -0
  376. /package/{pods → src-native/ios}/Headers/include/v8-template.h +0 -0
  377. /package/{pods → src-native/ios}/Headers/include/v8-traced-handle.h +0 -0
  378. /package/{pods → src-native/ios}/Headers/include/v8-typed-array.h +0 -0
  379. /package/{pods → src-native/ios}/Headers/include/v8-unwinder-state.h +0 -0
  380. /package/{pods → src-native/ios}/Headers/include/v8-unwinder.h +0 -0
  381. /package/{pods → src-native/ios}/Headers/include/v8-util.h +0 -0
  382. /package/{pods → src-native/ios}/Headers/include/v8-value-serializer-version.h +0 -0
  383. /package/{pods → src-native/ios}/Headers/include/v8-value-serializer.h +0 -0
  384. /package/{pods → src-native/ios}/Headers/include/v8-value.h +0 -0
  385. /package/{pods → src-native/ios}/Headers/include/v8-version-string.h +0 -0
  386. /package/{pods → src-native/ios}/Headers/include/v8-version.h +0 -0
  387. /package/{pods → src-native/ios}/Headers/include/v8-wasm-trap-handler-posix.h +0 -0
  388. /package/{pods → src-native/ios}/Headers/include/v8-wasm-trap-handler-win.h +0 -0
  389. /package/{pods → src-native/ios}/Headers/include/v8-wasm.h +0 -0
  390. /package/{pods → src-native/ios}/Headers/include/v8-weak-callback-info.h +0 -0
  391. /package/{pods → src-native/ios}/Headers/include/v8.h +0 -0
  392. /package/{pods → src-native/ios}/Headers/include/v8config.h +0 -0
  393. /package/{pods → src-native/ios}/Headers/inspector/InspectorServer.h +0 -0
  394. /package/{pods → src-native/ios}/Headers/inspector/JsV8InspectorClient.h +0 -0
  395. /package/{pods → src-native/ios}/Headers/inspector/base/trace_event/common/trace_event_common.h +0 -0
  396. /package/{pods → src-native/ios}/Headers/inspector/base64.h +0 -0
  397. /package/{pods → src-native/ios}/Headers/inspector/src/base/address-region.h +0 -0
  398. /package/{pods → src-native/ios}/Headers/inspector/src/base/atomic-utils.h +0 -0
  399. /package/{pods → src-native/ios}/Headers/inspector/src/base/atomicops.h +0 -0
  400. /package/{pods → src-native/ios}/Headers/inspector/src/base/atomicops_internals_atomicword_compat.h +0 -0
  401. /package/{pods → src-native/ios}/Headers/inspector/src/base/base-export.h +0 -0
  402. /package/{pods → src-native/ios}/Headers/inspector/src/base/bits.h +0 -0
  403. /package/{pods → src-native/ios}/Headers/inspector/src/base/build_config.h +0 -0
  404. /package/{pods → src-native/ios}/Headers/inspector/src/base/compiler-specific.h +0 -0
  405. /package/{pods → src-native/ios}/Headers/inspector/src/base/export-template.h +0 -0
  406. /package/{pods → src-native/ios}/Headers/inspector/src/base/flags.h +0 -0
  407. /package/{pods → src-native/ios}/Headers/inspector/src/base/immediate-crash.h +0 -0
  408. /package/{pods → src-native/ios}/Headers/inspector/src/base/lazy-instance.h +0 -0
  409. /package/{pods → src-native/ios}/Headers/inspector/src/base/logging.h +0 -0
  410. /package/{pods → src-native/ios}/Headers/inspector/src/base/macros.h +0 -0
  411. /package/{pods → src-native/ios}/Headers/inspector/src/base/memory.h +0 -0
  412. /package/{pods → src-native/ios}/Headers/inspector/src/base/once.h +0 -0
  413. /package/{pods → src-native/ios}/Headers/inspector/src/base/optional.h +0 -0
  414. /package/{pods → src-native/ios}/Headers/inspector/src/base/platform/mutex.h +0 -0
  415. /package/{pods → src-native/ios}/Headers/inspector/src/base/platform/platform.h +0 -0
  416. /package/{pods → src-native/ios}/Headers/inspector/src/base/platform/semaphore.h +0 -0
  417. /package/{pods → src-native/ios}/Headers/inspector/src/base/platform/v8-time.h +0 -0
  418. /package/{pods → src-native/ios}/Headers/inspector/src/base/platform/wrappers.h +0 -0
  419. /package/{pods → src-native/ios}/Headers/inspector/src/base/safe_conversions.h +0 -0
  420. /package/{pods → src-native/ios}/Headers/inspector/src/base/safe_conversions_impl.h +0 -0
  421. /package/{pods → src-native/ios}/Headers/inspector/src/base/template-utils.h +0 -0
  422. /package/{pods → src-native/ios}/Headers/inspector/src/base/v8-fallthrough.h +0 -0
  423. /package/{pods → src-native/ios}/Headers/inspector/src/common/checks.h +0 -0
  424. /package/{pods → src-native/ios}/Headers/inspector/src/common/globals.h +0 -0
  425. /package/{pods → src-native/ios}/Headers/inspector/src/debug/debug-interface.h +0 -0
  426. /package/{pods → src-native/ios}/Headers/inspector/src/debug/interface-types.h +0 -0
  427. /package/{pods → src-native/ios}/Headers/inspector/src/init/v8.h +0 -0
  428. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/custom-preview.h +0 -0
  429. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/injected-script.h +0 -0
  430. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/inspected-context.h +0 -0
  431. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/CSS.h +0 -0
  432. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Console.h +0 -0
  433. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/DOM.h +0 -0
  434. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Debugger.h +0 -0
  435. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Forward.h +0 -0
  436. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/HeapProfiler.h +0 -0
  437. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Log.h +0 -0
  438. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Network.h +0 -0
  439. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Overlay.h +0 -0
  440. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Page.h +0 -0
  441. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Profiler.h +0 -0
  442. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Protocol.h +0 -0
  443. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Runtime.h +0 -0
  444. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Schema.h +0 -0
  445. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/protocol/Security.h +0 -0
  446. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/remote-object-id.h +0 -0
  447. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/search-util.h +0 -0
  448. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/string-16.h +0 -0
  449. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/string-util.h +0 -0
  450. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-console-agent-impl.h +0 -0
  451. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-console-message.h +0 -0
  452. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-console.h +0 -0
  453. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-css-agent-impl.h +0 -0
  454. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-debugger-agent-impl.h +0 -0
  455. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-debugger-id.h +0 -0
  456. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-debugger-script.h +0 -0
  457. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-debugger.h +0 -0
  458. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-dom-agent-impl.h +0 -0
  459. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-heap-profiler-agent-impl.h +0 -0
  460. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-inspector-impl.h +0 -0
  461. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-inspector-session-impl.h +0 -0
  462. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-log-agent-impl.h +0 -0
  463. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-network-agent-impl.h +0 -0
  464. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-ns-debugger-agent-impl.h +0 -0
  465. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-overlay-agent-impl.h +0 -0
  466. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-page-agent-impl.h +0 -0
  467. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-profiler-agent-impl.h +0 -0
  468. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-regex.h +0 -0
  469. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-runtime-agent-impl.h +0 -0
  470. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-schema-agent-impl.h +0 -0
  471. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-stack-trace-impl.h +0 -0
  472. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-string-conversions.h +0 -0
  473. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/v8-value-utils.h +0 -0
  474. /package/{pods → src-native/ios}/Headers/inspector/src/inspector/value-mirror.h +0 -0
  475. /package/{pods → src-native/ios}/Headers/inspector/src/libplatform/default-platform.h +0 -0
  476. /package/{pods → src-native/ios}/Headers/inspector/src/logging/tracing-flags.h +0 -0
  477. /package/{pods → src-native/ios}/Headers/inspector/src/numbers/conversions.h +0 -0
  478. /package/{pods → src-native/ios}/Headers/inspector/src/tracing/trace-event.h +0 -0
  479. /package/{pods → src-native/ios}/Headers/inspector/src/utils/allocation.h +0 -0
  480. /package/{pods → src-native/ios}/Headers/inspector/src/utils/vector.h +0 -0
  481. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/cbor.h +0 -0
  482. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/dispatch.h +0 -0
  483. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/error_support.h +0 -0
  484. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/export.h +0 -0
  485. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/find_by_first.h +0 -0
  486. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/frontend_channel.h +0 -0
  487. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/glue.h +0 -0
  488. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/json.h +0 -0
  489. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/json_platform.h +0 -0
  490. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/maybe.h +0 -0
  491. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/parser_handler.h +0 -0
  492. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/protocol_core.h +0 -0
  493. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/serializable.h +0 -0
  494. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/serializer_traits.h +0 -0
  495. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/span.h +0 -0
  496. /package/{pods → src-native/ios}/Headers/inspector/third_party/inspector_protocol/crdtp/status.h +0 -0
  497. /package/{pods → src-native/ios}/Headers/inspector/utils.h +0 -0
  498. /package/{pods → src-native/ios}/Headers/inspector/v8-inspector-platform.h +0 -0
  499. /package/{pods → src-native/ios}/Headers/runtime/ArgConverter.h +0 -0
  500. /package/{pods → src-native/ios}/Headers/runtime/ArrayAdapter.h +0 -0
  501. /package/{pods → src-native/ios}/Headers/runtime/Caches.h +0 -0
  502. /package/{pods → src-native/ios}/Headers/runtime/ClassBuilder.h +0 -0
  503. /package/{pods → src-native/ios}/Headers/runtime/Common.h +0 -0
  504. /package/{pods → src-native/ios}/Headers/runtime/ConcurrentMap.h +0 -0
  505. /package/{pods → src-native/ios}/Headers/runtime/ConcurrentQueue.h +0 -0
  506. /package/{pods → src-native/ios}/Headers/runtime/Console.h +0 -0
  507. /package/{pods → src-native/ios}/Headers/runtime/Constants.h +0 -0
  508. /package/{pods → src-native/ios}/Headers/runtime/DataWrapper.h +0 -0
  509. /package/{pods → src-native/ios}/Headers/runtime/DictionaryAdapter.h +0 -0
  510. /package/{pods → src-native/ios}/Headers/runtime/ExtVector.h +0 -0
  511. /package/{pods → src-native/ios}/Headers/runtime/FFICall.h +0 -0
  512. /package/{pods → src-native/ios}/Headers/runtime/FastEnumerationAdapter.h +0 -0
  513. /package/{pods → src-native/ios}/Headers/runtime/FunctionReference.h +0 -0
  514. /package/{pods → src-native/ios}/Headers/runtime/Helpers.h +0 -0
  515. /package/{pods → src-native/ios}/Headers/runtime/InlineFunctions.h +0 -0
  516. /package/{pods → src-native/ios}/Headers/runtime/Interop.h +0 -0
  517. /package/{pods → src-native/ios}/Headers/runtime/KnownUnknownClassPair.h +0 -0
  518. /package/{pods → src-native/ios}/Headers/runtime/Metadata.h +0 -0
  519. /package/{pods → src-native/ios}/Headers/runtime/MetadataBuilder.h +0 -0
  520. /package/{pods → src-native/ios}/Headers/runtime/MetadataInlines.h +0 -0
  521. /package/{pods → src-native/ios}/Headers/runtime/ModuleInternal.h +0 -0
  522. /package/{pods → src-native/ios}/Headers/runtime/NSDataAdapter.h +0 -0
  523. /package/{pods → src-native/ios}/Headers/runtime/NativeScriptException.h +0 -0
  524. /package/{pods → src-native/ios}/Headers/runtime/ObjectManager.h +0 -0
  525. /package/{pods → src-native/ios}/Headers/runtime/OneByteStringResource.h +0 -0
  526. /package/{pods → src-native/ios}/Headers/runtime/Pointer.h +0 -0
  527. /package/{pods → src-native/ios}/Headers/runtime/PromiseProxy.h +0 -0
  528. /package/{pods → src-native/ios}/Headers/runtime/Reference.h +0 -0
  529. /package/{pods → src-native/ios}/Headers/runtime/Runtime.h +0 -0
  530. /package/{pods → src-native/ios}/Headers/runtime/RuntimeConfig.h +0 -0
  531. /package/{pods → src-native/ios}/Headers/runtime/SetTimeout.h +0 -0
  532. /package/{pods → src-native/ios}/Headers/runtime/SimpleAllocator.h +0 -0
  533. /package/{pods → src-native/ios}/Headers/runtime/StringHasher.h +0 -0
  534. /package/{pods → src-native/ios}/Headers/runtime/SymbolIterator.h +0 -0
  535. /package/{pods → src-native/ios}/Headers/runtime/SymbolLoader.h +0 -0
  536. /package/{pods → src-native/ios}/Headers/runtime/TNSDerivedClass.h +0 -0
  537. /package/{pods → src-native/ios}/Headers/runtime/TSHelpers.h +0 -0
  538. /package/{pods → src-native/ios}/Headers/runtime/Tasks.h +0 -0
  539. /package/{pods → src-native/ios}/Headers/runtime/UnmanagedType.h +0 -0
  540. /package/{pods → src-native/ios}/Headers/runtime/WeakRef.h +0 -0
  541. /package/{pods → src-native/ios}/Headers/runtime/Worker.h +0 -0
  542. /package/{pods → src-native/ios}/Headers/runtime/robin_hood.h +0 -0
@@ -1,1571 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- #pragma once
9
-
10
- #include <cassert>
11
- #include <cstring>
12
- #include <exception>
13
- #include <functional>
14
- #include <memory>
15
- #include <string>
16
- #include <vector>
17
-
18
- #ifndef JSI_EXPORT
19
- #ifdef _MSC_VER
20
- #ifdef CREATE_SHARED_LIBRARY
21
- #define JSI_EXPORT __declspec(dllexport)
22
- #else
23
- #define JSI_EXPORT
24
- #endif // CREATE_SHARED_LIBRARY
25
- #else // _MSC_VER
26
- #define JSI_EXPORT __attribute__((visibility("default")))
27
- #endif // _MSC_VER
28
- #endif // !defined(JSI_EXPORT)
29
-
30
- class FBJSRuntime;
31
- namespace facebook {
32
- namespace jsi {
33
-
34
- class JSI_EXPORT Buffer {
35
- public:
36
- virtual ~Buffer();
37
- virtual size_t size() const = 0;
38
- virtual const uint8_t* data() const = 0;
39
- };
40
-
41
- /// Base class for buffers of data that need to be passed to the runtime. The
42
- /// result of size() and data() must not change after construction. However, the
43
- /// region pointed to by data() may be modified by the user or the runtime. The
44
- /// user must ensure that access to the contents of the buffer is properly
45
- /// synchronised.
46
- class JSI_EXPORT MutableBuffer {
47
- public:
48
- virtual ~MutableBuffer();
49
- virtual size_t size() const = 0;
50
- virtual uint8_t* data() = 0;
51
- };
52
-
53
- class JSI_EXPORT StringBuffer : public Buffer {
54
- public:
55
- StringBuffer(std::string s) : s_(std::move(s)) {}
56
- size_t size() const override {
57
- return s_.size();
58
- }
59
- const uint8_t* data() const override {
60
- return reinterpret_cast<const uint8_t*>(s_.data());
61
- }
62
-
63
- private:
64
- std::string s_;
65
- };
66
-
67
- /// PreparedJavaScript is a base class representing JavaScript which is in a
68
- /// form optimized for execution, in a runtime-specific way. Construct one via
69
- /// jsi::Runtime::prepareJavaScript().
70
- /// ** This is an experimental API that is subject to change. **
71
- class JSI_EXPORT PreparedJavaScript {
72
- protected:
73
- PreparedJavaScript() = default;
74
-
75
- public:
76
- virtual ~PreparedJavaScript() = 0;
77
- };
78
-
79
- class Runtime;
80
- class Pointer;
81
- class PropNameID;
82
- class Symbol;
83
- class BigInt;
84
- class String;
85
- class Object;
86
- class WeakObject;
87
- class Array;
88
- class ArrayBuffer;
89
- class Function;
90
- class Value;
91
- class Instrumentation;
92
- class Scope;
93
- class JSIException;
94
- class JSError;
95
- class TypedArray;
96
-
97
- /// A function which has this type can be registered as a function
98
- /// callable from JavaScript using Function::createFromHostFunction().
99
- /// When the function is called, args will point to the arguments, and
100
- /// count will indicate how many arguments are passed. The function
101
- /// can return a Value to the caller, or throw an exception. If a C++
102
- /// exception is thrown, a JS Error will be created and thrown into
103
- /// JS; if the C++ exception extends std::exception, the Error's
104
- /// message will be whatever what() returns. Note that it is undefined whether
105
- /// HostFunctions may or may not be called in strict mode; that is `thisVal`
106
- /// can be any value - it will not necessarily be coerced to an object or
107
- /// or set to the global object.
108
- using HostFunctionType = std::function<
109
- Value(Runtime& rt, const Value& thisVal, const Value* args, size_t count)>;
110
-
111
- /// An object which implements this interface can be registered as an
112
- /// Object with the JS runtime.
113
- class JSI_EXPORT HostObject {
114
- public:
115
- // The C++ object's dtor will be called when the GC finalizes this
116
- // object. (This may be as late as when the Runtime is shut down.)
117
- // You have no control over which thread it is called on. This will
118
- // be called from inside the GC, so it is unsafe to do any VM
119
- // operations which require a Runtime&. Derived classes' dtors
120
- // should also avoid doing anything expensive. Calling the dtor on
121
- // a jsi object is explicitly ok. If you want to do JS operations,
122
- // or any nontrivial work, you should add it to a work queue, and
123
- // manage it externally.
124
- virtual ~HostObject();
125
-
126
- // When JS wants a property with a given name from the HostObject,
127
- // it will call this method. If it throws an exception, the call
128
- // will throw a JS \c Error object. By default this returns undefined.
129
- // \return the value for the property.
130
- virtual Value get(Runtime&, const PropNameID& name);
131
-
132
- // When JS wants to set a property with a given name on the HostObject,
133
- // it will call this method. If it throws an exception, the call will
134
- // throw a JS \c Error object. By default this throws a type error exception
135
- // mimicking the behavior of a frozen object in strict mode.
136
- virtual void set(Runtime&, const PropNameID& name, const Value& value);
137
-
138
- // When JS wants a list of property names for the HostObject, it will
139
- // call this method. If it throws an exception, the call will throw a
140
- // JS \c Error object. The default implementation returns empty vector.
141
- virtual std::vector<PropNameID> getPropertyNames(Runtime& rt);
142
- };
143
-
144
- /// Represents a JS runtime. Movable, but not copyable. Note that
145
- /// this object may not be thread-aware, but cannot be used safely from
146
- /// multiple threads at once. The application is responsible for
147
- /// ensuring that it is used safely. This could mean using the
148
- /// Runtime from a single thread, using a mutex, doing all work on a
149
- /// serial queue, etc. This restriction applies to the methods of
150
- /// this class, and any method in the API which take a Runtime& as an
151
- /// argument. Destructors (all but ~Scope), operators, or other methods
152
- /// which do not take Runtime& as an argument are safe to call from any
153
- /// thread, but it is still forbidden to make write operations on a single
154
- /// instance of any class from more than one thread. In addition, to
155
- /// make shutdown safe, destruction of objects associated with the Runtime
156
- /// must be destroyed before the Runtime is destroyed, or from the
157
- /// destructor of a managed HostObject or HostFunction. Informally, this
158
- /// means that the main source of unsafe behavior is to hold a jsi object
159
- /// in a non-Runtime-managed object, and not clean it up before the Runtime
160
- /// is shut down. If your lifecycle is such that avoiding this is hard,
161
- /// you will probably need to do use your own locks.
162
- class JSI_EXPORT Runtime {
163
- public:
164
- virtual ~Runtime();
165
-
166
- /// Evaluates the given JavaScript \c buffer. \c sourceURL is used
167
- /// to annotate the stack trace if there is an exception. The
168
- /// contents may be utf8-encoded JS source code, or binary bytecode
169
- /// whose format is specific to the implementation. If the input
170
- /// format is unknown, or evaluation causes an error, a JSIException
171
- /// will be thrown.
172
- /// Note this function should ONLY be used when there isn't another means
173
- /// through the JSI API. For example, it will be much slower to use this to
174
- /// call a global function than using the JSI APIs to read the function
175
- /// property from the global object and then calling it explicitly.
176
- virtual Value evaluateJavaScript(
177
- const std::shared_ptr<const Buffer>& buffer,
178
- const std::string& sourceURL) = 0;
179
-
180
- /// Prepares to evaluate the given JavaScript \c buffer by processing it into
181
- /// a form optimized for execution. This may include pre-parsing, compiling,
182
- /// etc. If the input is invalid (for example, cannot be parsed), a
183
- /// JSIException will be thrown. The resulting object is tied to the
184
- /// particular concrete type of Runtime from which it was created. It may be
185
- /// used (via evaluatePreparedJavaScript) in any Runtime of the same concrete
186
- /// type.
187
- /// The PreparedJavaScript object may be passed to multiple VM instances, so
188
- /// they can all share and benefit from the prepared script.
189
- /// As with evaluateJavaScript(), using JavaScript code should be avoided
190
- /// when the JSI API is sufficient.
191
- virtual std::shared_ptr<const PreparedJavaScript> prepareJavaScript(
192
- const std::shared_ptr<const Buffer>& buffer,
193
- std::string sourceURL) = 0;
194
-
195
- /// Evaluates a PreparedJavaScript. If evaluation causes an error, a
196
- /// JSIException will be thrown.
197
- /// As with evaluateJavaScript(), using JavaScript code should be avoided
198
- /// when the JSI API is sufficient.
199
- virtual Value evaluatePreparedJavaScript(
200
- const std::shared_ptr<const PreparedJavaScript>& js) = 0;
201
-
202
- /// Drain the JavaScript VM internal Microtask (a.k.a. Job in ECMA262) queue.
203
- ///
204
- /// \param maxMicrotasksHint a hint to tell an implementation that it should
205
- /// make a best effort not execute more than the given number. It's default
206
- /// to -1 for infinity (unbounded execution).
207
- /// \return true if the queue is drained or false if there is more work to do.
208
- ///
209
- /// When there were exceptions thrown from the execution of microtasks,
210
- /// implementations shall discard the exceptional jobs. An implementation may
211
- /// \throw a \c JSError object to signal the hosts to handle. In that case, an
212
- /// implementation may or may not suspend the draining.
213
- ///
214
- /// Hosts may call this function again to resume the draining if it was
215
- /// suspended due to either exceptions or the \p maxMicrotasksHint bound.
216
- /// E.g. a host may repetitively invoke this function until the queue is
217
- /// drained to implement the "microtask checkpoint" defined in WHATWG HTML
218
- /// event loop: https://html.spec.whatwg.org/C#perform-a-microtask-checkpoint.
219
- ///
220
- /// Note that error propagation is only a concern if a host needs to implement
221
- /// `queueMicrotask`, a recent API that allows enqueueing arbitrary functions
222
- /// (hence may throw) as microtasks. Exceptions from ECMA-262 Promise Jobs are
223
- /// handled internally to VMs and are never propagated to hosts.
224
- ///
225
- /// This API offers some queue management to hosts at its best effort due to
226
- /// different behaviors and limitations imposed by different VMs and APIs. By
227
- /// the time this is written, An implementation may swallow exceptions (JSC),
228
- /// may not pause (V8), and may not support bounded executions.
229
- virtual bool drainMicrotasks(int maxMicrotasksHint = -1) = 0;
230
-
231
- /// \return the global object
232
- virtual Object global() = 0;
233
-
234
- /// \return a short printable description of the instance. It should
235
- /// at least include some human-readable indication of the runtime
236
- /// implementation. This should only be used by logging, debugging,
237
- /// and other developer-facing callers.
238
- virtual std::string description() = 0;
239
-
240
- /// \return whether or not the underlying runtime supports debugging via the
241
- /// Chrome remote debugging protocol.
242
- ///
243
- /// NOTE: the API for determining whether a runtime is debuggable and
244
- /// registering a runtime with the debugger is still in flux, so please don't
245
- /// use this API unless you know what you're doing.
246
- virtual bool isInspectable() = 0;
247
-
248
- /// \return an interface to extract metrics from this \c Runtime. The default
249
- /// implementation of this function returns an \c Instrumentation instance
250
- /// which returns no metrics.
251
- virtual Instrumentation& instrumentation();
252
-
253
- protected:
254
- friend class Pointer;
255
- friend class PropNameID;
256
- friend class Symbol;
257
- friend class BigInt;
258
- friend class String;
259
- friend class Object;
260
- friend class WeakObject;
261
- friend class Array;
262
- friend class ArrayBuffer;
263
- friend class Function;
264
- friend class Value;
265
- friend class Scope;
266
- friend class JSError;
267
- friend class TypedArray;
268
-
269
-
270
- // Potential optimization: avoid the cloneFoo() virtual dispatch,
271
- // and instead just fix the number of fields, and copy them, since
272
- // in practice they are trivially copyable. Sufficient use of
273
- // rvalue arguments/methods would also reduce the number of clones.
274
-
275
- struct PointerValue {
276
- virtual void invalidate() = 0;
277
-
278
- protected:
279
- virtual ~PointerValue() = default;
280
- };
281
-
282
- virtual PointerValue* cloneSymbol(const Runtime::PointerValue* pv) = 0;
283
- virtual PointerValue* cloneBigInt(const Runtime::PointerValue* pv) = 0;
284
- virtual PointerValue* cloneString(const Runtime::PointerValue* pv) = 0;
285
- virtual PointerValue* cloneObject(const Runtime::PointerValue* pv) = 0;
286
- virtual PointerValue* clonePropNameID(const Runtime::PointerValue* pv) = 0;
287
-
288
- virtual PropNameID createPropNameIDFromAscii(
289
- const char* str,
290
- size_t length) = 0;
291
- virtual PropNameID createPropNameIDFromUtf8(
292
- const uint8_t* utf8,
293
- size_t length) = 0;
294
- virtual PropNameID createPropNameIDFromString(const String& str) = 0;
295
- virtual PropNameID createPropNameIDFromSymbol(const Symbol& sym) = 0;
296
- virtual std::string utf8(const PropNameID&) = 0;
297
- virtual bool compare(const PropNameID&, const PropNameID&) = 0;
298
-
299
- virtual std::string symbolToString(const Symbol&) = 0;
300
-
301
- virtual String createStringFromAscii(const char* str, size_t length) = 0;
302
- virtual String createStringFromUtf8(const uint8_t* utf8, size_t length) = 0;
303
- virtual std::string utf8(const String&) = 0;
304
-
305
- // \return a \c Value created from a utf8-encoded JSON string. The default
306
- // implementation creates a \c String and invokes JSON.parse.
307
- virtual Value createValueFromJsonUtf8(const uint8_t* json, size_t length);
308
-
309
- virtual Object createObject() = 0;
310
- virtual Object createObject(std::shared_ptr<HostObject> ho) = 0;
311
- virtual std::shared_ptr<HostObject> getHostObject(const jsi::Object&) = 0;
312
- virtual HostFunctionType& getHostFunction(const jsi::Function&) = 0;
313
-
314
- virtual Value getProperty(const Object&, const PropNameID& name) = 0;
315
- virtual Value getProperty(const Object&, const String& name) = 0;
316
- virtual bool hasProperty(const Object&, const PropNameID& name) = 0;
317
- virtual bool hasProperty(const Object&, const String& name) = 0;
318
- virtual void
319
- setPropertyValue(Object&, const PropNameID& name, const Value& value) = 0;
320
- virtual void
321
- setPropertyValue(Object&, const String& name, const Value& value) = 0;
322
-
323
- virtual bool isArray(const Object&) const = 0;
324
- virtual bool isArrayBuffer(const Object&) const = 0;
325
- virtual bool isArrayBufferView(const Object&) const = 0;
326
- virtual bool isTypedArray(const Object&) const = 0;
327
- virtual bool isInt8Array(const Object&) const = 0;
328
- virtual bool isUint8Array(const Object&) const = 0;
329
- virtual bool isUint8ClampedArray(const Object&) const = 0;
330
- virtual bool isInt16Array(const Object&) const = 0;
331
- virtual bool isUint16Array(const Object&) const = 0;
332
- virtual bool isInt32Array(const Object&) const = 0;
333
- virtual bool isUint32Array(const Object&) const = 0;
334
- virtual bool isFloat32Array(const Object&) const = 0;
335
- virtual bool isBigInt64Array(const Object&) const = 0;
336
- virtual bool isBigUint64Array(const Object&) const = 0;
337
- virtual bool isFloat64Array(const Object&) const = 0;
338
- virtual bool isFunction(const Object&) const = 0;
339
- virtual bool isHostObject(const jsi::Object&) const = 0;
340
- virtual bool isHostFunction(const jsi::Function&) const = 0;
341
- virtual Array getPropertyNames(const Object&) = 0;
342
-
343
- virtual WeakObject createWeakObject(const Object&) = 0;
344
- virtual Value lockWeakObject(WeakObject&) = 0;
345
-
346
- virtual uint64_t uint64Value(const BigInt&, bool *lossless) const = 0;
347
- virtual int64_t int64Value(const BigInt&, bool *lossless) const = 0;
348
-
349
-
350
- virtual Array createArray(size_t length) = 0;
351
- virtual ArrayBuffer createArrayBuffer(
352
- std::shared_ptr<MutableBuffer> buffer) = 0;
353
- virtual size_t size(const Array&) = 0;
354
- virtual size_t size(const ArrayBuffer&) = 0;
355
- virtual size_t size(const TypedArray&) = 0;
356
- virtual uint8_t* data(const ArrayBuffer&) = 0;
357
- virtual uint8_t* data(const TypedArray&) = 0;
358
- virtual size_t offset(const TypedArray&) = 0;
359
- virtual Value getValueAtIndex(const Array&, size_t i) = 0;
360
- virtual void setValueAtIndexImpl(Array&, size_t i, const Value& value) = 0;
361
-
362
- virtual Function createFunctionFromHostFunction(
363
- const PropNameID& name,
364
- unsigned int paramCount,
365
- HostFunctionType func) = 0;
366
- virtual Value call(
367
- const Function&,
368
- const Value& jsThis,
369
- const Value* args,
370
- size_t count) = 0;
371
- virtual Value
372
- callAsConstructor(const Function&, const Value* args, size_t count) = 0;
373
-
374
- // Private data for managing scopes.
375
- struct ScopeState;
376
- virtual ScopeState* pushScope();
377
- virtual void popScope(ScopeState*);
378
-
379
- virtual bool strictEquals(const Symbol& a, const Symbol& b) const = 0;
380
- virtual bool strictEquals(const BigInt& a, const BigInt& b) const = 0;
381
- virtual bool strictEquals(const String& a, const String& b) const = 0;
382
- virtual bool strictEquals(const Object& a, const Object& b) const = 0;
383
-
384
- virtual bool instanceOf(const Object& o, const Function& f) = 0;
385
-
386
- // These exist so derived classes can access the private parts of
387
- // Value, Symbol, String, and Object, which are all friends of Runtime.
388
- template <typename T>
389
- static T make(PointerValue* pv);
390
- static PointerValue* getPointerValue(Pointer& pointer);
391
- static const PointerValue* getPointerValue(const Pointer& pointer);
392
- static const PointerValue* getPointerValue(const Value& value);
393
-
394
- friend class ::FBJSRuntime;
395
- template <typename Plain, typename Base>
396
- friend class RuntimeDecorator;
397
- };
398
-
399
- // Base class for pointer-storing types.
400
- class JSI_EXPORT Pointer {
401
- protected:
402
- explicit Pointer(Pointer&& other) : ptr_(other.ptr_) {
403
- other.ptr_ = nullptr;
404
- }
405
-
406
- ~Pointer() {
407
- if (ptr_) {
408
- ptr_->invalidate();
409
- }
410
- }
411
-
412
- Pointer& operator=(Pointer&& other);
413
-
414
- friend class Runtime;
415
- friend class Value;
416
-
417
- explicit Pointer(Runtime::PointerValue* ptr) : ptr_(ptr) {}
418
-
419
- typename Runtime::PointerValue* ptr_;
420
- };
421
-
422
- /// Represents something that can be a JS property key. Movable, not copyable.
423
- class JSI_EXPORT PropNameID : public Pointer {
424
- public:
425
- using Pointer::Pointer;
426
-
427
- PropNameID(Runtime& runtime, const PropNameID& other)
428
- : Pointer(runtime.clonePropNameID(other.ptr_)) {}
429
-
430
- PropNameID(PropNameID&& other) = default;
431
- PropNameID& operator=(PropNameID&& other) = default;
432
-
433
- /// Create a JS property name id from ascii values. The data is
434
- /// copied.
435
- static PropNameID forAscii(Runtime& runtime, const char* str, size_t length) {
436
- return runtime.createPropNameIDFromAscii(str, length);
437
- }
438
-
439
- /// Create a property name id from a nul-terminated C ascii name. The data is
440
- /// copied.
441
- static PropNameID forAscii(Runtime& runtime, const char* str) {
442
- return forAscii(runtime, str, strlen(str));
443
- }
444
-
445
- /// Create a PropNameID from a C++ string. The string is copied.
446
- static PropNameID forAscii(Runtime& runtime, const std::string& str) {
447
- return forAscii(runtime, str.c_str(), str.size());
448
- }
449
-
450
- /// Create a PropNameID from utf8 values. The data is copied.
451
- /// Results are undefined if \p utf8 contains invalid code points.
452
- static PropNameID
453
- forUtf8(Runtime& runtime, const uint8_t* utf8, size_t length) {
454
- return runtime.createPropNameIDFromUtf8(utf8, length);
455
- }
456
-
457
- /// Create a PropNameID from utf8-encoded octets stored in a
458
- /// std::string. The string data is transformed and copied.
459
- /// Results are undefined if \p utf8 contains invalid code points.
460
- static PropNameID forUtf8(Runtime& runtime, const std::string& utf8) {
461
- return runtime.createPropNameIDFromUtf8(
462
- reinterpret_cast<const uint8_t*>(utf8.data()), utf8.size());
463
- }
464
-
465
- /// Create a PropNameID from a JS string.
466
- static PropNameID forString(Runtime& runtime, const jsi::String& str) {
467
- return runtime.createPropNameIDFromString(str);
468
- }
469
-
470
- /// Create a PropNameID from a JS symbol.
471
- static PropNameID forSymbol(Runtime& runtime, const jsi::Symbol& sym) {
472
- return runtime.createPropNameIDFromSymbol(sym);
473
- }
474
-
475
- // Creates a vector of PropNameIDs constructed from given arguments.
476
- template <typename... Args>
477
- static std::vector<PropNameID> names(Runtime& runtime, Args&&... args);
478
-
479
- // Creates a vector of given PropNameIDs.
480
- template <size_t N>
481
- static std::vector<PropNameID> names(PropNameID(&&propertyNames)[N]);
482
-
483
- /// Copies the data in a PropNameID as utf8 into a C++ string.
484
- std::string utf8(Runtime& runtime) const {
485
- return runtime.utf8(*this);
486
- }
487
-
488
- static bool compare(
489
- Runtime& runtime,
490
- const jsi::PropNameID& a,
491
- const jsi::PropNameID& b) {
492
- return runtime.compare(a, b);
493
- }
494
-
495
- friend class Runtime;
496
- friend class Value;
497
- };
498
-
499
- /// Represents a JS Symbol (es6). Movable, not copyable.
500
- /// TODO T40778724: this is a limited implementation sufficient for
501
- /// the debugger not to crash when a Symbol is a property in an Object
502
- /// or element in an array. Complete support for creating will come
503
- /// later.
504
- class JSI_EXPORT Symbol : public Pointer {
505
- public:
506
- using Pointer::Pointer;
507
-
508
- Symbol(Symbol&& other) = default;
509
- Symbol& operator=(Symbol&& other) = default;
510
-
511
- /// \return whether a and b refer to the same symbol.
512
- static bool strictEquals(Runtime& runtime, const Symbol& a, const Symbol& b) {
513
- return runtime.strictEquals(a, b);
514
- }
515
-
516
- /// Converts a Symbol into a C++ string as JS .toString would. The output
517
- /// will look like \c Symbol(description) .
518
- std::string toString(Runtime& runtime) const {
519
- return runtime.symbolToString(*this);
520
- }
521
-
522
- friend class Runtime;
523
- friend class Value;
524
- };
525
-
526
- /// Represents a JS BigInt. Movable, not copyable.
527
- class JSI_EXPORT BigInt : public Pointer {
528
- public:
529
- using Pointer::Pointer;
530
-
531
- BigInt(BigInt&& other) = default;
532
- BigInt& operator=(BigInt&& other) = default;
533
-
534
-
535
- /**
536
- * Returns the value of this BigInt as an unsigned 64-bit integer.
537
- * If `lossless` is provided, it will reflect whether the return value was
538
- * truncated or wrapped around. In particular, it is set to `false` if this
539
- * BigInt is negative.
540
- */
541
- uint64_t Uint64Value(Runtime& runtime, bool* lossless = nullptr) const {
542
- return runtime.uint64Value(*this, lossless);
543
- }
544
-
545
- /**
546
- * Returns the value of this BigInt as a signed 64-bit integer.
547
- * If `lossless` is provided, it will reflect whether this BigInt was
548
- * truncated or not.
549
- */
550
- int64_t Int64Value(Runtime& runtime, bool* lossless = nullptr) const {
551
- return runtime.int64Value(*this, lossless);
552
- }
553
-
554
- friend class Runtime;
555
- friend class Value;
556
- };
557
-
558
- /// Represents a JS String. Movable, not copyable.
559
- class JSI_EXPORT String : public Pointer {
560
- public:
561
- using Pointer::Pointer;
562
-
563
- String(String&& other) = default;
564
- String& operator=(String&& other) = default;
565
-
566
- /// Create a JS string from ascii values. The string data is
567
- /// copied.
568
- static String
569
- createFromAscii(Runtime& runtime, const char* str, size_t length) {
570
- return runtime.createStringFromAscii(str, length);
571
- }
572
-
573
- /// Create a JS string from a nul-terminated C ascii string. The
574
- /// string data is copied.
575
- static String createFromAscii(Runtime& runtime, const char* str) {
576
- return createFromAscii(runtime, str, strlen(str));
577
- }
578
-
579
- /// Create a JS string from a C++ string. The string data is
580
- /// copied.
581
- static String createFromAscii(Runtime& runtime, const std::string& str) {
582
- return createFromAscii(runtime, str.c_str(), str.size());
583
- }
584
-
585
- /// Create a JS string from utf8-encoded octets. The string data is
586
- /// transformed and copied. Results are undefined if \p utf8 contains invalid
587
- /// code points.
588
- static String
589
- createFromUtf8(Runtime& runtime, const uint8_t* utf8, size_t length) {
590
- return runtime.createStringFromUtf8(utf8, length);
591
- }
592
-
593
- /// Create a JS string from utf8-encoded octets stored in a
594
- /// std::string. The string data is transformed and copied. Results are
595
- /// undefined if \p utf8 contains invalid code points.
596
- static String createFromUtf8(Runtime& runtime, const std::string& utf8) {
597
- return runtime.createStringFromUtf8(
598
- reinterpret_cast<const uint8_t*>(utf8.data()), utf8.length());
599
- }
600
-
601
- /// \return whether a and b contain the same characters.
602
- static bool strictEquals(Runtime& runtime, const String& a, const String& b) {
603
- return runtime.strictEquals(a, b);
604
- }
605
-
606
- /// Copies the data in a JS string as utf8 into a C++ string.
607
- std::string utf8(Runtime& runtime) const {
608
- return runtime.utf8(*this);
609
- }
610
-
611
- friend class Runtime;
612
- friend class Value;
613
- };
614
-
615
- class Array;
616
- class Function;
617
-
618
- /// Represents a JS Object. Movable, not copyable.
619
- class JSI_EXPORT Object : public Pointer {
620
- public:
621
- using Pointer::Pointer;
622
-
623
- Object(Object&& other) = default;
624
- Object& operator=(Object&& other) = default;
625
-
626
- /// Creates a new Object instance, like '{}' in JS.
627
- Object(Runtime& runtime) : Object(runtime.createObject()) {}
628
-
629
- static Object createFromHostObject(
630
- Runtime& runtime,
631
- std::shared_ptr<HostObject> ho) {
632
- return runtime.createObject(ho);
633
- }
634
-
635
- /// \return whether this and \c obj are the same JSObject or not.
636
- static bool strictEquals(Runtime& runtime, const Object& a, const Object& b) {
637
- return runtime.strictEquals(a, b);
638
- }
639
-
640
- /// \return the result of `this instanceOf ctor` in JS.
641
- bool instanceOf(Runtime& rt, const Function& ctor) {
642
- return rt.instanceOf(*this, ctor);
643
- }
644
-
645
- /// \return the property of the object with the given ascii name.
646
- /// If the name isn't a property on the object, returns the
647
- /// undefined value.
648
- Value getProperty(Runtime& runtime, const char* name) const;
649
-
650
- /// \return the property of the object with the String name.
651
- /// If the name isn't a property on the object, returns the
652
- /// undefined value.
653
- Value getProperty(Runtime& runtime, const String& name) const;
654
-
655
- /// \return the property of the object with the given JS PropNameID
656
- /// name. If the name isn't a property on the object, returns the
657
- /// undefined value.
658
- Value getProperty(Runtime& runtime, const PropNameID& name) const;
659
-
660
- /// \return true if and only if the object has a property with the
661
- /// given ascii name.
662
- bool hasProperty(Runtime& runtime, const char* name) const;
663
-
664
- /// \return true if and only if the object has a property with the
665
- /// given String name.
666
- bool hasProperty(Runtime& runtime, const String& name) const;
667
-
668
- /// \return true if and only if the object has a property with the
669
- /// given PropNameID name.
670
- bool hasProperty(Runtime& runtime, const PropNameID& name) const;
671
-
672
- /// Sets the property value from a Value or anything which can be
673
- /// used to make one: nullptr_t, bool, double, int, const char*,
674
- /// String, or Object.
675
- template <typename T>
676
- void setProperty(Runtime& runtime, const char* name, T&& value);
677
-
678
- /// Sets the property value from a Value or anything which can be
679
- /// used to make one: nullptr_t, bool, double, int, const char*,
680
- /// String, or Object.
681
- template <typename T>
682
- void setProperty(Runtime& runtime, const String& name, T&& value);
683
-
684
- /// Sets the property value from a Value or anything which can be
685
- /// used to make one: nullptr_t, bool, double, int, const char*,
686
- /// String, or Object.
687
- template <typename T>
688
- void setProperty(Runtime& runtime, const PropNameID& name, T&& value);
689
-
690
- /// \return true iff JS \c Array.isArray() would return \c true. If
691
- /// so, then \c getArray() will succeed.
692
- bool isArray(Runtime& runtime) const {
693
- return runtime.isArray(*this);
694
- }
695
-
696
- /// \return true iff the Object is an ArrayBuffer. If so, then \c
697
- /// getArrayBuffer() will succeed.
698
- bool isArrayBuffer(Runtime& runtime) const {
699
- return runtime.isArrayBuffer(*this);
700
- }
701
-
702
-
703
- /// \return true iff the Object is an isArrayBufferView. If so, then \c
704
- /// getArrayBuffer() will succeed.
705
- bool isArrayBufferView(Runtime& runtime) const {
706
- return runtime.isArrayBufferView(*this);
707
- }
708
-
709
- /// \return true iff the Object is an isTypedArray. If so, then \c
710
- /// getArrayBuffer() will succeed.
711
- bool isTypedArray(Runtime& runtime) const {
712
- return runtime.isTypedArray(*this);
713
- }
714
-
715
-
716
- /// \return true iff the Object is an isInt8Array. If so, then \c
717
- /// getArrayBuffer() will succeed.
718
- bool isInt8Array(Runtime& runtime) const {
719
- return runtime.isInt8Array(*this);
720
- }
721
-
722
- /// \return true iff the Object is an isUint8Array. If so, then \c
723
- /// getArrayBuffer() will succeed.
724
- bool isUint8Array(Runtime& runtime) const {
725
- return runtime.isUint8Array(*this);
726
- }
727
-
728
- /// \return true iff the Object is an isUint8ClampedArray. If so, then \c
729
- /// getArrayBuffer() will succeed.
730
- bool isUint8ClampedArray(Runtime& runtime) const {
731
- return runtime.isUint8ClampedArray(*this);
732
- }
733
-
734
- /// \return true iff the Object is an isInt16Array. If so, then \c
735
- /// getArrayBuffer() will succeed.
736
- bool isInt16Array(Runtime& runtime) const {
737
- return runtime.isInt16Array(*this);
738
- }
739
-
740
- /// \return true iff the Object is an isUint16Array. If so, then \c
741
- /// getArrayBuffer() will succeed.
742
- bool isUint16Array(Runtime& runtime) const {
743
- return runtime.isUint16Array(*this);
744
- }
745
-
746
- /// \return true iff the Object is an isInt32Array. If so, then \c
747
- /// getArrayBuffer() will succeed.
748
- bool isInt32Array(Runtime& runtime) const {
749
- return runtime.isInt32Array(*this);
750
- }
751
-
752
- /// \return true iff the Object is an isUint32Array. If so, then \c
753
- /// getArrayBuffer() will succeed.
754
- bool isUint32Array(Runtime& runtime) const {
755
- return runtime.isUint32Array(*this);
756
- }
757
-
758
- /// \return true iff the Object is an isFloat32Array. If so, then \c
759
- /// getArrayBuffer() will succeed.
760
- bool isFloat32Array(Runtime& runtime) const {
761
- return runtime.isFloat32Array(*this);
762
- }
763
-
764
- /// \return true iff the Object is an isBigInt64Array. If so, then \c
765
- /// getArrayBuffer() will succeed.
766
- bool isBigInt64Array(Runtime& runtime) const {
767
- return runtime.isBigInt64Array(*this);
768
- }
769
-
770
- /// \return true iff the Object is an isBigUint64Array. If so, then \c
771
- /// getArrayBuffer() will succeed.
772
- bool isBigUint64Array(Runtime& runtime) const {
773
- return runtime.isBigUint64Array(*this);
774
- }
775
-
776
- /// \return true iff the Object is an isFloat64Array. If so, then \c
777
- /// getArrayBuffer() will succeed.
778
- bool isFloat64Array(Runtime& runtime) const {
779
- return runtime.isFloat64Array(*this);
780
- }
781
-
782
- /// \return true iff the Object is callable. If so, then \c
783
- /// getFunction will succeed.
784
- bool isFunction(Runtime& runtime) const {
785
- return runtime.isFunction(*this);
786
- }
787
-
788
- /// \return true iff the Object was initialized with \c createFromHostObject
789
- /// and the HostObject passed is of type \c T. If returns \c true then
790
- /// \c getHostObject<T> will succeed.
791
- template <typename T = HostObject>
792
- bool isHostObject(Runtime& runtime) const;
793
-
794
- /// \return an Array instance which refers to the same underlying
795
- /// object. If \c isArray() would return false, this will assert.
796
- Array getArray(Runtime& runtime) const&;
797
-
798
- /// \return an Array instance which refers to the same underlying
799
- /// object. If \c isArray() would return false, this will assert.
800
- Array getArray(Runtime& runtime) &&;
801
-
802
- /// \return an Array instance which refers to the same underlying
803
- /// object. If \c isArray() would return false, this will throw
804
- /// JSIException.
805
- Array asArray(Runtime& runtime) const&;
806
-
807
- /// \return an Array instance which refers to the same underlying
808
- /// object. If \c isArray() would return false, this will throw
809
- /// JSIException.
810
- Array asArray(Runtime& runtime) &&;
811
-
812
- /// \return an ArrayBuffer instance which refers to the same underlying
813
- /// object. If \c isArrayBuffer() would return false, this will assert.
814
- ArrayBuffer getArrayBuffer(Runtime& runtime) const&;
815
-
816
- /// \return an ArrayBuffer instance which refers to the same underlying
817
- /// object. If \c isArrayBuffer() would return false, this will assert.
818
- ArrayBuffer getArrayBuffer(Runtime& runtime) &&;
819
-
820
-
821
- /// \return an TypedArray instance which refers to the same underlying
822
- /// object. If \c isTypedArray() would return false, this will assert.
823
- TypedArray getTypedArray(Runtime& runtime) const&;
824
-
825
- /// \return an TypedArray instance which refers to the same underlying
826
- /// object. If \c isTypedArray() would return false, this will assert.
827
- TypedArray getTypedArray(Runtime& runtime) &&;
828
-
829
-
830
- /// \return a Function instance which refers to the same underlying
831
- /// object. If \c isFunction() would return false, this will assert.
832
- Function getFunction(Runtime& runtime) const&;
833
-
834
- /// \return a Function instance which refers to the same underlying
835
- /// object. If \c isFunction() would return false, this will assert.
836
- Function getFunction(Runtime& runtime) &&;
837
-
838
- /// \return a Function instance which refers to the same underlying
839
- /// object. If \c isFunction() would return false, this will throw
840
- /// JSIException.
841
- Function asFunction(Runtime& runtime) const&;
842
-
843
- /// \return a Function instance which refers to the same underlying
844
- /// object. If \c isFunction() would return false, this will throw
845
- /// JSIException.
846
- Function asFunction(Runtime& runtime) &&;
847
-
848
- /// \return a shared_ptr<T> which refers to the same underlying
849
- /// \c HostObject that was used to create this object. If \c isHostObject<T>
850
- /// is false, this will assert. Note that this does a type check and will
851
- /// assert if the underlying HostObject isn't of type \c T
852
- template <typename T = HostObject>
853
- std::shared_ptr<T> getHostObject(Runtime& runtime) const;
854
-
855
- /// \return a shared_ptr<T> which refers to the same underlying
856
- /// \c HostObject that was used to create this object. If \c isHostObject<T>
857
- /// is false, this will throw.
858
- template <typename T = HostObject>
859
- std::shared_ptr<T> asHostObject(Runtime& runtime) const;
860
-
861
- /// \return same as \c getProperty(name).asObject(), except with
862
- /// a better exception message.
863
- Object getPropertyAsObject(Runtime& runtime, const char* name) const;
864
-
865
- /// \return similar to \c
866
- /// getProperty(name).getObject().getFunction(), except it will
867
- /// throw JSIException instead of asserting if the property is
868
- /// not an object, or the object is not callable.
869
- Function getPropertyAsFunction(Runtime& runtime, const char* name) const;
870
-
871
- /// \return an Array consisting of all enumerable property names in
872
- /// the object and its prototype chain. All values in the return
873
- /// will be isString(). (This is probably not optimal, but it
874
- /// works. I only need it in one place.)
875
- Array getPropertyNames(Runtime& runtime) const;
876
-
877
- protected:
878
- void
879
- setPropertyValue(Runtime& runtime, const String& name, const Value& value) {
880
- return runtime.setPropertyValue(*this, name, value);
881
- }
882
-
883
- void setPropertyValue(
884
- Runtime& runtime,
885
- const PropNameID& name,
886
- const Value& value) {
887
- return runtime.setPropertyValue(*this, name, value);
888
- }
889
-
890
- friend class Runtime;
891
- friend class Value;
892
- };
893
-
894
- /// Represents a weak reference to a JS Object. If the only reference
895
- /// to an Object are these, the object is eligible for GC. Method
896
- /// names are inspired by C++ weak_ptr. Movable, not copyable.
897
- class JSI_EXPORT WeakObject : public Pointer {
898
- public:
899
- using Pointer::Pointer;
900
-
901
- WeakObject(WeakObject&& other) = default;
902
- WeakObject& operator=(WeakObject&& other) = default;
903
-
904
- /// Create a WeakObject from an Object.
905
- WeakObject(Runtime& runtime, const Object& o)
906
- : WeakObject(runtime.createWeakObject(o)) {}
907
-
908
- /// \return a Value representing the underlying Object if it is still valid;
909
- /// otherwise returns \c undefined. Note that this method has nothing to do
910
- /// with threads or concurrency. The name is based on std::weak_ptr::lock()
911
- /// which serves a similar purpose.
912
- Value lock(Runtime& runtime);
913
-
914
- friend class Runtime;
915
- };
916
-
917
- /// Represents a JS Object which can be efficiently used as an array
918
- /// with integral indices.
919
- class JSI_EXPORT Array : public Object {
920
- public:
921
- Array(Array&&) = default;
922
- /// Creates a new Array instance, with \c length undefined elements.
923
- Array(Runtime& runtime, size_t length) : Array(runtime.createArray(length)) {}
924
-
925
- Array& operator=(Array&&) = default;
926
-
927
- /// \return the size of the Array, according to its length property.
928
- /// (C++ naming convention)
929
- size_t size(Runtime& runtime) const {
930
- return runtime.size(*this);
931
- }
932
-
933
- /// \return the size of the Array, according to its length property.
934
- /// (JS naming convention)
935
- size_t length(Runtime& runtime) const {
936
- return size(runtime);
937
- }
938
-
939
- /// \return the property of the array at index \c i. If there is no
940
- /// such property, returns the undefined value. If \c i is out of
941
- /// range [ 0..\c length ] throws a JSIException.
942
- Value getValueAtIndex(Runtime& runtime, size_t i) const;
943
-
944
- /// Sets the property of the array at index \c i. The argument
945
- /// value behaves as with Object::setProperty(). If \c i is out of
946
- /// range [ 0..\c length ] throws a JSIException.
947
- template <typename T>
948
- void setValueAtIndex(Runtime& runtime, size_t i, T&& value);
949
-
950
- /// There is no current API for changing the size of an array once
951
- /// created. We'll probably need that eventually.
952
-
953
- /// Creates a new Array instance from provided values
954
- template <typename... Args>
955
- static Array createWithElements(Runtime&, Args&&... args);
956
-
957
- /// Creates a new Array instance from initializer list.
958
- static Array createWithElements(
959
- Runtime& runtime,
960
- std::initializer_list<Value> elements);
961
-
962
- private:
963
- friend class Object;
964
- friend class Value;
965
-
966
- void setValueAtIndexImpl(Runtime& runtime, size_t i, const Value& value) {
967
- return runtime.setValueAtIndexImpl(*this, i, value);
968
- }
969
-
970
- Array(Runtime::PointerValue* value) : Object(value) {}
971
- };
972
-
973
- /// Represents a JSArrayBuffer
974
- class JSI_EXPORT ArrayBuffer : public Object {
975
- public:
976
- ArrayBuffer(ArrayBuffer&&) = default;
977
- ArrayBuffer& operator=(ArrayBuffer&&) = default;
978
- ArrayBuffer(Runtime& runtime, std::shared_ptr<MutableBuffer> buffer)
979
- : ArrayBuffer(runtime.createArrayBuffer(std::move(buffer))) {}
980
-
981
- /// \return the size of the ArrayBuffer, according to its byteLength property.
982
- /// (C++ naming convention)
983
- size_t size(Runtime& runtime) const {
984
- return runtime.size(*this);
985
- }
986
-
987
- size_t length(Runtime& runtime) const {
988
- return runtime.size(*this);
989
- }
990
-
991
- uint8_t* data(Runtime& runtime) {
992
- return runtime.data(*this);
993
- }
994
-
995
- private:
996
- friend class Object;
997
- friend class Value;
998
-
999
- ArrayBuffer(Runtime::PointerValue* value) : Object(value) {}
1000
- };
1001
-
1002
-
1003
- /// Represents a TypedArray
1004
- class JSI_EXPORT TypedArray : public Object {
1005
- public:
1006
- TypedArray(TypedArray &&) = default;
1007
-
1008
- TypedArray &operator=(TypedArray &&) = default;
1009
-
1010
- /// \return the size of the TypedArray ArrayBuffer, according to its byteLength property.
1011
- /// (C++ naming convention)
1012
- size_t size(Runtime &runtime) {
1013
- return runtime.size(*this);
1014
- }
1015
-
1016
- size_t offset(Runtime &runtime) const {
1017
- return runtime.offset(*this);
1018
- }
1019
-
1020
- size_t length(Runtime &runtime) const {
1021
- return runtime.size(*this);
1022
- }
1023
-
1024
- uint8_t *data(Runtime &runtime) {
1025
- return runtime.data(*this);
1026
- }
1027
-
1028
- private:
1029
- friend class Object;
1030
-
1031
- friend class Value;
1032
-
1033
- TypedArray(Runtime::PointerValue *value) : Object(value) {}
1034
- };
1035
-
1036
-
1037
- /// Represents a JS Object which is guaranteed to be Callable.
1038
- class JSI_EXPORT Function : public Object {
1039
- public:
1040
- Function(Function&&) = default;
1041
- Function& operator=(Function&&) = default;
1042
-
1043
- /// Create a function which, when invoked, calls C++ code. If the
1044
- /// function throws an exception, a JS Error will be created and
1045
- /// thrown.
1046
- /// \param name the name property for the function.
1047
- /// \param paramCount the length property for the function, which
1048
- /// may not be the number of arguments the function is passed.
1049
- static Function createFromHostFunction(
1050
- Runtime& runtime,
1051
- const jsi::PropNameID& name,
1052
- unsigned int paramCount,
1053
- jsi::HostFunctionType func);
1054
-
1055
- /// Calls the function with \c count \c args. The \c this value of the JS
1056
- /// function will not be set by the C++ caller, similar to calling
1057
- /// Function.prototype.apply(undefined, args) in JS.
1058
- /// \b Note: as with Function.prototype.apply, \c this may not always be
1059
- /// \c undefined in the function itself. If the function is non-strict,
1060
- /// \c this will be set to the global object.
1061
- Value call(Runtime& runtime, const Value* args, size_t count) const;
1062
-
1063
- /// Calls the function with a \c std::initializer_list of Value
1064
- /// arguments. The \c this value of the JS function will not be set by the
1065
- /// C++ caller, similar to calling Function.prototype.apply(undefined, args)
1066
- /// in JS.
1067
- /// \b Note: as with Function.prototype.apply, \c this may not always be
1068
- /// \c undefined in the function itself. If the function is non-strict,
1069
- /// \c this will be set to the global object.
1070
- Value call(Runtime& runtime, std::initializer_list<Value> args) const;
1071
-
1072
- /// Calls the function with any number of arguments similarly to
1073
- /// Object::setProperty(). The \c this value of the JS function will not be
1074
- /// set by the C++ caller, similar to calling
1075
- /// Function.prototype.call(undefined, ...args) in JS.
1076
- /// \b Note: as with Function.prototype.call, \c this may not always be
1077
- /// \c undefined in the function itself. If the function is non-strict,
1078
- /// \c this will be set to the global object.
1079
- template <typename... Args>
1080
- Value call(Runtime& runtime, Args&&... args) const;
1081
-
1082
- /// Calls the function with \c count \c args and \c jsThis value passed
1083
- /// as the \c this value.
1084
- Value callWithThis(
1085
- Runtime& Runtime,
1086
- const Object& jsThis,
1087
- const Value* args,
1088
- size_t count) const;
1089
-
1090
- /// Calls the function with a \c std::initializer_list of Value
1091
- /// arguments and \c jsThis passed as the \c this value.
1092
- Value callWithThis(
1093
- Runtime& runtime,
1094
- const Object& jsThis,
1095
- std::initializer_list<Value> args) const;
1096
-
1097
- /// Calls the function with any number of arguments similarly to
1098
- /// Object::setProperty(), and with \c jsThis passed as the \c this value.
1099
- template <typename... Args>
1100
- Value callWithThis(Runtime& runtime, const Object& jsThis, Args&&... args)
1101
- const;
1102
-
1103
- /// Calls the function as a constructor with \c count \c args. Equivalent
1104
- /// to calling `new Func` where `Func` is the js function reqresented by
1105
- /// this.
1106
- Value callAsConstructor(Runtime& runtime, const Value* args, size_t count)
1107
- const;
1108
-
1109
- /// Same as above `callAsConstructor`, except use an initializer_list to
1110
- /// supply the arguments.
1111
- Value callAsConstructor(Runtime& runtime, std::initializer_list<Value> args)
1112
- const;
1113
-
1114
- /// Same as above `callAsConstructor`, but automatically converts/wraps
1115
- /// any argument with a jsi Value.
1116
- template <typename... Args>
1117
- Value callAsConstructor(Runtime& runtime, Args&&... args) const;
1118
-
1119
- /// Returns whether this was created with Function::createFromHostFunction.
1120
- /// If true then you can use getHostFunction to get the underlying
1121
- /// HostFunctionType.
1122
- bool isHostFunction(Runtime& runtime) const {
1123
- return runtime.isHostFunction(*this);
1124
- }
1125
-
1126
- /// Returns the underlying HostFunctionType iff isHostFunction returns true
1127
- /// and asserts otherwise. You can use this to use std::function<>::target
1128
- /// to get the object that was passed to create the HostFunctionType.
1129
- ///
1130
- /// Note: The reference returned is borrowed from the JS object underlying
1131
- /// \c this, and thus only lasts as long as the object underlying
1132
- /// \c this does.
1133
- HostFunctionType& getHostFunction(Runtime& runtime) const {
1134
- assert(isHostFunction(runtime));
1135
- return runtime.getHostFunction(*this);
1136
- }
1137
-
1138
- private:
1139
- friend class Object;
1140
- friend class Value;
1141
-
1142
- Function(Runtime::PointerValue* value) : Object(value) {}
1143
- };
1144
-
1145
- /// Represents any JS Value (undefined, null, boolean, number, symbol,
1146
- /// string, or object). Movable, or explicitly copyable (has no copy
1147
- /// ctor).
1148
- class JSI_EXPORT Value {
1149
- public:
1150
- /// Default ctor creates an \c undefined JS value.
1151
- Value() : Value(UndefinedKind) {}
1152
-
1153
- /// Creates a \c null JS value.
1154
- /* implicit */ Value(std::nullptr_t) : kind_(NullKind) {}
1155
-
1156
- /// Creates a boolean JS value.
1157
- /* implicit */ Value(bool b) : Value(BooleanKind) {
1158
- data_.boolean = b;
1159
- }
1160
-
1161
- /// Creates a number JS value.
1162
- /* implicit */ Value(double d) : Value(NumberKind) {
1163
- data_.number = d;
1164
- }
1165
-
1166
- /// Creates a number JS value.
1167
- /* implicit */ Value(int i) : Value(NumberKind) {
1168
- data_.number = i;
1169
- }
1170
-
1171
- /// Moves a Symbol, String, or Object rvalue into a new JS value.
1172
- template <typename T>
1173
- /* implicit */ Value(T&& other) : Value(kindOf(other)) {
1174
- static_assert(
1175
- std::is_base_of<Symbol, T>::value ||
1176
- std::is_base_of<BigInt, T>::value ||
1177
- std::is_base_of<String, T>::value ||
1178
- std::is_base_of<Object, T>::value,
1179
- "Value cannot be implicitly move-constructed from this type");
1180
- new (&data_.pointer) T(std::move(other));
1181
- }
1182
-
1183
- /// Value("foo") will treat foo as a bool. This makes doing that a
1184
- /// compile error.
1185
- template <typename T = void>
1186
- Value(const char*) {
1187
- static_assert(
1188
- !std::is_same<void, T>::value,
1189
- "Value cannot be constructed directly from const char*");
1190
- }
1191
-
1192
- Value(Value&& value);
1193
-
1194
- /// Copies a Symbol lvalue into a new JS value.
1195
- Value(Runtime& runtime, const Symbol& sym) : Value(SymbolKind) {
1196
- new (&data_.pointer) Symbol(runtime.cloneSymbol(sym.ptr_));
1197
- }
1198
-
1199
- /// Copies a BigInt lvalue into a new JS value.
1200
- Value(Runtime& runtime, const BigInt& bigint) : Value(BigIntKind) {
1201
- new (&data_.pointer) BigInt(runtime.cloneBigInt(bigint.ptr_));
1202
- }
1203
-
1204
- /// Copies a String lvalue into a new JS value.
1205
- Value(Runtime& runtime, const String& str) : Value(StringKind) {
1206
- new (&data_.pointer) String(runtime.cloneString(str.ptr_));
1207
- }
1208
-
1209
- /// Copies a Object lvalue into a new JS value.
1210
- Value(Runtime& runtime, const Object& obj) : Value(ObjectKind) {
1211
- new (&data_.pointer) Object(runtime.cloneObject(obj.ptr_));
1212
- }
1213
-
1214
- /// Creates a JS value from another Value lvalue.
1215
- Value(Runtime& runtime, const Value& value);
1216
-
1217
- /// Value(rt, "foo") will treat foo as a bool. This makes doing
1218
- /// that a compile error.
1219
- template <typename T = void>
1220
- Value(Runtime&, const char*) {
1221
- static_assert(
1222
- !std::is_same<T, void>::value,
1223
- "Value cannot be constructed directly from const char*");
1224
- }
1225
-
1226
- ~Value();
1227
- // \return the undefined \c Value.
1228
- static Value undefined() {
1229
- return Value();
1230
- }
1231
-
1232
- // \return the null \c Value.
1233
- static Value null() {
1234
- return Value(nullptr);
1235
- }
1236
-
1237
- // \return a \c Value created from a utf8-encoded JSON string.
1238
- static Value
1239
- createFromJsonUtf8(Runtime& runtime, const uint8_t* json, size_t length) {
1240
- return runtime.createValueFromJsonUtf8(json, length);
1241
- }
1242
-
1243
- /// \return according to the Strict Equality Comparison algorithm, see:
1244
- /// https://262.ecma-international.org/11.0/#sec-strict-equality-comparison
1245
- static bool strictEquals(Runtime& runtime, const Value& a, const Value& b);
1246
-
1247
- Value& operator=(Value&& other) {
1248
- this->~Value();
1249
- new (this) Value(std::move(other));
1250
- return *this;
1251
- }
1252
-
1253
- bool isUndefined() const {
1254
- return kind_ == UndefinedKind;
1255
- }
1256
-
1257
- bool isNull() const {
1258
- return kind_ == NullKind;
1259
- }
1260
-
1261
- bool isBool() const {
1262
- return kind_ == BooleanKind;
1263
- }
1264
-
1265
- bool isNumber() const {
1266
- return kind_ == NumberKind;
1267
- }
1268
-
1269
- bool isString() const {
1270
- return kind_ == StringKind;
1271
- }
1272
-
1273
- bool isBigInt() const {
1274
- return kind_ == BigIntKind;
1275
- }
1276
-
1277
- bool isSymbol() const {
1278
- return kind_ == SymbolKind;
1279
- }
1280
-
1281
- bool isObject() const {
1282
- return kind_ == ObjectKind;
1283
- }
1284
-
1285
- /// \return the boolean value, or asserts if not a boolean.
1286
- bool getBool() const {
1287
- assert(isBool());
1288
- return data_.boolean;
1289
- }
1290
-
1291
- /// \return the boolean value, or throws JSIException if not a
1292
- /// boolean.
1293
- bool asBool() const;
1294
-
1295
- /// \return the number value, or asserts if not a number.
1296
- double getNumber() const {
1297
- assert(isNumber());
1298
- return data_.number;
1299
- }
1300
-
1301
- /// \return the number value, or throws JSIException if not a
1302
- /// number.
1303
- double asNumber() const;
1304
-
1305
- /// \return the Symbol value, or asserts if not a symbol.
1306
- Symbol getSymbol(Runtime& runtime) const& {
1307
- assert(isSymbol());
1308
- return Symbol(runtime.cloneSymbol(data_.pointer.ptr_));
1309
- }
1310
-
1311
- /// \return the Symbol value, or asserts if not a symbol.
1312
- /// Can be used on rvalue references to avoid cloning more symbols.
1313
- Symbol getSymbol(Runtime&) && {
1314
- assert(isSymbol());
1315
- auto ptr = data_.pointer.ptr_;
1316
- data_.pointer.ptr_ = nullptr;
1317
- return static_cast<Symbol>(ptr);
1318
- }
1319
-
1320
- /// \return the Symbol value, or throws JSIException if not a
1321
- /// symbol
1322
- Symbol asSymbol(Runtime& runtime) const&;
1323
- Symbol asSymbol(Runtime& runtime) &&;
1324
-
1325
- /// \return the BigInt value, or asserts if not a bigint.
1326
- BigInt getBigInt(Runtime& runtime) const& {
1327
- assert(isBigInt());
1328
- return BigInt(runtime.cloneBigInt(data_.pointer.ptr_));
1329
- }
1330
-
1331
- /// \return the BigInt value, or asserts if not a bigint.
1332
- /// Can be used on rvalue references to avoid cloning more bigints.
1333
- BigInt getBigInt(Runtime&) && {
1334
- assert(isBigInt());
1335
- auto ptr = data_.pointer.ptr_;
1336
- data_.pointer.ptr_ = nullptr;
1337
- return static_cast<BigInt>(ptr);
1338
- }
1339
-
1340
- /// \return the BigInt value, or throws JSIException if not a
1341
- /// bigint
1342
- BigInt asBigInt(Runtime& runtime) const&;
1343
- BigInt asBigInt(Runtime& runtime) &&;
1344
-
1345
- /// \return the String value, or asserts if not a string.
1346
- String getString(Runtime& runtime) const& {
1347
- assert(isString());
1348
- return String(runtime.cloneString(data_.pointer.ptr_));
1349
- }
1350
-
1351
- /// \return the String value, or asserts if not a string.
1352
- /// Can be used on rvalue references to avoid cloning more strings.
1353
- String getString(Runtime&) && {
1354
- assert(isString());
1355
- auto ptr = data_.pointer.ptr_;
1356
- data_.pointer.ptr_ = nullptr;
1357
- return static_cast<String>(ptr);
1358
- }
1359
-
1360
- /// \return the String value, or throws JSIException if not a
1361
- /// string.
1362
- String asString(Runtime& runtime) const&;
1363
- String asString(Runtime& runtime) &&;
1364
-
1365
- /// \return the Object value, or asserts if not an object.
1366
- Object getObject(Runtime& runtime) const& {
1367
- assert(isObject());
1368
- return Object(runtime.cloneObject(data_.pointer.ptr_));
1369
- }
1370
-
1371
- /// \return the Object value, or asserts if not an object.
1372
- /// Can be used on rvalue references to avoid cloning more objects.
1373
- Object getObject(Runtime&) && {
1374
- assert(isObject());
1375
- auto ptr = data_.pointer.ptr_;
1376
- data_.pointer.ptr_ = nullptr;
1377
- return static_cast<Object>(ptr);
1378
- }
1379
-
1380
- /// \return the Object value, or throws JSIException if not an
1381
- /// object.
1382
- Object asObject(Runtime& runtime) const&;
1383
- Object asObject(Runtime& runtime) &&;
1384
-
1385
- // \return a String like JS .toString() would do.
1386
- String toString(Runtime& runtime) const;
1387
-
1388
- private:
1389
- friend class Runtime;
1390
-
1391
- enum ValueKind {
1392
- UndefinedKind,
1393
- NullKind,
1394
- BooleanKind,
1395
- NumberKind,
1396
- SymbolKind,
1397
- BigIntKind,
1398
- StringKind,
1399
- ObjectKind,
1400
- PointerKind = SymbolKind,
1401
- };
1402
-
1403
- union Data {
1404
- // Value's ctor and dtor will manage the lifecycle of the contained Data.
1405
- Data() {
1406
- static_assert(
1407
- sizeof(Data) == sizeof(uint64_t),
1408
- "Value data should fit in a 64-bit register");
1409
- }
1410
- ~Data() {}
1411
-
1412
- // scalars
1413
- bool boolean;
1414
- double number;
1415
- // pointers
1416
- Pointer pointer; // Symbol, String, Object, Array, Function
1417
- };
1418
-
1419
- Value(ValueKind kind) : kind_(kind) {}
1420
-
1421
- constexpr static ValueKind kindOf(const Symbol&) {
1422
- return SymbolKind;
1423
- }
1424
- constexpr static ValueKind kindOf(const BigInt&) {
1425
- return BigIntKind;
1426
- }
1427
- constexpr static ValueKind kindOf(const String&) {
1428
- return StringKind;
1429
- }
1430
- constexpr static ValueKind kindOf(const Object&) {
1431
- return ObjectKind;
1432
- }
1433
-
1434
- ValueKind kind_;
1435
- Data data_;
1436
-
1437
- // In the future: Value becomes NaN-boxed. See T40538354.
1438
- };
1439
-
1440
- /// Not movable and not copyable RAII marker advising the underlying
1441
- /// JavaScript VM to track resources allocated since creation until
1442
- /// destruction so that they can be recycled eagerly when the Scope
1443
- /// goes out of scope instead of floating in the air until the next
1444
- /// garbage collection or any other delayed release occurs.
1445
- ///
1446
- /// This API should be treated only as advice, implementations can
1447
- /// choose to ignore the fact that Scopes are created or destroyed.
1448
- ///
1449
- /// This class is an exception to the rule allowing destructors to be
1450
- /// called without proper synchronization (see Runtime documentation).
1451
- /// The whole point of this class is to enable all sorts of clean ups
1452
- /// when the destructor is called and this proper synchronization is
1453
- /// required at that time.
1454
- ///
1455
- /// Instances of this class are intended to be created as automatic stack
1456
- /// variables in which case destructor calls don't require any additional
1457
- /// locking, provided that the lock (if any) is managed with RAII helpers.
1458
- class JSI_EXPORT Scope {
1459
- public:
1460
- explicit Scope(Runtime& rt) : rt_(rt), prv_(rt.pushScope()) {}
1461
- ~Scope() {
1462
- rt_.popScope(prv_);
1463
- };
1464
-
1465
- Scope(const Scope&) = delete;
1466
- Scope(Scope&&) = delete;
1467
-
1468
- Scope& operator=(const Scope&) = delete;
1469
- Scope& operator=(Scope&&) = delete;
1470
-
1471
- template <typename F>
1472
- static auto callInNewScope(Runtime& rt, F f) -> decltype(f()) {
1473
- Scope s(rt);
1474
- return f();
1475
- }
1476
-
1477
- private:
1478
- Runtime& rt_;
1479
- Runtime::ScopeState* prv_;
1480
- };
1481
-
1482
- /// Base class for jsi exceptions
1483
- class JSI_EXPORT JSIException : public std::exception {
1484
- protected:
1485
- JSIException(){};
1486
- JSIException(std::string what) : what_(std::move(what)){};
1487
-
1488
- public:
1489
- JSIException(const JSIException&) = default;
1490
-
1491
- virtual const char* what() const noexcept override {
1492
- return what_.c_str();
1493
- }
1494
-
1495
- virtual ~JSIException() override;
1496
-
1497
- protected:
1498
- std::string what_;
1499
- };
1500
-
1501
- /// This exception will be thrown by API functions on errors not related to
1502
- /// JavaScript execution.
1503
- class JSI_EXPORT JSINativeException : public JSIException {
1504
- public:
1505
- JSINativeException(std::string what) : JSIException(std::move(what)) {}
1506
-
1507
- JSINativeException(const JSINativeException&) = default;
1508
-
1509
- virtual ~JSINativeException();
1510
- };
1511
-
1512
- /// This exception will be thrown by API functions whenever a JS
1513
- /// operation causes an exception as described by the spec, or as
1514
- /// otherwise described.
1515
- class JSI_EXPORT JSError : public JSIException {
1516
- public:
1517
- /// Creates a JSError referring to provided \c value
1518
- JSError(Runtime& r, Value&& value);
1519
-
1520
- /// Creates a JSError referring to new \c Error instance capturing current
1521
- /// JavaScript stack. The error message property is set to given \c message.
1522
- JSError(Runtime& rt, std::string message);
1523
-
1524
- /// Creates a JSError referring to new \c Error instance capturing current
1525
- /// JavaScript stack. The error message property is set to given \c message.
1526
- JSError(Runtime& rt, const char* message)
1527
- : JSError(rt, std::string(message)){};
1528
-
1529
- /// Creates a JSError referring to a JavaScript Object having message and
1530
- /// stack properties set to provided values.
1531
- JSError(Runtime& rt, std::string message, std::string stack);
1532
-
1533
- /// Creates a JSError referring to provided value and what string
1534
- /// set to provided message. This argument order is a bit weird,
1535
- /// but necessary to avoid ambiguity with the above.
1536
- JSError(std::string what, Runtime& rt, Value&& value);
1537
-
1538
- JSError(const JSError&) = default;
1539
-
1540
- virtual ~JSError();
1541
-
1542
- const std::string& getStack() const {
1543
- return stack_;
1544
- }
1545
-
1546
- const std::string& getMessage() const {
1547
- return message_;
1548
- }
1549
-
1550
- const jsi::Value& value() const {
1551
- assert(value_);
1552
- return *value_;
1553
- }
1554
-
1555
- private:
1556
- // This initializes the value_ member and does some other
1557
- // validation, so it must be called by every branch through the
1558
- // constructors.
1559
- void setValue(Runtime& rt, Value&& value);
1560
-
1561
- // This needs to be on the heap, because throw requires the object
1562
- // be copyable, and Value is not.
1563
- std::shared_ptr<jsi::Value> value_;
1564
- std::string message_;
1565
- std::string stack_;
1566
- };
1567
-
1568
- } // namespace jsi
1569
- } // namespace facebook
1570
-
1571
- #include "jsi/jsi-inl.h"