nitrogen 0.33.2 → 0.33.3

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.
@@ -34,7 +34,6 @@ return ${returnType.parseFromSwiftToCpp('__result', 'swift')}
34
34
  const code = `
35
35
  ${createFileMetadataString(`${swiftClassName}.swift`)}
36
36
 
37
- import Foundation
38
37
  ${imports.join('\n')}
39
38
 
40
39
  /**
@@ -58,7 +58,6 @@ public ${hasBaseClass ? 'override func' : 'func'} getCxxWrapper() -> ${name.Hybr
58
58
  const protocolCode = `
59
59
  ${createFileMetadataString(`${protocolName}.swift`)}
60
60
 
61
- import Foundation
62
61
  ${imports.join('\n')}
63
62
 
64
63
  /// See \`\`${protocolName}\`\`
@@ -43,7 +43,7 @@ public final func afterUpdate() {
43
43
  }
44
44
  `.trim(), `
45
45
  public final func maybePrepareForRecycle() {
46
- guard let recyclable = __implementation as? RecyclableView else { return }
46
+ guard let recyclable = __implementation as? any RecyclableView else { return }
47
47
  recyclable.prepareForRecycle()
48
48
  }
49
49
  `.trim());
@@ -82,7 +82,6 @@ public override func getCxxPart() -> bridge.${baseBridge.specializationName} {
82
82
  const swiftCxxWrapperCode = `
83
83
  ${createFileMetadataString(`${name.HybridTSpecCxx}.swift`)}
84
84
 
85
- import Foundation
86
85
  ${imports.join('\n')}
87
86
 
88
87
  /**
@@ -28,7 +28,6 @@ var ${p.escapedName}: ${p.getCode('swift')} {
28
28
  const code = `
29
29
  ${createFileMetadataString(`${struct.structName}.swift`)}
30
30
 
31
- import Foundation
32
31
  ${imports.join('\n')}
33
32
 
34
33
  /**
@@ -225,7 +225,7 @@ namespace ${namespace} {
225
225
  void ${descriptorClassName}::adopt(react::ShadowNode& shadowNode) const {
226
226
  // This is called immediately after \`ShadowNode\` is created, cloned or in progress.
227
227
  // On Android, we need to wrap props in our state, which gets routed through Java and later unwrapped in JNI/C++.
228
- auto& concreteShadowNode = dynamic_cast<${shadowNodeClassName}&>(shadowNode);
228
+ auto& concreteShadowNode = static_cast<${shadowNodeClassName}&>(shadowNode);
229
229
  const ${propsClassName}& props = concreteShadowNode.getConcreteProps();
230
230
  ${stateClassName} state;
231
231
  state.setProps(props);
@@ -33,7 +33,7 @@ import ${javaNamespace}.*
33
33
  /**
34
34
  * Represents the React Native \`ViewManager\` for the "${spec.name}" Nitro HybridView.
35
35
  */
