🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

react-native-codegen

Package Overview
Dependencies
Maintainers
10
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-codegen - npm Package Compare versions

Comparing version

to
0.72.0

86

lib/generators/modules/__test_fixtures__/fixtures.js

@@ -274,2 +274,21 @@ /**

{
name: 'getValueWithOptionalArg',
optional: false,
typeAnnotation: {
type: 'FunctionTypeAnnotation',
returnTypeAnnotation: {
type: 'PromiseTypeAnnotation',
},
params: [
{
optional: true,
name: 'parameter',
typeAnnotation: {
type: 'GenericObjectTypeAnnotation',
},
},
],
},
},
{
name: 'getEnums',

@@ -1200,69 +1219,2 @@ optional: false,

},
NativeImagePickerIOS: {
type: 'NativeModule',
aliases: {},
spec: {
properties: [
{
name: 'openCameraDialog',
optional: false,
typeAnnotation: {
type: 'FunctionTypeAnnotation',
returnTypeAnnotation: {
type: 'VoidTypeAnnotation',
},
params: [
{
optional: false,
name: 'config',
typeAnnotation: {
type: 'ObjectTypeAnnotation',
properties: [
{
optional: false,
name: 'unmirrorFrontFacingCamera',
typeAnnotation: {
type: 'BooleanTypeAnnotation',
},
},
{
optional: false,
name: 'videoMode',
typeAnnotation: {
type: 'BooleanTypeAnnotation',
},
},
],
},
},
{
name: 'successCallback',
optional: false,
typeAnnotation: {
type: 'FunctionTypeAnnotation',
params: [],
returnTypeAnnotation: {
type: 'VoidTypeAnnotation',
},
},
},
{
name: 'cancelCallback',
optional: false,
typeAnnotation: {
type: 'FunctionTypeAnnotation',
params: [],
returnTypeAnnotation: {
type: 'VoidTypeAnnotation',
},
},
},
],
},
},
],
},
moduleNames: ['ImagePickerIOS'],
excludedPlatforms: ['android'],
},
NativeExceptionsManager: {

@@ -1269,0 +1221,0 @@ type: 'NativeModule',

@@ -151,3 +151,4 @@ /**

function serializeArg(arg, index, resolveAlias) {
const nullableTypeAnnotation = arg.typeAnnotation;
const nullableTypeAnnotation = arg.typeAnnotation,
optional = arg.optional;

@@ -159,2 +160,3 @@ const _unwrapNullable = unwrapNullable(nullableTypeAnnotation),

const isRequired = !optional && !nullable;
let realTypeAnnotation = typeAnnotation;

@@ -170,7 +172,13 @@

if (nullable) {
return `${val}.isNull() || ${val}.isUndefined() ? std::nullopt : std::make_optional(${expression})`;
if (isRequired) {
return expression;
} else {
let condition = `${val}.isNull() || ${val}.isUndefined()`;
if (optional) {
condition = `count < ${index} || ${condition}`;
}
return `${condition} ? std::nullopt : std::make_optional(${expression})`;
}
return expression;
}

@@ -177,0 +185,0 @@

@@ -159,2 +159,3 @@ /**

nullableTypeAnnotation,
optional,
createErrorMessage,

@@ -168,2 +169,3 @@ resolveAlias,

const isRequired = !optional && !nullable;
let realTypeAnnotation = typeAnnotation;

@@ -176,3 +178,3 @@

function wrap(type) {
return nullable ? `std::optional<${type}>` : type;
return isRequired ? type : `std::optional<${type}>`;
}

@@ -274,2 +276,3 @@

param.typeAnnotation,
param.optional,
typeName =>

@@ -283,2 +286,3 @@ `Unsupported type for param "${param.name}" in ${prop.name}. Found: ${typeName}`,

propTypeAnnotation.returnTypeAnnotation,
false,
typeName => `Unsupported return type for ${prop.name}. Found: ${typeName}`,

@@ -285,0 +289,0 @@ resolveAlias,

@@ -145,3 +145,2 @@ /**

_require5.assertGenericTypeAnnotationHasExactlyOneTypeParameter,
emitMixedTypeAnnotation = _require5.emitMixedTypeAnnotation,
emitUnionTypeAnnotation = _require5.emitUnionTypeAnnotation,

@@ -163,2 +162,3 @@ translateDefault = _require5.translateDefault;

emitStringish = _require6.emitStringish,
emitMixedTypeAnnotation = _require6.emitMixedTypeAnnotation,
typeAliasResolution = _require6.typeAliasResolution;

@@ -165,0 +165,0 @@

@@ -92,8 +92,2 @@ /**

function emitMixedTypeAnnotation(nullable) {
return wrapNullable(nullable, {
type: 'MixedTypeAnnotation',
});
}
function remapUnionTypeAnnotationMemberNames(types, language) {

@@ -221,3 +215,2 @@ const remapLiteral = item => {

assertGenericTypeAnnotationHasExactlyOneTypeParameter,
emitMixedTypeAnnotation,
emitUnionTypeAnnotation,

@@ -224,0 +217,0 @@ getKeyName,

@@ -64,2 +64,8 @@ /**

function emitMixedTypeAnnotation(nullable) {
return wrapNullable(nullable, {
type: 'MixedTypeAnnotation',
});
}
function emitString(nullable) {

@@ -157,3 +163,4 @@ return wrapNullable(nullable, {

emitStringish,
emitMixedTypeAnnotation,
typeAliasResolution,
};

@@ -147,3 +147,2 @@ /**

_require5.assertGenericTypeAnnotationHasExactlyOneTypeParameter,
emitMixedTypeAnnotation = _require5.emitMixedTypeAnnotation,
emitUnionTypeAnnotation = _require5.emitUnionTypeAnnotation,

@@ -165,2 +164,3 @@ translateDefault = _require5.translateDefault;

emitStringish = _require6.emitStringish,
emitMixedTypeAnnotation = _require6.emitMixedTypeAnnotation,
typeAliasResolution = _require6.typeAliasResolution;

@@ -167,0 +167,0 @@

{
"name": "react-native-codegen",
"version": "0.71.2",
"version": "0.72.0",
"description": "⚛️ Code generation tools for React Native",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-codegen",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet