nitrogen 0.36.2 → 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.
- package/lib/syntax/kotlin/KotlinFunction.js +0 -2
- package/lib/syntax/kotlin/KotlinHybridObject.js +2 -0
- package/lib/syntax/types/FunctionType.d.ts +1 -0
- package/lib/syntax/types/FunctionType.js +2 -0
- package/package.json +2 -2
- package/src/syntax/kotlin/KotlinFunction.ts +0 -2
- package/src/syntax/kotlin/KotlinHybridObject.ts +2 -0
- package/src/syntax/types/FunctionType.ts +2 -0
|
@@ -24,7 +24,6 @@ package ${packageName}
|
|
|
24
24
|
import androidx.annotation.Keep
|
|
25
25
|
import com.facebook.jni.HybridData
|
|
26
26
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
27
|
-
import dalvik.annotation.optimization.FastNative
|
|
28
27
|
${extraImports.join('\n')}
|
|
29
28
|
|
|
30
29
|
/**
|
|
@@ -73,7 +72,6 @@ class ${name}_cxx: ${name} {
|
|
|
73
72
|
override fun invoke(${kotlinParams.join(', ')}): ${kotlinReturnType}
|
|
74
73
|
= invoke_cxx(${kotlinParamsForward.join(',')})
|
|
75
74
|
|
|
76
|
-
@FastNative
|
|
77
75
|
private external fun invoke_cxx(${kotlinParams.join(', ')}): ${kotlinReturnType}
|
|
78
76
|
}
|
|
79
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 {
|
|
@@ -7,6 +7,7 @@ export interface GetFunctionCodeOptions extends GetCodeOptions {
|
|
|
7
7
|
export declare class FunctionType implements Type {
|
|
8
8
|
readonly returnType: Type;
|
|
9
9
|
readonly parameters: NamedType[];
|
|
10
|
+
readonly isSync: boolean;
|
|
10
11
|
constructor(returnType: Type, parameters: NamedType[], isSync?: boolean);
|
|
11
12
|
get specializationName(): string;
|
|
12
13
|
get jsName(): string;
|
|
@@ -5,6 +5,7 @@ import { PromiseType } from './PromiseType.js';
|
|
|
5
5
|
export class FunctionType {
|
|
6
6
|
returnType;
|
|
7
7
|
parameters;
|
|
8
|
+
isSync;
|
|
8
9
|
constructor(returnType, parameters, isSync = false) {
|
|
9
10
|
if (returnType.kind === 'void' || isSync) {
|
|
10
11
|
// void callbacks are async, but we don't care about the result.
|
|
@@ -15,6 +16,7 @@ export class FunctionType {
|
|
|
15
16
|
this.returnType = new PromiseType(returnType);
|
|
16
17
|
}
|
|
17
18
|
this.parameters = parameters;
|
|
19
|
+
this.isSync = isSync;
|
|
18
20
|
if (isSync && returnType.kind === 'void') {
|
|
19
21
|
throw new Error(`Function \`${this.jsName}\` cannot be sync (\`Sync<...>\`) AND return \`void\`, as this is ambiguous. ` +
|
|
20
22
|
`Either return a value (even if it's just a \`boolean\`) to keep it sync, or make it async.`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitrogen",
|
|
3
|
-
"version": "0.36.
|
|
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.
|
|
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"
|
|
@@ -33,7 +33,6 @@ package ${packageName}
|
|
|
33
33
|
import androidx.annotation.Keep
|
|
34
34
|
import com.facebook.jni.HybridData
|
|
35
35
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
36
|
-
import dalvik.annotation.optimization.FastNative
|
|
37
36
|
${extraImports.join('\n')}
|
|
38
37
|
|
|
39
38
|
/**
|
|
@@ -82,7 +81,6 @@ class ${name}_cxx: ${name} {
|
|
|
82
81
|
override fun invoke(${kotlinParams.join(', ')}): ${kotlinReturnType}
|
|
83
82
|
= invoke_cxx(${kotlinParamsForward.join(',')})
|
|
84
83
|
|
|
85
|
-
@FastNative
|
|
86
84
|
private external fun invoke_cxx(${kotlinParams.join(', ')}): ${kotlinReturnType}
|
|
87
85
|
}
|
|
88
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 {
|
|
@@ -12,6 +12,7 @@ export interface GetFunctionCodeOptions extends GetCodeOptions {
|
|
|
12
12
|
export class FunctionType implements Type {
|
|
13
13
|
readonly returnType: Type
|
|
14
14
|
readonly parameters: NamedType[]
|
|
15
|
+
readonly isSync: boolean
|
|
15
16
|
|
|
16
17
|
constructor(returnType: Type, parameters: NamedType[], isSync = false) {
|
|
17
18
|
if (returnType.kind === 'void' || isSync) {
|
|
@@ -22,6 +23,7 @@ export class FunctionType implements Type {
|
|
|
22
23
|
this.returnType = new PromiseType(returnType)
|
|
23
24
|
}
|
|
24
25
|
this.parameters = parameters
|
|
26
|
+
this.isSync = isSync
|
|
25
27
|
|
|
26
28
|
if (isSync && returnType.kind === 'void') {
|
|
27
29
|
throw new Error(
|