nitrogen 0.36.3 → 0.36.4

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.
@@ -16,12 +16,6 @@ export function createKotlinFunction(functionType) {
16
16
  .getRequiredImports('kotlin')
17
17
  .map((i) => `import ${i.name}`)
18
18
  .filter(isNotDuplicate);
19
- const funcAnnotations = [];
20
- if (!functionType.isSync) {
21
- // Async functions immediately schedule calls on a Dispatcher,
22
- // we can make those @FastNative as they are not doing any JNI allocations
23
- funcAnnotations.push('@FastNative');
24
- }
25
19
  const kotlinCode = `
26
20
  ${createFileMetadataString(`${name}.kt`)}
27
21
 
@@ -30,7 +24,6 @@ package ${packageName}
30
24
  import androidx.annotation.Keep
31
25
  import com.facebook.jni.HybridData
32
26
  import com.facebook.proguard.annotations.DoNotStrip
33
- import dalvik.annotation.optimization.FastNative
34
27
  ${extraImports.join('\n')}
35
28
 
36
29
  /**
@@ -79,7 +72,6 @@ class ${name}_cxx: ${name} {
79
72
  override fun invoke(${kotlinParams.join(', ')}): ${kotlinReturnType}
80
73
  = invoke_cxx(${kotlinParamsForward.join(',')})
81
74
 
82
- ${funcAnnotations.join('\n')}
83
75
  private external fun invoke_cxx(${kotlinParams.join(', ')}): ${kotlinReturnType}
84
76
  }
85
77
 
@@ -57,6 +57,7 @@ package ${javaPackage}
57
57
  import androidx.annotation.Keep
58
58
  import com.facebook.jni.HybridData
59
59
  import com.facebook.proguard.annotations.DoNotStrip
60
+ import dalvik.annotation.optimization.FastNative
60
61
  ${imports.join('\n')}
61
62
 
62
63
  /**
@@ -87,6 +88,7 @@ abstract class ${name.HybridTSpec}: ${kotlinBase}() {
87
88
  @Keep
88
89
  protected open class CxxPart(javaPart: ${name.HybridTSpec}): ${cxxPartBase}(javaPart) {
89
90
  // C++ ${name.JHybridTSpec}::CxxPart::initHybrid(...)
91
+ @FastNative
90
92
  external override fun initHybrid(): HybridData
91
93
  }
92
94
  override fun createCxxPart(): CxxPart {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitrogen",
3
- "version": "0.36.3",
3
+ "version": "0.36.4",
4
4
  "description": "Code generator for React Native Nitro Modules that turns TypeScript specs into C++, Swift, and Kotlin bindings.",
5
5
  "main": "lib/index",
6
6
  "types": "lib/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "chalk": "^5.3.0",
38
- "react-native-nitro-modules": "^0.36.3",
38
+ "react-native-nitro-modules": "^0.36.4",
39
39
  "ts-morph": "^28.0.0",
40
40
  "yargs": "^18.0.0",
41
41
  "zod": "^4.4.3"
@@ -24,12 +24,6 @@ export function createKotlinFunction(functionType: FunctionType): SourceFile[] {
24
24
  .getRequiredImports('kotlin')
25
25
  .map((i) => `import ${i.name}`)
26
26
  .filter(isNotDuplicate)
27
- const funcAnnotations: string[] = []
28
- if (!functionType.isSync) {
29
- // Async functions immediately schedule calls on a Dispatcher,
30
- // we can make those @FastNative as they are not doing any JNI allocations
31
- funcAnnotations.push('@FastNative')
32
- }
33
27
 
34
28
  const kotlinCode = `
35
29
  ${createFileMetadataString(`${name}.kt`)}
@@ -39,7 +33,6 @@ package ${packageName}
39
33
  import androidx.annotation.Keep
40
34
  import com.facebook.jni.HybridData
41
35
  import com.facebook.proguard.annotations.DoNotStrip
42
- import dalvik.annotation.optimization.FastNative
43
36
  ${extraImports.join('\n')}
44
37
 
45
38
  /**
@@ -88,7 +81,6 @@ class ${name}_cxx: ${name} {
88
81
  override fun invoke(${kotlinParams.join(', ')}): ${kotlinReturnType}
89
82
  = invoke_cxx(${kotlinParamsForward.join(',')})
90
83
 
91
- ${funcAnnotations.join('\n')}
92
84
  private external fun invoke_cxx(${kotlinParams.join(', ')}): ${kotlinReturnType}
93
85
  }
94
86
 
@@ -69,6 +69,7 @@ package ${javaPackage}
69
69
  import androidx.annotation.Keep
70
70
  import com.facebook.jni.HybridData
71
71
  import com.facebook.proguard.annotations.DoNotStrip
72
+ import dalvik.annotation.optimization.FastNative
72
73
  ${imports.join('\n')}
73
74
 
74
75
  /**
@@ -99,6 +100,7 @@ abstract class ${name.HybridTSpec}: ${kotlinBase}() {
99
100
  @Keep
100
101
  protected open class CxxPart(javaPart: ${name.HybridTSpec}): ${cxxPartBase}(javaPart) {
101
102
  // C++ ${name.JHybridTSpec}::CxxPart::initHybrid(...)
103
+ @FastNative
102
104
  external override fun initHybrid(): HybridData
103
105
  }
104
106
  override fun createCxxPart(): CxxPart {