@react-native/codegen
Advanced tools
@@ -15,2 +15,3 @@ /** | ||
| IncorrectModuleRegistryCallArgumentTypeParserError, | ||
| IncorrectModuleRegistryCallArgumentValueParserError, | ||
| IncorrectModuleRegistryCallArityParserError, | ||
@@ -288,2 +289,11 @@ IncorrectModuleRegistryCallTypeParameterParserError, | ||
| } | ||
| const value = callExpressionArg.value; | ||
| if (typeof value !== 'string' || !/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(value)) { | ||
| throw new IncorrectModuleRegistryCallArgumentValueParserError( | ||
| nativeModuleName, | ||
| callExpressionArg, | ||
| methodName, | ||
| String(value), | ||
| ); | ||
| } | ||
| } | ||
@@ -290,0 +300,0 @@ function throwIfPartialNotAnnotatingTypeParameter( |
@@ -332,2 +332,11 @@ /** | ||
| } | ||
| class IncorrectModuleRegistryCallArgumentValueParserError extends ParserError { | ||
| constructor(nativeModuleName, flowArgument, methodName, value) { | ||
| super( | ||
| nativeModuleName, | ||
| flowArgument, | ||
| `Please call TurboModuleRegistry.${methodName}<Spec>() with a safe module name. Module names must only contain alphanumeric characters and underscores (matching /^[a-zA-Z_][a-zA-Z0-9_]*$/). Got '${value.replace(/[^\x20-\x7e]/g, '?')}'`, | ||
| ); | ||
| } | ||
| } | ||
| module.exports = { | ||
@@ -360,2 +369,3 @@ ParserError, | ||
| IncorrectModuleRegistryCallArgumentTypeParserError, | ||
| IncorrectModuleRegistryCallArgumentValueParserError, | ||
| }; |
+2
-2
| { | ||
| "name": "@react-native/codegen", | ||
| "version": "0.85.0-nightly-20260210-4535df4f6", | ||
| "version": "0.85.0-nightly-20260217-db45c280e", | ||
| "description": "Code generation tools for React Native", | ||
@@ -33,3 +33,3 @@ "license": "MIT", | ||
| "@babel/core": "^7.25.2", | ||
| "@babel/parser": "^7.25.3", | ||
| "@babel/parser": "^7.29.0", | ||
| "hermes-parser": "0.33.3", | ||
@@ -36,0 +36,0 @@ "invariant": "^2.2.4", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1113789
0.16%17106
0.12%Updated