nitrogen 0.33.0 → 0.33.1
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/swift/SwiftHybridObjectRegistration.d.ts +1 -0
- package/lib/syntax/swift/SwiftHybridObjectRegistration.js +7 -2
- package/lib/views/swift/SwiftHybridViewManager.js +2 -2
- package/package.json +2 -2
- package/src/syntax/swift/SwiftHybridObjectRegistration.ts +8 -2
- package/src/views/swift/SwiftHybridViewManager.ts +2 -1
- package/lib/syntax/types/Int32Type.d.ts +0 -10
- package/lib/syntax/types/Int32Type.js +0 -36
|
@@ -14,6 +14,7 @@ interface SwiftHybridObjectRegistration {
|
|
|
14
14
|
swiftRegistrationClass: string;
|
|
15
15
|
requiredImports: SourceImport[];
|
|
16
16
|
}
|
|
17
|
+
export declare function getAutolinkingClassName(hybridObjectName: string): string;
|
|
17
18
|
export declare function getAutolinkingNamespace(): string;
|
|
18
19
|
export declare function getHybridObjectConstructorCall(hybridObjectName: string): string;
|
|
19
20
|
export declare function createSwiftHybridObjectRegistration({ hybridObjectName, swiftClassName, }: Props): SwiftHybridObjectRegistration;
|
|
@@ -3,6 +3,9 @@ import { indent } from '../../utils.js';
|
|
|
3
3
|
import { getHybridObjectName } from '../getHybridObjectName.js';
|
|
4
4
|
import { HybridObjectType } from '../types/HybridObjectType.js';
|
|
5
5
|
import { SwiftCxxBridgedType } from './SwiftCxxBridgedType.js';
|
|
6
|
+
export function getAutolinkingClassName(hybridObjectName) {
|
|
7
|
+
return `Autolinked${hybridObjectName}`;
|
|
8
|
+
}
|
|
6
9
|
export function getAutolinkingNamespace() {
|
|
7
10
|
const swiftNamespace = NitroConfig.current.getIosModuleName();
|
|
8
11
|
const autolinkingClassName = `${swiftNamespace}Autolinking`;
|
|
@@ -10,15 +13,17 @@ export function getAutolinkingNamespace() {
|
|
|
10
13
|
}
|
|
11
14
|
export function getHybridObjectConstructorCall(hybridObjectName) {
|
|
12
15
|
const namespace = getAutolinkingNamespace();
|
|
13
|
-
|
|
16
|
+
const autolinkingClassName = getAutolinkingClassName(hybridObjectName);
|
|
17
|
+
return `${namespace}::${autolinkingClassName}::create();`;
|
|
14
18
|
}
|
|
15
19
|
export function createSwiftHybridObjectRegistration({ hybridObjectName, swiftClassName, }) {
|
|
16
20
|
const { HybridTSpecSwift } = getHybridObjectName(hybridObjectName);
|
|
17
21
|
const type = new HybridObjectType(hybridObjectName, 'swift', [], NitroConfig.current);
|
|
18
22
|
const bridge = new SwiftCxxBridgedType(type);
|
|
23
|
+
const autolinkingClassName = getAutolinkingClassName(hybridObjectName);
|
|
19
24
|
return {
|
|
20
25
|
swiftRegistrationClass: `
|
|
21
|
-
public final class ${
|
|
26
|
+
public final class ${autolinkingClassName}: AutolinkedClass {
|
|
22
27
|
public static func create() -> ${bridge.getTypeCode('swift')} {
|
|
23
28
|
let hybridObject = ${swiftClassName}()
|
|
24
29
|
return ${indent(bridge.parseFromSwiftToCpp('hybridObject', 'swift'), ' ')}
|
|
@@ -2,7 +2,7 @@ import { createViewComponentShadowNodeFiles, getViewComponentNames, } from '../C
|
|
|
2
2
|
import { createFileMetadataString, escapeCppName, } from '../../syntax/helpers.js';
|
|
3
3
|
import { getUmbrellaHeaderName } from '../../autolinking/ios/createSwiftUmbrellaHeader.js';
|
|
4
4
|
import { getHybridObjectName } from '../../syntax/getHybridObjectName.js';
|
|
5
|
-
import { getAutolinkingNamespace, getHybridObjectConstructorCall, } from '../../syntax/swift/SwiftHybridObjectRegistration.js';
|
|
5
|
+
import { getAutolinkingClassName, getAutolinkingNamespace, getHybridObjectConstructorCall, } from '../../syntax/swift/SwiftHybridObjectRegistration.js';
|
|
6
6
|
import { indent } from '../../utils.js';
|
|
7
7
|
import { SwiftCxxBridgedType } from '../../syntax/swift/SwiftCxxBridgedType.js';
|
|
8
8
|
export function createSwiftHybridViewManager(spec) {
|
|
@@ -118,7 +118,7 @@ using namespace ${namespace}::views;
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
+ (BOOL)shouldBeRecycled {
|
|
121
|
-
return ${getAutolinkingNamespace()}::${spec.name}::isRecyclableHybridView();
|
|
121
|
+
return ${getAutolinkingNamespace()}::${getAutolinkingClassName(spec.name)}::isRecyclableHybridView();
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
- (void)prepareForRecycle {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nitrogen",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.1",
|
|
4
4
|
"description": "The code-generator for react-native-nitro-modules.",
|
|
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.33.
|
|
38
|
+
"react-native-nitro-modules": "^0.33.1",
|
|
39
39
|
"ts-morph": "^27.0.0",
|
|
40
40
|
"yargs": "^18.0.0",
|
|
41
41
|
"zod": "^4.0.5"
|
|
@@ -22,6 +22,10 @@ interface SwiftHybridObjectRegistration {
|
|
|
22
22
|
requiredImports: SourceImport[]
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
export function getAutolinkingClassName(hybridObjectName: string): string {
|
|
26
|
+
return `Autolinked${hybridObjectName}`
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
export function getAutolinkingNamespace() {
|
|
26
30
|
const swiftNamespace = NitroConfig.current.getIosModuleName()
|
|
27
31
|
const autolinkingClassName = `${swiftNamespace}Autolinking`
|
|
@@ -32,7 +36,8 @@ export function getHybridObjectConstructorCall(
|
|
|
32
36
|
hybridObjectName: string
|
|
33
37
|
): string {
|
|
34
38
|
const namespace = getAutolinkingNamespace()
|
|
35
|
-
|
|
39
|
+
const autolinkingClassName = getAutolinkingClassName(hybridObjectName)
|
|
40
|
+
return `${namespace}::${autolinkingClassName}::create();`
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
export function createSwiftHybridObjectRegistration({
|
|
@@ -48,10 +53,11 @@ export function createSwiftHybridObjectRegistration({
|
|
|
48
53
|
NitroConfig.current
|
|
49
54
|
)
|
|
50
55
|
const bridge = new SwiftCxxBridgedType(type)
|
|
56
|
+
const autolinkingClassName = getAutolinkingClassName(hybridObjectName)
|
|
51
57
|
|
|
52
58
|
return {
|
|
53
59
|
swiftRegistrationClass: `
|
|
54
|
-
public final class ${
|
|
60
|
+
public final class ${autolinkingClassName}: AutolinkedClass {
|
|
55
61
|
public static func create() -> ${bridge.getTypeCode('swift')} {
|
|
56
62
|
let hybridObject = ${swiftClassName}()
|
|
57
63
|
return ${indent(bridge.parseFromSwiftToCpp('hybridObject', 'swift'), ' ')}
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import { getUmbrellaHeaderName } from '../../autolinking/ios/createSwiftUmbrellaHeader.js'
|
|
12
12
|
import { getHybridObjectName } from '../../syntax/getHybridObjectName.js'
|
|
13
13
|
import {
|
|
14
|
+
getAutolinkingClassName,
|
|
14
15
|
getAutolinkingNamespace,
|
|
15
16
|
getHybridObjectConstructorCall,
|
|
16
17
|
} from '../../syntax/swift/SwiftHybridObjectRegistration.js'
|
|
@@ -142,7 +143,7 @@ using namespace ${namespace}::views;
|
|
|
142
143
|
}
|
|
143
144
|
|
|
144
145
|
+ (BOOL)shouldBeRecycled {
|
|
145
|
-
return ${getAutolinkingNamespace()}::${spec.name}::isRecyclableHybridView();
|
|
146
|
+
return ${getAutolinkingNamespace()}::${getAutolinkingClassName(spec.name)}::isRecyclableHybridView();
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
- (void)prepareForRecycle {
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Language } from '../../getPlatformSpecs.js';
|
|
2
|
-
import type { SourceFile, SourceImport } from '../SourceFile.js';
|
|
3
|
-
import type { Type, TypeKind } from './Type.js';
|
|
4
|
-
export declare class Int32Type implements Type {
|
|
5
|
-
get canBePassedByReference(): boolean;
|
|
6
|
-
get kind(): TypeKind;
|
|
7
|
-
getCode(language: Language): string;
|
|
8
|
-
getExtraFiles(): SourceFile[];
|
|
9
|
-
getRequiredImports(language: Language): SourceImport[];
|
|
10
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export class Int32Type {
|
|
2
|
-
get canBePassedByReference() {
|
|
3
|
-
// It's a primitive
|
|
4
|
-
return false;
|
|
5
|
-
}
|
|
6
|
-
get kind() {
|
|
7
|
-
return 'int32';
|
|
8
|
-
}
|
|
9
|
-
getCode(language) {
|
|
10
|
-
switch (language) {
|
|
11
|
-
case 'c++':
|
|
12
|
-
return 'int32_t';
|
|
13
|
-
case 'swift':
|
|
14
|
-
return 'Int32';
|
|
15
|
-
case 'kotlin':
|
|
16
|
-
return 'Int';
|
|
17
|
-
default:
|
|
18
|
-
throw new Error(`Language ${language} is not yet supported for Int32Type!`);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
getExtraFiles() {
|
|
22
|
-
return [];
|
|
23
|
-
}
|
|
24
|
-
getRequiredImports(language) {
|
|
25
|
-
if (language === 'c++') {
|
|
26
|
-
return [
|
|
27
|
-
{
|
|
28
|
-
language: language,
|
|
29
|
-
name: 'cstdint',
|
|
30
|
-
space: 'system',
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
return [];
|
|
35
|
-
}
|
|
36
|
-
}
|