@react-native/codegen 0.85.0-nightly-20260208-0dd9e73be → 0.85.0-nightly-20260217-db45c280e

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.
@@ -12,6 +12,7 @@
12
12
 
13
13
  const {
14
14
  IncorrectModuleRegistryCallArgumentTypeParserError,
15
+ IncorrectModuleRegistryCallArgumentValueParserError,
15
16
  IncorrectModuleRegistryCallArityParserError,
16
17
  IncorrectModuleRegistryCallTypeParameterParserError,
17
18
  MisnamedModuleInterfaceParserError,
@@ -284,6 +285,15 @@ function throwIfIncorrectModuleRegistryCallArgument(
284
285
  type,
285
286
  );
286
287
  }
288
+ const value = callExpressionArg.value;
289
+ if (typeof value !== 'string' || !/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(value)) {
290
+ throw new IncorrectModuleRegistryCallArgumentValueParserError(
291
+ nativeModuleName,
292
+ callExpressionArg,
293
+ methodName,
294
+ String(value),
295
+ );
296
+ }
287
297
  }
288
298
  function throwIfPartialNotAnnotatingTypeParameter(
289
299
  typeAnnotation,
@@ -17,6 +17,7 @@ import type {Parser} from './parser';
17
17
 
18
18
  const {
19
19
  IncorrectModuleRegistryCallArgumentTypeParserError,
20
+ IncorrectModuleRegistryCallArgumentValueParserError,
20
21
  IncorrectModuleRegistryCallArityParserError,
21
22
  IncorrectModuleRegistryCallTypeParameterParserError,
22
23
  MisnamedModuleInterfaceParserError,
@@ -309,6 +310,16 @@ function throwIfIncorrectModuleRegistryCallArgument(
309
310
  type,
310
311
  );
311
312
  }
313
+
314
+ const value = callExpressionArg.value;
315
+ if (typeof value !== 'string' || !/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(value)) {
316
+ throw new IncorrectModuleRegistryCallArgumentValueParserError(
317
+ nativeModuleName,
318
+ callExpressionArg,
319
+ methodName,
320
+ String(value),
321
+ );
322
+ }
312
323
  }
313
324
 
314
325
  function throwIfPartialNotAnnotatingTypeParameter(
@@ -329,6 +329,15 @@ class IncorrectModuleRegistryCallArgumentTypeParserError extends ParserError {
329
329
  );
330
330
  }
331
331
  }
332
+ class IncorrectModuleRegistryCallArgumentValueParserError extends ParserError {
333
+ constructor(nativeModuleName, flowArgument, methodName, value) {
334
+ super(
335
+ nativeModuleName,
336
+ flowArgument,
337
+ `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, '?')}'`,
338
+ );
339
+ }
340
+ }
332
341
  module.exports = {
333
342
  ParserError,
334
343
  MissingTypeParameterGenericParserError,
@@ -356,4 +365,5 @@ module.exports = {
356
365
  IncorrectModuleRegistryCallTypeParameterParserError,
357
366
  IncorrectModuleRegistryCallArityParserError,
358
367
  IncorrectModuleRegistryCallArgumentTypeParserError,
368
+ IncorrectModuleRegistryCallArgumentValueParserError,
359
369
  };
@@ -425,6 +425,21 @@ class IncorrectModuleRegistryCallArgumentTypeParserError extends ParserError {
425
425
  }
426
426
  }
427
427
 
428
+ class IncorrectModuleRegistryCallArgumentValueParserError extends ParserError {
429
+ constructor(
430
+ nativeModuleName: string,
431
+ flowArgument: $FlowFixMe,
432
+ methodName: string,
433
+ value: string,
434
+ ) {
435
+ super(
436
+ nativeModuleName,
437
+ flowArgument,
438
+ `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, '?')}'`,
439
+ );
440
+ }
441
+ }
442
+
428
443
  module.exports = {
429
444
  ParserError,
430
445
  MissingTypeParameterGenericParserError,
@@ -452,4 +467,5 @@ module.exports = {
452
467
  IncorrectModuleRegistryCallTypeParameterParserError,
453
468
  IncorrectModuleRegistryCallArityParserError,
454
469
  IncorrectModuleRegistryCallArgumentTypeParserError,
470
+ IncorrectModuleRegistryCallArgumentValueParserError,
455
471
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/codegen",
3
- "version": "0.85.0-nightly-20260208-0dd9e73be",
3
+ "version": "0.85.0-nightly-20260217-db45c280e",
4
4
  "description": "Code generation tools for React Native",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -30,7 +30,7 @@
30
30
  ],
31
31
  "dependencies": {
32
32
  "@babel/core": "^7.25.2",
33
- "@babel/parser": "^7.25.3",
33
+ "@babel/parser": "^7.29.0",
34
34
  "hermes-parser": "0.33.3",
35
35
  "invariant": "^2.2.4",
36
36
  "nullthrows": "^1.1.1",