react-native-nitro-modules 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +3 -3
  2. package/cpp/core/BoxedHybridObject.cpp +29 -0
  3. package/cpp/core/BoxedHybridObject.hpp +36 -0
  4. package/cpp/registry/HybridObjectRegistry.cpp +12 -7
  5. package/cpp/templates/FutureType.hpp +1 -1
  6. package/cpp/templates/TypeIndex.hpp +29 -0
  7. package/cpp/turbomodule/NativeNitroModules.cpp +31 -16
  8. package/cpp/turbomodule/NativeNitroModules.hpp +2 -3
  9. package/cpp/utils/NitroDefines.hpp +5 -0
  10. package/ios/core/AnyMapHolder.hpp +8 -0
  11. package/ios/core/AnyMapHolder.swift +65 -39
  12. package/lib/NativeNitroModules.d.ts +0 -1
  13. package/lib/NitroModules.d.ts +35 -0
  14. package/lib/NitroModules.js +28 -1
  15. package/lib/{typescript/NativeNitroModules.d.ts → NitroModulesTurboModule.d.ts} +4 -4
  16. package/lib/NitroModulesTurboModule.js +23 -0
  17. package/lib/NitroModulesTurboModule.web.d.ts +1 -0
  18. package/lib/NitroModulesTurboModule.web.js +4 -0
  19. package/lib/commonjs/NitroModules.js +38 -10
  20. package/lib/commonjs/NitroModules.js.map +1 -1
  21. package/lib/commonjs/{NativeNitroModules.js → NitroModulesTurboModule.js} +5 -1
  22. package/lib/commonjs/NitroModulesTurboModule.js.map +1 -0
  23. package/lib/commonjs/NitroModulesTurboModule.web.js +11 -0
  24. package/lib/commonjs/NitroModulesTurboModule.web.js.map +1 -0
  25. package/lib/module/NitroModules.js +32 -4
  26. package/lib/module/NitroModules.js.map +1 -1
  27. package/lib/module/{NativeNitroModules.js → NitroModulesTurboModule.js} +6 -1
  28. package/lib/module/NitroModulesTurboModule.js.map +1 -0
  29. package/lib/module/NitroModulesTurboModule.web.js +7 -0
  30. package/lib/module/NitroModulesTurboModule.web.js.map +1 -0
  31. package/lib/tsconfig.tsbuildinfo +1 -1
  32. package/lib/typescript/HybridObject.d.ts +99 -0
  33. package/lib/typescript/NitroModules.d.ts +35 -0
  34. package/lib/typescript/NitroModules.d.ts.map +1 -1
  35. package/lib/typescript/NitroModulesTurboModule.d.ts +19 -0
  36. package/lib/typescript/NitroModulesTurboModule.d.ts.map +1 -0
  37. package/lib/typescript/NitroModulesTurboModule.web.d.ts +2 -0
  38. package/lib/typescript/NitroModulesTurboModule.web.d.ts.map +1 -0
  39. package/package.json +1 -1
  40. package/src/NitroModules.ts +38 -6
  41. package/src/{NativeNitroModules.ts → NitroModulesTurboModule.ts} +10 -5
  42. package/src/NitroModulesTurboModule.web.ts +7 -0
  43. package/lib/commonjs/NativeNitroModules.js.map +0 -1
  44. package/lib/commonjs/NativeNitroModules.web.js +0 -10
  45. package/lib/commonjs/NativeNitroModules.web.js.map +0 -1
  46. package/lib/module/NativeNitroModules.js.map +0 -1
  47. package/lib/module/NativeNitroModules.web.js +0 -6
  48. package/lib/module/NativeNitroModules.web.js.map +0 -1
  49. package/lib/typescript/NativeNitroModules.d.ts.map +0 -1
  50. package/lib/typescript/NativeNitroModules.web.d.ts.map +0 -1
  51. package/src/NativeNitroModules.web.ts +0 -9
@@ -1,18 +1,18 @@
1
1
  import type { TurboModule } from 'react-native';
2
2
  import type { UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes';
3
- export interface Spec extends TurboModule {
3
+ export interface NativeNitroSpec extends TurboModule {
4
4
  install(): void;
5
- createHybridObject(name: string, args?: UnsafeObject): UnsafeObject;
5
+ createHybridObject(name: string): UnsafeObject;
6
6
  hasHybridObject(name: string): boolean;
7
7
  getAllHybridObjectNames(): string[];
8
8
  hasNativeState(obj: UnsafeObject): boolean;
9
9
  removeNativeState(obj: UnsafeObject): void;
10
10
  buildType: 'debug' | 'release';
11
+ box(obj: UnsafeObject): UnsafeObject;
11
12
  }
12
- export declare function getNativeNitroModules(): Spec;
13
+ export declare function getNativeNitroModules(): NativeNitroSpec;
13
14
  declare global {
14
15
  var __nitroModulesJSICache: {};
15
16
  var __nitroDispatcher: {};
16
17
  }
17
18
  export declare function isRuntimeAlive(): boolean;
18
- //# sourceMappingURL=NativeNitroModules.d.ts.map
@@ -0,0 +1,23 @@
1
+ import { TurboModuleRegistry } from 'react-native';
2
+ import { ModuleNotFoundError } from './ModuleNotFoundError';
3
+ let turboModule;
4
+ export function getNativeNitroModules() {
5
+ if (turboModule == null) {
6
+ try {
7
+ // 1. Get (and initialize) the C++ TurboModule
8
+ turboModule =
9
+ TurboModuleRegistry.getEnforcing('NitroModulesCxx');
10
+ // 2. Install Dispatcher and required bindings into the Runtime
11
+ turboModule.install();
12
+ }
13
+ catch (e) {
14
+ throw new ModuleNotFoundError(e);
15
+ }
16
+ }
17
+ return turboModule;
18
+ }
19
+ export function isRuntimeAlive() {
20
+ const cache = global.__nitroModulesJSICache;
21
+ const dispatcher = global.__nitroDispatcher;
22
+ return cache != null && dispatcher != null;
23
+ }
@@ -0,0 +1 @@
1
+ export declare function getNativeNitroModules(): never;
@@ -0,0 +1,4 @@
1
+ import { Platform } from 'react-native';
2
+ export function getNativeNitroModules() {
3
+ throw new Error(`Native NitroModules are not available on ${Platform.OS}! Make sure you're not calling getNativeNitroModules() in a ${Platform.OS} (.${Platform.OS}.ts) environment.`);
4
+ }
@@ -4,10 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.NitroModules = void 0;
7
- var _NativeNitroModules = require("./NativeNitroModules");
8
- // TODO: Do we wanna support such constructors?
9
- // @ts-expect-error
10
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
+ var _NitroModulesTurboModule = require("./NitroModulesTurboModule");
8
+ /**
9
+ * Represents a boxed {@linkcode HybridObject} that can later be unboxed again.
10
+ * This is implemented as a `jsi::HostObject`.
11
+ */
11
12
 
12
13
  /**
13
14
  * A lazy proxy for initializing Nitro Modules HybridObjects.
@@ -24,7 +25,7 @@ const NitroModules = exports.NitroModules = {
24
25
  * @throws an Error if {@linkcode T} has not been registered under the name {@linkcode name}.
25
26
  */
26
27
  createHybridObject(name) {
27
- const nitro = (0, _NativeNitroModules.getNativeNitroModules)();
28
+ const nitro = (0, _NitroModulesTurboModule.getNativeNitroModules)();
28
29
  const instance = nitro.createHybridObject(name);
29
30
  return instance;
30
31
  },
@@ -32,14 +33,14 @@ const NitroModules = exports.NitroModules = {
32
33
  * Get a list of all registered Hybrid Objects.
33
34
  */
34
35
  getAllHybridObjectNames() {
35
- const nitro = (0, _NativeNitroModules.getNativeNitroModules)();
36
+ const nitro = (0, _NitroModulesTurboModule.getNativeNitroModules)();
36
37
  return nitro.getAllHybridObjectNames();
37
38
  },
38
39
  /**
39
40
  * Returns whether a HybridObject under the given {@linkcode name} is registered, or not.
40
41
  */
41
42
  hasHybridObject(name) {
42
- const nitro = (0, _NativeNitroModules.getNativeNitroModules)();
43
+ const nitro = (0, _NitroModulesTurboModule.getNativeNitroModules)();
43
44
  return nitro.hasHybridObject(name);
44
45
  },
45
46
  /**
@@ -56,14 +57,14 @@ const NitroModules = exports.NitroModules = {
56
57
  * ```
57
58
  */
58
59
  hasNativeState(object) {
59
- const nitro = (0, _NativeNitroModules.getNativeNitroModules)();
60
+ const nitro = (0, _NitroModulesTurboModule.getNativeNitroModules)();
60
61
  return nitro.hasNativeState(object);
61
62
  },
62
63
  /**
63
64
  * Forcefully removes the `NativeState` of the given {@linkcode object}.
64
65
  */
65
66
  removeNativeState(object) {
66
- const nitro = (0, _NativeNitroModules.getNativeNitroModules)();
67
+ const nitro = (0, _NitroModulesTurboModule.getNativeNitroModules)();
67
68
  nitro.removeNativeState(object);
68
69
  },
69
70
  /**
@@ -71,8 +72,35 @@ const NitroModules = exports.NitroModules = {
71
72
  * preprocessor flag.
72
73
  */
73
74
  get buildType() {
74
- const nitro = (0, _NativeNitroModules.getNativeNitroModules)();
75
+ const nitro = (0, _NitroModulesTurboModule.getNativeNitroModules)();
75
76
  return nitro.buildType;
77
+ },
78
+ /**
79
+ * Boxes the given {@linkcode hybridObject} into a {@linkcode BoxedHybridObject<T>}, which can
80
+ * later be unboxed in a separate Runtime.
81
+ *
82
+ * While Nitro is runtime-agnostic and all `HybridObject`s can be used from a any Runtime,
83
+ * some threading/worklet libraries (like [react-native-worklets-core](https://github.com/margelo/react-native-worklets-core))
84
+ * do not yet support copying over `HybridObject`s as they use newer JSI APIs like `jsi::NativeState`.
85
+ *
86
+ * While those APIs are not yet available, you can still use every Nitro Hybrid Object in a separate
87
+ * Runtime/Worklet context by just boxing it yourself:
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * const something = NitroModules.createHybridObject<Something>('Something')
92
+ * const boxed = NitroModules.box(something)
93
+ * const context = Worklets.createContext('DummyContext')
94
+ * context.runAsync(() => {
95
+ * 'worklet'
96
+ * const unboxed = boxed.unbox()
97
+ * console.log(unboxed.name) // --> "Something"
98
+ * })
99
+ * ```
100
+ */
101
+ box(hybridObject) {
102
+ const nitro = (0, _NitroModulesTurboModule.getNativeNitroModules)();
103
+ return nitro.box(hybridObject);
76
104
  }
77
105
  };
78
106
  //# sourceMappingURL=NitroModules.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_NativeNitroModules","require","NitroModules","exports","createHybridObject","name","nitro","getNativeNitroModules","instance","getAllHybridObjectNames","hasHybridObject","hasNativeState","object","removeNativeState","buildType"],"sourceRoot":"../../src","sources":["NitroModules.ts"],"mappings":";;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAGA;AACA;AACA;;AAKA;AACA;AACA;AACO,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG;EAC1B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,kBAAkBA,CAA8BC,IAAY,EAAK;IAC/D,MAAMC,KAAK,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACrC,MAAMC,QAAQ,GAAGF,KAAK,CAACF,kBAAkB,CAACC,IAAI,CAAC;IAC/C,OAAOG,QAAQ;EACjB,CAAC;EACD;AACF;AACA;EACEC,uBAAuBA,CAAA,EAAa;IAClC,MAAMH,KAAK,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACrC,OAAOD,KAAK,CAACG,uBAAuB,CAAC,CAAC;EACxC,CAAC;EACD;AACF;AACA;EACEC,eAAeA,CAACL,IAAY,EAAW;IACrC,MAAMC,KAAK,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACrC,OAAOD,KAAK,CAACI,eAAe,CAACL,IAAI,CAAC;EACpC,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEM,cAAcA,CAACC,MAAc,EAAW;IACtC,MAAMN,KAAK,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACrC,OAAOD,KAAK,CAACK,cAAc,CAACC,MAAM,CAAC;EACrC,CAAC;EACD;AACF;AACA;EACEC,iBAAiBA,CAACD,MAAc,EAAQ;IACtC,MAAMN,KAAK,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACrCD,KAAK,CAACO,iBAAiB,CAACD,MAAM,CAAC;EACjC,CAAC;EACD;AACF;AACA;AACA;EACE,IAAIE,SAASA,CAAA,EAAwB;IACnC,MAAMR,KAAK,GAAG,IAAAC,yCAAqB,EAAC,CAAC;IACrC,OAAOD,KAAK,CAACQ,SAAS;EACxB;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_NitroModulesTurboModule","require","NitroModules","exports","createHybridObject","name","nitro","getNativeNitroModules","instance","getAllHybridObjectNames","hasHybridObject","hasNativeState","object","removeNativeState","buildType","box","hybridObject"],"sourceRoot":"../../src","sources":["NitroModules.ts"],"mappings":";;;;;;AAAA,IAAAA,wBAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;;AASA;AACA;AACA;AACO,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG;EAC1B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEE,kBAAkBA,CAA8BC,IAAY,EAAK;IAC/D,MAAMC,KAAK,GAAG,IAAAC,8CAAqB,EAAC,CAAC;IACrC,MAAMC,QAAQ,GAAGF,KAAK,CAACF,kBAAkB,CAACC,IAAI,CAAC;IAC/C,OAAOG,QAAQ;EACjB,CAAC;EACD;AACF;AACA;EACEC,uBAAuBA,CAAA,EAAa;IAClC,MAAMH,KAAK,GAAG,IAAAC,8CAAqB,EAAC,CAAC;IACrC,OAAOD,KAAK,CAACG,uBAAuB,CAAC,CAAC;EACxC,CAAC;EACD;AACF;AACA;EACEC,eAAeA,CAACL,IAAY,EAAW;IACrC,MAAMC,KAAK,GAAG,IAAAC,8CAAqB,EAAC,CAAC;IACrC,OAAOD,KAAK,CAACI,eAAe,CAACL,IAAI,CAAC;EACpC,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEM,cAAcA,CAACC,MAAc,EAAW;IACtC,MAAMN,KAAK,GAAG,IAAAC,8CAAqB,EAAC,CAAC;IACrC,OAAOD,KAAK,CAACK,cAAc,CAACC,MAAM,CAAC;EACrC,CAAC;EACD;AACF;AACA;EACEC,iBAAiBA,CAACD,MAAc,EAAQ;IACtC,MAAMN,KAAK,GAAG,IAAAC,8CAAqB,EAAC,CAAC;IACrCD,KAAK,CAACO,iBAAiB,CAACD,MAAM,CAAC;EACjC,CAAC;EACD;AACF;AACA;AACA;EACE,IAAIE,SAASA,CAAA,EAAwB;IACnC,MAAMR,KAAK,GAAG,IAAAC,8CAAqB,EAAC,CAAC;IACrC,OAAOD,KAAK,CAACQ,SAAS;EACxB,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,GAAGA,CAAyBC,YAAe,EAAwB;IACjE,MAAMV,KAAK,GAAG,IAAAC,8CAAqB,EAAC,CAAC;IACrC,OAAOD,KAAK,CAACS,GAAG,CAACC,YAAY,CAAC;EAChC;AACF,CAAC","ignoreList":[]}
@@ -7,6 +7,10 @@ exports.getNativeNitroModules = getNativeNitroModules;
7
7
  exports.isRuntimeAlive = isRuntimeAlive;
8
8
  var _reactNative = require("react-native");
9
9
  var _ModuleNotFoundError = require("./ModuleNotFoundError");
10
+ // This TurboModule is *not* codegen'd.
11
+ // It's handwritten, because otherwise the app's CMakeLists wants to build it.
12
+ // Instead, we want to build it ourselves and have full control over the CMakeLists.
13
+
10
14
  let turboModule;
11
15
  function getNativeNitroModules() {
12
16
  if (turboModule == null) {
@@ -27,4 +31,4 @@ function isRuntimeAlive() {
27
31
  const dispatcher = global.__nitroDispatcher;
28
32
  return cache != null && dispatcher != null;
29
33
  }
30
- //# sourceMappingURL=NativeNitroModules.js.map
34
+ //# sourceMappingURL=NitroModulesTurboModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","_ModuleNotFoundError","turboModule","getNativeNitroModules","TurboModuleRegistry","getEnforcing","install","e","ModuleNotFoundError","isRuntimeAlive","cache","global","__nitroModulesJSICache","dispatcher","__nitroDispatcher"],"sourceRoot":"../../src","sources":["NitroModulesTurboModule.ts"],"mappings":";;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,oBAAA,GAAAD,OAAA;AAEA;AACA;AACA;;AAeA,IAAIE,WAAwC;AACrC,SAASC,qBAAqBA,CAAA,EAAoB;EACvD,IAAID,WAAW,IAAI,IAAI,EAAE;IACvB,IAAI;MACF;MACAA,WAAW,GACTE,gCAAmB,CAACC,YAAY,CAAkB,iBAAiB,CAAC;;MAEtE;MACAH,WAAW,CAACI,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC,OAAOC,CAAC,EAAE;MACV,MAAM,IAAIC,wCAAmB,CAACD,CAAC,CAAC;IAClC;EACF;EAEA,OAAOL,WAAW;AACpB;AAOO,SAASO,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":[]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getNativeNitroModules = getNativeNitroModules;
7
+ var _reactNative = require("react-native");
8
+ function getNativeNitroModules() {
9
+ throw new Error(`Native NitroModules are not available on ${_reactNative.Platform.OS}! Make sure you're not calling getNativeNitroModules() in a ${_reactNative.Platform.OS} (.${_reactNative.Platform.OS}.ts) environment.`);
10
+ }
11
+ //# sourceMappingURL=NitroModulesTurboModule.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","getNativeNitroModules","Error","Platform","OS"],"sourceRoot":"../../src","sources":["NitroModulesTurboModule.web.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,SAASC,qBAAqBA,CAAA,EAAU;EAC7C,MAAM,IAAIC,KAAK,CACb,4CAA4CC,qBAAQ,CAACC,EAAE,+DAA+DD,qBAAQ,CAACC,EAAE,MAAMD,qBAAQ,CAACC,EAAE,mBACpJ,CAAC;AACH","ignoreList":[]}
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
 
3
- import { getNativeNitroModules } from './NativeNitroModules';
3
+ import { getNativeNitroModules } from './NitroModulesTurboModule';
4
4
 
5
- // TODO: Do we wanna support such constructors?
6
- // @ts-expect-error
7
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5
+ /**
6
+ * Represents a boxed {@linkcode HybridObject} that can later be unboxed again.
7
+ * This is implemented as a `jsi::HostObject`.
8
+ */
8
9
 
9
10
  /**
10
11
  * A lazy proxy for initializing Nitro Modules HybridObjects.
@@ -70,6 +71,33 @@ export const NitroModules = {
70
71
  get buildType() {
71
72
  const nitro = getNativeNitroModules();
72
73
  return nitro.buildType;
74
+ },
75
+ /**
76
+ * Boxes the given {@linkcode hybridObject} into a {@linkcode BoxedHybridObject<T>}, which can
77
+ * later be unboxed in a separate Runtime.
78
+ *
79
+ * While Nitro is runtime-agnostic and all `HybridObject`s can be used from a any Runtime,
80
+ * some threading/worklet libraries (like [react-native-worklets-core](https://github.com/margelo/react-native-worklets-core))
81
+ * do not yet support copying over `HybridObject`s as they use newer JSI APIs like `jsi::NativeState`.
82
+ *
83
+ * While those APIs are not yet available, you can still use every Nitro Hybrid Object in a separate
84
+ * Runtime/Worklet context by just boxing it yourself:
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * const something = NitroModules.createHybridObject<Something>('Something')
89
+ * const boxed = NitroModules.box(something)
90
+ * const context = Worklets.createContext('DummyContext')
91
+ * context.runAsync(() => {
92
+ * 'worklet'
93
+ * const unboxed = boxed.unbox()
94
+ * console.log(unboxed.name) // --> "Something"
95
+ * })
96
+ * ```
97
+ */
98
+ box(hybridObject) {
99
+ const nitro = getNativeNitroModules();
100
+ return nitro.box(hybridObject);
73
101
  }
74
102
  };
75
103
  //# sourceMappingURL=NitroModules.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getNativeNitroModules","NitroModules","createHybridObject","name","nitro","instance","getAllHybridObjectNames","hasHybridObject","hasNativeState","object","removeNativeState","buildType"],"sourceRoot":"../../src","sources":["NitroModules.ts"],"mappings":";;AAAA,SAASA,qBAAqB,QAAQ,sBAAsB;;AAG5D;AACA;AACA;;AAKA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAG;EAC1B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,kBAAkBA,CAA8BC,IAAY,EAAK;IAC/D,MAAMC,KAAK,GAAGJ,qBAAqB,CAAC,CAAC;IACrC,MAAMK,QAAQ,GAAGD,KAAK,CAACF,kBAAkB,CAACC,IAAI,CAAC;IAC/C,OAAOE,QAAQ;EACjB,CAAC;EACD;AACF;AACA;EACEC,uBAAuBA,CAAA,EAAa;IAClC,MAAMF,KAAK,GAAGJ,qBAAqB,CAAC,CAAC;IACrC,OAAOI,KAAK,CAACE,uBAAuB,CAAC,CAAC;EACxC,CAAC;EACD;AACF;AACA;EACEC,eAAeA,CAACJ,IAAY,EAAW;IACrC,MAAMC,KAAK,GAAGJ,qBAAqB,CAAC,CAAC;IACrC,OAAOI,KAAK,CAACG,eAAe,CAACJ,IAAI,CAAC;EACpC,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEK,cAAcA,CAACC,MAAc,EAAW;IACtC,MAAML,KAAK,GAAGJ,qBAAqB,CAAC,CAAC;IACrC,OAAOI,KAAK,CAACI,cAAc,CAACC,MAAM,CAAC;EACrC,CAAC;EACD;AACF;AACA;EACEC,iBAAiBA,CAACD,MAAc,EAAQ;IACtC,MAAML,KAAK,GAAGJ,qBAAqB,CAAC,CAAC;IACrCI,KAAK,CAACM,iBAAiB,CAACD,MAAM,CAAC;EACjC,CAAC;EACD;AACF;AACA;AACA;EACE,IAAIE,SAASA,CAAA,EAAwB;IACnC,MAAMP,KAAK,GAAGJ,qBAAqB,CAAC,CAAC;IACrC,OAAOI,KAAK,CAACO,SAAS;EACxB;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["getNativeNitroModules","NitroModules","createHybridObject","name","nitro","instance","getAllHybridObjectNames","hasHybridObject","hasNativeState","object","removeNativeState","buildType","box","hybridObject"],"sourceRoot":"../../src","sources":["NitroModules.ts"],"mappings":";;AAAA,SAASA,qBAAqB,QAAQ,2BAA2B;;AAGjE;AACA;AACA;AACA;;AASA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAG;EAC1B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,kBAAkBA,CAA8BC,IAAY,EAAK;IAC/D,MAAMC,KAAK,GAAGJ,qBAAqB,CAAC,CAAC;IACrC,MAAMK,QAAQ,GAAGD,KAAK,CAACF,kBAAkB,CAACC,IAAI,CAAC;IAC/C,OAAOE,QAAQ;EACjB,CAAC;EACD;AACF;AACA;EACEC,uBAAuBA,CAAA,EAAa;IAClC,MAAMF,KAAK,GAAGJ,qBAAqB,CAAC,CAAC;IACrC,OAAOI,KAAK,CAACE,uBAAuB,CAAC,CAAC;EACxC,CAAC;EACD;AACF;AACA;EACEC,eAAeA,CAACJ,IAAY,EAAW;IACrC,MAAMC,KAAK,GAAGJ,qBAAqB,CAAC,CAAC;IACrC,OAAOI,KAAK,CAACG,eAAe,CAACJ,IAAI,CAAC;EACpC,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEK,cAAcA,CAACC,MAAc,EAAW;IACtC,MAAML,KAAK,GAAGJ,qBAAqB,CAAC,CAAC;IACrC,OAAOI,KAAK,CAACI,cAAc,CAACC,MAAM,CAAC;EACrC,CAAC;EACD;AACF;AACA;EACEC,iBAAiBA,CAACD,MAAc,EAAQ;IACtC,MAAML,KAAK,GAAGJ,qBAAqB,CAAC,CAAC;IACrCI,KAAK,CAACM,iBAAiB,CAACD,MAAM,CAAC;EACjC,CAAC;EACD;AACF;AACA;AACA;EACE,IAAIE,SAASA,CAAA,EAAwB;IACnC,MAAMP,KAAK,GAAGJ,qBAAqB,CAAC,CAAC;IACrC,OAAOI,KAAK,CAACO,SAAS;EACxB,CAAC;EACD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,GAAGA,CAAyBC,YAAe,EAAwB;IACjE,MAAMT,KAAK,GAAGJ,qBAAqB,CAAC,CAAC;IACrC,OAAOI,KAAK,CAACQ,GAAG,CAACC,YAAY,CAAC;EAChC;AACF,CAAC","ignoreList":[]}
@@ -2,6 +2,11 @@
2
2
 
3
3
  import { TurboModuleRegistry } from 'react-native';
4
4
  import { ModuleNotFoundError } from './ModuleNotFoundError';
5
+
6
+ // This TurboModule is *not* codegen'd.
7
+ // It's handwritten, because otherwise the app's CMakeLists wants to build it.
8
+ // Instead, we want to build it ourselves and have full control over the CMakeLists.
9
+
5
10
  let turboModule;
6
11
  export function getNativeNitroModules() {
7
12
  if (turboModule == null) {
@@ -22,4 +27,4 @@ export function isRuntimeAlive() {
22
27
  const dispatcher = global.__nitroDispatcher;
23
28
  return cache != null && dispatcher != null;
24
29
  }
25
- //# sourceMappingURL=NativeNitroModules.js.map
30
+ //# sourceMappingURL=NitroModulesTurboModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","ModuleNotFoundError","turboModule","getNativeNitroModules","getEnforcing","install","e","isRuntimeAlive","cache","global","__nitroModulesJSICache","dispatcher","__nitroDispatcher"],"sourceRoot":"../../src","sources":["NitroModulesTurboModule.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAElD,SAASC,mBAAmB,QAAQ,uBAAuB;;AAE3D;AACA;AACA;;AAeA,IAAIC,WAAwC;AAC5C,OAAO,SAASC,qBAAqBA,CAAA,EAAoB;EACvD,IAAID,WAAW,IAAI,IAAI,EAAE;IACvB,IAAI;MACF;MACAA,WAAW,GACTF,mBAAmB,CAACI,YAAY,CAAkB,iBAAiB,CAAC;;MAEtE;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":[]}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+
3
+ import { Platform } from 'react-native';
4
+ export function getNativeNitroModules() {
5
+ throw new Error(`Native NitroModules are not available on ${Platform.OS}! Make sure you're not calling getNativeNitroModules() in a ${Platform.OS} (.${Platform.OS}.ts) environment.`);
6
+ }
7
+ //# sourceMappingURL=NitroModulesTurboModule.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","getNativeNitroModules","Error","OS"],"sourceRoot":"../../src","sources":["NitroModulesTurboModule.web.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AAEvC,OAAO,SAASC,qBAAqBA,CAAA,EAAU;EAC7C,MAAM,IAAIC,KAAK,CACb,4CAA4CF,QAAQ,CAACG,EAAE,+DAA+DH,QAAQ,CAACG,EAAE,MAAMH,QAAQ,CAACG,EAAE,mBACpJ,CAAC;AACH","ignoreList":[]}