babel-plugin-react-compiler 0.0.0-experimental-ecdd742-20250312 → 0.0.0-experimental-3229e95-20250314

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +24 -9
  2. package/dist/index.js +2902 -1653
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -33,7 +33,13 @@ type PropType = {
33
33
  kind: 'Property';
34
34
  objectType: Type;
35
35
  objectName: string;
36
- propertyName: PropertyLiteral;
36
+ propertyName: {
37
+ kind: 'literal';
38
+ value: PropertyLiteral;
39
+ } | {
40
+ kind: 'computed';
41
+ value: Type;
42
+ };
37
43
  };
38
44
  type ObjectMethod$1 = {
39
45
  kind: 'ObjectMethod';
@@ -71,6 +77,7 @@ declare const ExternalFunctionSchema: z.ZodObject<{
71
77
  importSpecifierName: string;
72
78
  }>;
73
79
  type ExternalFunction = z.infer<typeof ExternalFunctionSchema>;
80
+ type CompilerMode = 'all_features' | 'no_inferred_memo';
74
81
  declare const HookSchema: z.ZodObject<{
75
82
  effectKind: z.ZodNativeEnum<typeof Effect>;
76
83
  valueKind: z.ZodNativeEnum<typeof ValueKind>;
@@ -268,7 +275,6 @@ declare const EnvironmentConfigSchema: z.ZodObject<{
268
275
  throwUnknownException__testonly: z.ZodDefault<z.ZodBoolean>;
269
276
  enableTreatFunctionDepsAsConditional: z.ZodDefault<z.ZodBoolean>;
270
277
  disableMemoizationForDebugging: z.ZodDefault<z.ZodBoolean>;
271
- enableMinimalTransformsForRetry: z.ZodDefault<z.ZodBoolean>;
272
278
  enableChangeDetectionForDebugging: z.ZodDefault<z.ZodNullable<z.ZodObject<{
273
279
  source: z.ZodString;
274
280
  importSpecifierName: z.ZodString;
@@ -364,7 +370,6 @@ declare const EnvironmentConfigSchema: z.ZodObject<{
364
370
  throwUnknownException__testonly: boolean;
365
371
  enableTreatFunctionDepsAsConditional: boolean;
366
372
  disableMemoizationForDebugging: boolean;
367
- enableMinimalTransformsForRetry: boolean;
368
373
  enableChangeDetectionForDebugging: {
369
374
  source: string;
370
375
  importSpecifierName: string;
@@ -448,7 +453,6 @@ declare const EnvironmentConfigSchema: z.ZodObject<{
448
453
  throwUnknownException__testonly?: boolean | undefined;
449
454
  enableTreatFunctionDepsAsConditional?: boolean | undefined;
450
455
  disableMemoizationForDebugging?: boolean | undefined;
451
- enableMinimalTransformsForRetry?: boolean | undefined;
452
456
  enableChangeDetectionForDebugging?: {
453
457
  source: string;
454
458
  importSpecifierName: string;
@@ -474,10 +478,12 @@ declare class Environment {
474
478
  code: string | null;
475
479
  config: EnvironmentConfig;
476
480
  fnType: ReactFunctionType;
481
+ compilerMode: CompilerMode;
477
482
  useMemoCacheIdentifier: string;
478
483
  hasLoweredContextAccess: boolean;
479
484
  hasFireRewrite: boolean;
480
- constructor(scope: Scope, fnType: ReactFunctionType, config: EnvironmentConfig, contextIdentifiers: Set<t.Identifier>, logger: Logger | null, filename: string | null, code: string | null, useMemoCacheIdentifier: string);
485
+ constructor(scope: Scope, fnType: ReactFunctionType, compilerMode: CompilerMode, config: EnvironmentConfig, contextIdentifiers: Set<t.Identifier>, logger: Logger | null, filename: string | null, code: string | null, useMemoCacheIdentifier: string);
486
+ get isInferredMemoEnabled(): boolean;
481
487
  get nextIdentifierId(): IdentifierId;
482
488
  get nextBlockId(): BlockId;
483
489
  get nextScopeId(): ScopeId;
@@ -490,7 +496,9 @@ declare class Environment {
490
496
  type: ReactFunctionType | null;
491
497
  }>;
492
498
  getGlobalDeclaration(binding: NonLocalBinding, loc: SourceLocation): Global | null;
493
- getPropertyType(receiver: Type, property: string): BuiltInType | PolyType | null;
499
+ static knownReactModules: ReadonlyArray<string>;
500
+ getFallthroughPropertyType(receiver: Type, _property: Type): BuiltInType | PolyType | null;
501
+ getPropertyType(receiver: Type, property: string | number): BuiltInType | PolyType | null;
494
502
  getFunctionSignature(type: FunctionType): FunctionSignature | null;
495
503
  addHoistedIdentifier(node: t.Identifier): void;
496
504
  }
@@ -1455,7 +1463,7 @@ type CompilerPipelineValue = {
1455
1463
  name: string;
1456
1464
  value: string;
1457
1465
  };
1458
- declare function compileFn(func: NodePath<t.FunctionDeclaration | t.ArrowFunctionExpression | t.FunctionExpression>, config: EnvironmentConfig, fnType: ReactFunctionType, useMemoCacheIdentifier: string, logger: Logger | null, filename: string | null, code: string | null): CodegenFunction;
1466
+ declare function compileFn(func: NodePath<t.FunctionDeclaration | t.ArrowFunctionExpression | t.FunctionExpression>, config: EnvironmentConfig, fnType: ReactFunctionType, mode: CompilerMode, useMemoCacheIdentifier: string, logger: Logger | null, filename: string | null, code: string | null): CodegenFunction;
1459
1467
 
1460
1468
  declare const PanicThresholdOptionsSchema: z.ZodEnum<["all_errors", "critical_errors", "none"]>;
1461
1469
  type PanicThresholdOptions = z.infer<typeof PanicThresholdOptionsSchema>;
@@ -1538,7 +1546,14 @@ declare const OPT_IN_DIRECTIVES: Set<string>;
1538
1546
  declare const OPT_OUT_DIRECTIVES: Set<string>;
1539
1547
  declare function findDirectiveEnablingMemoization(directives: Array<t.Directive>): Array<t.Directive>;
1540
1548
  declare function findDirectiveDisablingMemoization(directives: Array<t.Directive>): Array<t.Directive>;
1541
- declare function compileProgram(program: NodePath$1<t.Program>, pass: CompilerPass): void;
1549
+ type BabelFn = NodePath$1<t.FunctionDeclaration> | NodePath$1<t.FunctionExpression> | NodePath$1<t.ArrowFunctionExpression>;
1550
+ type CompileProgramResult = {
1551
+ retryErrors: Array<{
1552
+ fn: BabelFn;
1553
+ error: CompilerError;
1554
+ }>;
1555
+ };
1556
+ declare function compileProgram(program: NodePath$1<t.Program>, pass: CompilerPass): CompileProgramResult | null;
1542
1557
 
1543
1558
  declare function runBabelPluginReactCompiler(text: string, file: string, language: 'flow' | 'typescript', options: Partial<PluginOptions> | null, includeAst?: boolean): BabelCore.BabelFileResult;
1544
1559
 
@@ -1548,4 +1563,4 @@ declare global {
1548
1563
  let __DEV__: boolean | null | undefined;
1549
1564
  }
1550
1565
 
1551
- export { CompilerError, CompilerErrorDetail, type CompilerErrorDetailOptions, type CompilerPipelineValue, CompilerSuggestionOperation, Effect, type EnvironmentConfig, ErrorSeverity, type ExternalFunction, type Hook, OPT_IN_DIRECTIVES, OPT_OUT_DIRECTIVES, type PluginOptions, type SourceLocation, ValueKind, compileFn as compile, compileProgram, BabelPluginReactCompiler as default, findDirectiveDisablingMemoization, findDirectiveEnablingMemoization, parseConfigPragmaForTests, parsePluginOptions, printHIR, printReactiveFunction, runBabelPluginReactCompiler, validateEnvironmentConfig };
1566
+ export { CompilerError, CompilerErrorDetail, type CompilerErrorDetailOptions, type CompilerPipelineValue, CompilerSuggestionOperation, Effect, type EnvironmentConfig, ErrorSeverity, type ExternalFunction, type Hook, type Logger, type LoggerEvent, OPT_IN_DIRECTIVES, OPT_OUT_DIRECTIVES, type PluginOptions, type SourceLocation, ValueKind, compileFn as compile, compileProgram, BabelPluginReactCompiler as default, findDirectiveDisablingMemoization, findDirectiveEnablingMemoization, parseConfigPragmaForTests, parsePluginOptions, printHIR, printReactiveFunction, runBabelPluginReactCompiler, validateEnvironmentConfig };