react-native-nitro-modules 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/cpp/platform/NitroLogger.cpp +2 -1
- package/android/src/main/cpp/registry/JHybridObjectRegistry.cpp +2 -1
- package/cpp/core/ArrayBuffer.hpp +0 -1
- package/cpp/core/HybridFunction.hpp +5 -4
- package/cpp/core/HybridObject.cpp +4 -56
- package/cpp/core/HybridObject.hpp +0 -1
- package/cpp/jsi/JSICache.cpp +2 -1
- package/cpp/jsi/JSIConverter+ArrayBuffer.hpp +10 -2
- package/cpp/jsi/JSIConverter+HybridObject.hpp +3 -2
- package/cpp/jsi/JSIHelpers.hpp +1 -1
- package/cpp/platform/NitroLogger.hpp +2 -1
- package/cpp/prototype/HybridObjectPrototype.cpp +2 -1
- package/cpp/registry/HybridObjectRegistry.cpp +15 -9
- package/cpp/threading/Dispatcher.cpp +3 -2
- package/cpp/turbomodule/NativeNitroModules.cpp +10 -2
- package/cpp/utils/NitroDefines.hpp +9 -1
- package/cpp/utils/OwningLock.hpp +1 -1
- package/cpp/utils/TypeInfo.hpp +1 -1
- package/ios/core/PromiseHolder.hpp +1 -1
- package/ios/platform/NitroLogger.mm +2 -1
- package/lib/NativeNitroModules.d.ts +1 -0
- package/lib/NitroModules.d.ts +5 -0
- package/lib/NitroModules.js +9 -1
- package/lib/NitroModulesTurboModule.d.ts +17 -0
- package/lib/NitroModulesTurboModule.js +23 -0
- package/lib/NitroModulesTurboModule.web.d.ts +1 -0
- package/lib/NitroModulesTurboModule.web.js +4 -0
- package/lib/commonjs/NitroModules.js +14 -6
- package/lib/commonjs/NitroModules.js.map +1 -1
- package/lib/commonjs/{NativeNitroModules.js → NitroModulesTurboModule.js} +5 -1
- package/lib/commonjs/NitroModulesTurboModule.js.map +1 -0
- package/lib/commonjs/NitroModulesTurboModule.web.js +11 -0
- package/lib/commonjs/NitroModulesTurboModule.web.js.map +1 -0
- package/lib/module/NitroModules.js +9 -1
- package/lib/module/NitroModules.js.map +1 -1
- package/lib/module/{NativeNitroModules.js → NitroModulesTurboModule.js} +6 -1
- package/lib/module/NitroModulesTurboModule.js.map +1 -0
- package/lib/module/NitroModulesTurboModule.web.js +7 -0
- package/lib/module/NitroModulesTurboModule.web.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/typescript/AnyMap.d.ts.map +1 -0
- package/lib/typescript/ModuleNotFoundError.d.ts.map +1 -0
- package/lib/typescript/NitroModules.d.ts.map +1 -1
- package/lib/typescript/NitroModulesTurboModule.d.ts +18 -0
- package/lib/typescript/NitroModulesTurboModule.d.ts.map +1 -0
- package/lib/typescript/NitroModulesTurboModule.web.d.ts +2 -0
- package/lib/typescript/NitroModulesTurboModule.web.d.ts.map +1 -0
- package/lib/typescript/__tests__/index.test.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/NitroModules.ts +9 -1
- package/src/{NativeNitroModules.ts → NitroModulesTurboModule.ts} +9 -4
- package/src/NitroModulesTurboModule.web.ts +7 -0
- package/lib/commonjs/NativeNitroModules.js.map +0 -1
- package/lib/commonjs/NativeNitroModules.web.js +0 -10
- package/lib/commonjs/NativeNitroModules.web.js.map +0 -1
- package/lib/module/NativeNitroModules.js.map +0 -1
- package/lib/module/NativeNitroModules.web.js +0 -6
- package/lib/module/NativeNitroModules.web.js.map +0 -1
- package/lib/typescript/HybridObject.d.ts +0 -99
- package/src/NativeNitroModules.web.ts +0 -9
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["getNativeNitroModules","Error"],"sourceRoot":"../../src","sources":["NativeNitroModules.web.ts"],"mappings":";;;;;;AAIO,SAASA,qBAAqBA,CAAA,EAAS;EAC5C,MAAM,IAAIC,KAAK,CACb,oIACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","ModuleNotFoundError","turboModule","getNativeNitroModules","getEnforcing","install","e","isRuntimeAlive","cache","global","__nitroModulesJSICache","dispatcher","__nitroDispatcher"],"sourceRoot":"../../src","sources":["NativeNitroModules.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAElD,SAASC,mBAAmB,QAAQ,uBAAuB;AAc3D,IAAIC,WAA6B;AACjC,OAAO,SAASC,qBAAqBA,CAAA,EAAS;EAC5C,IAAID,WAAW,IAAI,IAAI,EAAE;IACvB,IAAI;MACF;MACAA,WAAW,GAAGF,mBAAmB,CAACI,YAAY,CAAO,iBAAiB,CAAC;;MAEvE;MACAF,WAAW,CAACG,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC,OAAOC,CAAC,EAAE;MACV,MAAM,IAAIL,mBAAmB,CAACK,CAAC,CAAC;IAClC;EACF;EAEA,OAAOJ,WAAW;AACpB;AAOA,OAAO,SAASK,cAAcA,CAAA,EAAG;EAC/B,MAAMC,KAAK,GAAGC,MAAM,CAACC,sBAAsB;EAC3C,MAAMC,UAAU,GAAGF,MAAM,CAACG,iBAAiB;EAC3C,OAAOJ,KAAK,IAAI,IAAI,IAAIG,UAAU,IAAI,IAAI;AAC5C","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["getNativeNitroModules","Error"],"sourceRoot":"../../src","sources":["NativeNitroModules.web.ts"],"mappings":";;AAIA,OAAO,SAASA,qBAAqBA,CAAA,EAAS;EAC5C,MAAM,IAAIC,KAAK,CACb,oIACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Describes the languages this component will be implemented in.
|
|
3
|
-
*
|
|
4
|
-
* By default, everything has a C++ base, and can optionally be bridged down
|
|
5
|
-
* to platform-specific languages like Swift or Kotlin
|
|
6
|
-
*/
|
|
7
|
-
export interface PlatformSpec {
|
|
8
|
-
ios?: 'swift' | 'c++';
|
|
9
|
-
android?: 'kotlin' | 'c++';
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Represents a Nitro `HybridObject` which is implemented in a native language like
|
|
13
|
-
* C++, Swift or Kotlin.
|
|
14
|
-
* Every Nitro `HybridObject` has a C++ base, and can optionally be bridged down to Swift or Kotlin.
|
|
15
|
-
*
|
|
16
|
-
* `HybridObject`s use the Nitro Tunnel for efficient, low-overhead JS <-> Native communication.
|
|
17
|
-
*
|
|
18
|
-
* All `HybridObject`s are implemented using `NativeState`, and inherit their properties
|
|
19
|
-
* and methods from their prototype, so the actual JS object is empty.
|
|
20
|
-
*
|
|
21
|
-
* @type Platforms: The type of platforms this HybridObject will be implemented in. By default, it is
|
|
22
|
-
* a C++ `HybridObject`.
|
|
23
|
-
* @default { ios: 'c++', android: 'c++' }
|
|
24
|
-
* @example
|
|
25
|
-
* ```ts
|
|
26
|
-
* interface Photo extends HybridObject<{ ios: 'swift', android: 'kotlin' }> {
|
|
27
|
-
* readonly width: number
|
|
28
|
-
* readonly height: number
|
|
29
|
-
* toArrayBuffer(): ArrayBuffer
|
|
30
|
-
* saveToFile(path: string): Promise<void>
|
|
31
|
-
* }
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export interface HybridObject<Platforms extends PlatformSpec = {}> {
|
|
35
|
-
/**
|
|
36
|
-
* Holds a type-name describing the native `HybridObject` instance.
|
|
37
|
-
*
|
|
38
|
-
* This is the only property actually present on the actual JavaScript object,
|
|
39
|
-
* because all other properties and methods are inherited from a shared Prototype.
|
|
40
|
-
*
|
|
41
|
-
* Nitro prototypes also have a `__type`.
|
|
42
|
-
*
|
|
43
|
-
* - For actual HybridObject instances, this is `NativeState<...>`
|
|
44
|
-
* - For prototypes this is `Prototype<...>`.
|
|
45
|
-
*
|
|
46
|
-
* @internal
|
|
47
|
-
* @private
|
|
48
|
-
* @note This value is available in debug only.
|
|
49
|
-
*/
|
|
50
|
-
readonly __type?: string;
|
|
51
|
-
/**
|
|
52
|
-
* The `HybridObject`'s name.
|
|
53
|
-
*/
|
|
54
|
-
readonly name: string;
|
|
55
|
-
/**
|
|
56
|
-
* Returns a string representation of the given `HybridObject`.
|
|
57
|
-
*
|
|
58
|
-
* Unless overridden by the `HybridObject`, this will return the name of the object.
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```ts
|
|
62
|
-
* const hybridA = SomeModule.getExistingHybridInstance()
|
|
63
|
-
* console.log(hybridA.toString()) // [HybridObject HybridA]
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
toString(): string;
|
|
67
|
-
/**
|
|
68
|
-
* Returns whether this `HybridObject` is the same object as {@linkcode other}.
|
|
69
|
-
*
|
|
70
|
-
* While two `HybridObject`s might not be equal when compared with `==`, they might still
|
|
71
|
-
* hold the same underlying `HybridObject`, in which case {@linkcode equals | equals(other)}
|
|
72
|
-
* will return `true`.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```ts
|
|
76
|
-
* const hybridA = SomeModule.getExistingHybridInstance()
|
|
77
|
-
* const hybridB = SomeModule.getExistingHybridInstance()
|
|
78
|
-
* console.log(hybridA === hybridB) // false
|
|
79
|
-
* console.log(hybridA.equals(hybridB)) // true
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
equals(other: HybridObject<Platforms>): boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Disposes any resources this {@linkcode HybridObject} might hold natively,
|
|
85
|
-
* and finally releases this {@linkcode HybridObject}'s `NativeState`.
|
|
86
|
-
*
|
|
87
|
-
* After calling {@linkcode dispose()}, this object can no longer be used.
|
|
88
|
-
*
|
|
89
|
-
* Eagerly disposing a {@linkcode HybridObject} could be beneficial for a queue-/handler-architecture
|
|
90
|
-
* where a bunch of Hybrid Objects are allocated, and later deallocated once a callback (e.g. a render function)
|
|
91
|
-
* completes.
|
|
92
|
-
*
|
|
93
|
-
* @note It is **NOT** required to call {@linkcode dispose()} manually, as the JavaScript
|
|
94
|
-
* Garbage Collector automatically disposes and releases any resources when needed.
|
|
95
|
-
* It is purely optional to eagerly-, and manually-, call {@linkcode dispose()} here - **use with caution!**
|
|
96
|
-
*/
|
|
97
|
-
dispose(): void;
|
|
98
|
-
}
|
|
99
|
-
//# sourceMappingURL=HybridObject.d.ts.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { TurboModule } from 'react-native'
|
|
2
|
-
|
|
3
|
-
export interface Spec extends TurboModule {}
|
|
4
|
-
|
|
5
|
-
export function getNativeNitroModules(): Spec {
|
|
6
|
-
throw new Error(
|
|
7
|
-
`Native NitroModules are not available on web! Make sure you're not calling getNativeNitroModules() in a web (.web.ts) environment.`
|
|
8
|
-
)
|
|
9
|
-
}
|