36
- open class ${manager}: SimpleViewManager<View>() {
36
+ public class ${manager}: SimpleViewManager<View>() {
37
37
  init {
38
38
  if (RecyclableView::class.java.isAssignableFrom(${viewImplementation}::class.java)) {
39
39
  // Enable view recycling
@@ -126,7 +126,7 @@ namespace ${cxxNamespace} {
126
126
 
127
127
  using namespace facebook;
128
128
 
129
- class J${stateUpdaterName}: public jni::JavaClass<J${stateUpdaterName}> {
129
+ class J${stateUpdaterName} final: public jni::JavaClass<J${stateUpdaterName}> {
130
130
  public:
131
131
  static constexpr auto kJavaDescriptor = "L${updaterJniDescriptor};";
132
132
 
@@ -186,7 +186,7 @@ void J${stateUpdaterName}::updateViewProps(jni::alias_ref<jni::JClass> /* class
186
186
  static_cast<react::StateWrapperImpl::javaobject>(rawStateWrapper)};
187
187
 
188
188
  std::shared_ptr<const react::State> state = stateWrapper->cthis()->getState();
189
- auto concreteState = std::dynamic_pointer_cast<const ConcreteStateData>(state);
189
+ auto concreteState = std::static_pointer_cast<const ConcreteStateData>(state);
190
190
  const ${stateClassName}& data = concreteState->getData();
191
191
  const std::optional<${propsClassName}>& maybeProps = data.getProps();
192
192
  if (!maybeProps.has_value()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitrogen",
3
- "version": "0.33.2",
3
+ "version": "0.33.3",
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.2",
38
+ "react-native-nitro-modules": "^0.33.3",
39
39
  "ts-morph": "^27.0.0",
40
40
  "yargs": "^18.0.0",
41
41
  "zod": "^4.0.5"
@@ -41,7 +41,6 @@ return ${returnType.parseFromSwiftToCpp('__result', 'swift')}
41
41
  const code = `
42
42
  ${createFileMetadataString(`${swiftClassName}.swift`)}
43
43
 
44
- import Foundation
45
44
  ${imports.join('\n')}
46
45
 
47
46
  /**
@@ -70,7 +70,6 @@ public ${hasBaseClass ? 'override func' : 'func'} getCxxWrapper() -> ${name.Hybr
70
70
  const protocolCode = `
71
71
  ${createFileMetadataString(`${protocolName}.swift`)}
72
72
 
73
- import Foundation
74
73
  ${imports.join('\n')}
75
74
 
76
75
  /// See \`\`${protocolName}\`\`
@@ -66,7 +66,7 @@ public final func afterUpdate() {
66
66
  `.trim(),
67
67
  `
68
68
  public final func maybePrepareForRecycle() {
69
- guard let recyclable = __implementation as? RecyclableView else { return }
69
+ guard let recyclable = __implementation as? any RecyclableView else { return }
70
70
  recyclable.prepareForRecycle()
71
71
  }
72
72
  `.trim()
@@ -130,7 +130,6 @@ public override func getCxxPart() -> bridge.${baseBridge.specializationName} {
130
130
  const swiftCxxWrapperCode = `
131
131
  ${createFileMetadataString(`${name.HybridTSpecCxx}.swift`)}
132
132
 
133
- import Foundation
134
133
  ${imports.join('\n')}
135
134
 
136
135
  /**
@@ -37,7 +37,6 @@ var ${p.escapedName}: ${p.getCode('swift')} {
37
37
  const code = `
38
38
  ${createFileMetadataString(`${struct.structName}.swift`)}
39
39
 
40
- import Foundation
41
40
  ${imports.join('\n')}
42
41
 
43
42
  /**
@@ -272,7 +272,7 @@ namespace ${namespace} {
272
272
  void ${descriptorClassName}::adopt(react::ShadowNode& shadowNode) const {
273
273
  // This is called immediately after \`ShadowNode\` is created, cloned or in progress.
274
274
  // On Android, we need to wrap props in our state, which gets routed through Java and later unwrapped in JNI/C++.
275
- auto& concreteShadowNode = dynamic_cast<${shadowNodeClassName}&>(shadowNode);
275
+ auto& concreteShadowNode = static_cast<${shadowNodeClassName}&>(shadowNode);
276
276
  const ${propsClassName}& props = concreteShadowNode.getConcreteProps();
277
277
  ${stateClassName} state;
278
278
  state.setProps(props);
@@ -53,7 +53,7 @@ import ${javaNamespace}.*
53
53
  /**
54
54
  * Represents the React Native \`ViewManager\` for the "${spec.name}" Nitro HybridView.
55
55
  */
56
- open class ${manager}: SimpleViewManager<View>() {
56
+ public class ${manager}: SimpleViewManager<View>() {
57
57
  init {
58
58
  if (RecyclableView::class.java.isAssignableFrom(${viewImplementation}::class.java)) {
59
59
  // Enable view recycling
@@ -152,7 +152,7 @@ namespace ${cxxNamespace} {
152
152
 
153
153
  using namespace facebook;
154
154
 
155
- class J${stateUpdaterName}: public jni::JavaClass<J${stateUpdaterName}> {
155
+ class J${stateUpdaterName} final: public jni::JavaClass<J${stateUpdaterName}> {
156
156
  public:
157
157
  static constexpr auto kJavaDescriptor = "L${updaterJniDescriptor};";
158
158
 
@@ -213,7 +213,7 @@ void J${stateUpdaterName}::updateViewProps(jni::alias_ref<jni::JClass> /* class
213
213
  static_cast<react::StateWrapperImpl::javaobject>(rawStateWrapper)};
214
214
 
215
215
  std::shared_ptr<const react::State> state = stateWrapper->cthis()->getState();
216
- auto concreteState = std::dynamic_pointer_cast<const ConcreteStateData>(state);
216
+ auto concreteState = std::static_pointer_cast<const ConcreteStateData>(state);
217
217
  const ${stateClassName}& data = concreteState->getData();
218
218
  const std::optional<${propsClassName}>& maybeProps = data.getProps();
219
219
  if (!maybeProps.has_value()) {