Skip to content

Commit a25e9a6

Browse files
committed
Change autodeps configuration (#33800)
DiffTrain build for [074e927](074e927)
1 parent fef10fd commit a25e9a6

35 files changed

+120
-94
lines changed

compiled/eslint-plugin-react-hooks/index.js

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30111,7 +30111,7 @@ const EnvironmentConfigSchema = zod.z.object({
3011130111
inferEffectDependencies: zod.z
3011230112
.nullable(zod.z.array(zod.z.object({
3011330113
function: ExternalFunctionSchema,
30114-
numRequiredArgs: zod.z.number().min(1, 'numRequiredArgs must be > 0'),
30114+
autodepsIndex: zod.z.number().min(1, 'autodepsIndex must be > 0'),
3011530115
})))
3011630116
.default(null),
3011730117
inlineJsxTransform: ReactElementSymbolSchema.nullable().default(null),
@@ -45178,7 +45178,7 @@ function inferEffectDependencies(fn) {
4517845178
const autodepFnConfigs = new Map();
4517945179
for (const effectTarget of fn.env.config.inferEffectDependencies) {
4518045180
const moduleTargets = getOrInsertWith(autodepFnConfigs, effectTarget.function.source, () => new Map());
45181-
moduleTargets.set(effectTarget.function.importSpecifierName, effectTarget.numRequiredArgs);
45181+
moduleTargets.set(effectTarget.function.importSpecifierName, effectTarget.autodepsIndex);
4518245182
}
4518345183
const autodepFnLoads = new Map();
4518445184
const autodepModuleLoads = new Map();
@@ -45240,8 +45240,10 @@ function inferEffectDependencies(fn) {
4524045240
const autodepsArgIndex = value.args.findIndex(arg => arg.kind === 'Identifier' &&
4524145241
arg.identifier.type.kind === 'Object' &&
4524245242
arg.identifier.type.shapeId === BuiltInAutodepsId);
45243-
if (value.args.length > 1 &&
45244-
autodepsArgIndex > 0 &&
45243+
const autodepsArgExpectedIndex = autodepFnLoads.get(callee.identifier.id);
45244+
if (value.args.length > 0 &&
45245+
autodepsArgExpectedIndex != null &&
45246+
autodepsArgIndex === autodepsArgExpectedIndex &&
4524545247
autodepFnLoads.has(callee.identifier.id) &&
4524645248
value.args[0].kind === 'Identifier') {
4524745249
const effectDeps = [];
@@ -51590,7 +51592,30 @@ function throwInvalidReact(options, { logger, filename }) {
5159051592
});
5159151593
CompilerError.throw(detail);
5159251594
}
51593-
function assertValidEffectImportReference(numArgs, paths, context) {
51595+
function isAutodepsSigil(arg) {
51596+
if (arg.isIdentifier() && arg.node.name === 'AUTODEPS') {
51597+
const binding = arg.scope.getBinding(arg.node.name);
51598+
if (binding && binding.path.isImportSpecifier()) {
51599+
const importSpecifier = binding.path.node;
51600+
if (importSpecifier.imported.type === 'Identifier') {
51601+
return importSpecifier.imported.name === 'AUTODEPS';
51602+
}
51603+
}
51604+
return false;
51605+
}
51606+
if (arg.isMemberExpression() && !arg.node.computed) {
51607+
const object = arg.get('object');
51608+
const property = arg.get('property');
51609+
if (object.isIdentifier() &&
51610+
object.node.name === 'React' &&
51611+
property.isIdentifier() &&
51612+
property.node.name === 'AUTODEPS') {
51613+
return true;
51614+
}
51615+
}
51616+
return false;
51617+
}
51618+
function assertValidEffectImportReference(autodepsIndex, paths, context) {
5159451619
var _a;
5159551620
for (const path of paths) {
5159651621
const parent = path.parentPath;
@@ -51599,7 +51624,8 @@ function assertValidEffectImportReference(numArgs, paths, context) {
5159951624
const maybeCalleeLoc = path.node.loc;
5160051625
const hasInferredEffect = maybeCalleeLoc != null &&
5160151626
context.inferredEffectLocations.has(maybeCalleeLoc);
51602-
if (args.length === numArgs && !hasInferredEffect) {
51627+
const hasAutodepsArg = args.some(isAutodepsSigil);
51628+
if (hasAutodepsArg && !hasInferredEffect) {
5160351629
const maybeErrorDiagnostic = matchCompilerDiagnostic(path, context.transformErrors);
5160451630
throwInvalidReact({
5160551631
reason: '[InferEffectDependencies] React Compiler is unable to infer dependencies of this effect. ' +
@@ -51637,9 +51663,9 @@ function validateNoUntransformedReferences(path, filename, logger, env, compileR
5163751663
}
5163851664
}
5163951665
if (env.inferEffectDependencies) {
51640-
for (const { function: { source, importSpecifierName }, numRequiredArgs, } of env.inferEffectDependencies) {
51666+
for (const { function: { source, importSpecifierName }, autodepsIndex, } of env.inferEffectDependencies) {
5164151667
const module = getOrInsertWith(moduleLoadChecks, source, () => new Map());
51642-
module.set(importSpecifierName, assertValidEffectImportReference.bind(null, numRequiredArgs));
51668+
module.set(importSpecifierName, assertValidEffectImportReference.bind(null, autodepsIndex));
5164351669
}
5164451670
}
5164551671
if (moduleLoadChecks.size > 0) {

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dffacc7b8094576c19790fe8341996f743ba4a89
1+
074e92777c22a56269647d614fdae80bf6406485
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
dffacc7b8094576c19790fe8341996f743ba4a89
1+
074e92777c22a56269647d614fdae80bf6406485

compiled/facebook-www/React-dev.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ __DEV__ &&
14341434
exports.useTransition = function () {
14351435
return resolveDispatcher().useTransition();
14361436
};
1437-
exports.version = "19.2.0-www-classic-dffacc7b-20250717";
1437+
exports.version = "19.2.0-www-classic-074e9277-20250721";
14381438
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14391439
"function" ===
14401440
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-dev.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ __DEV__ &&
14341434
exports.useTransition = function () {
14351435
return resolveDispatcher().useTransition();
14361436
};
1437-
exports.version = "19.2.0-www-modern-dffacc7b-20250717";
1437+
exports.version = "19.2.0-www-modern-074e9277-20250721";
14381438
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14391439
"function" ===
14401440
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-prod.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,4 +610,4 @@ exports.useSyncExternalStore = function (
610610
exports.useTransition = function () {
611611
return ReactSharedInternals.H.useTransition();
612612
};
613-
exports.version = "19.2.0-www-classic-dffacc7b-20250717";
613+
exports.version = "19.2.0-www-classic-074e9277-20250721";

compiled/facebook-www/React-prod.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,4 +610,4 @@ exports.useSyncExternalStore = function (
610610
exports.useTransition = function () {
611611
return ReactSharedInternals.H.useTransition();
612612
};
613-
exports.version = "19.2.0-www-modern-dffacc7b-20250717";
613+
exports.version = "19.2.0-www-modern-074e9277-20250721";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ exports.useSyncExternalStore = function (
614614
exports.useTransition = function () {
615615
return ReactSharedInternals.H.useTransition();
616616
};
617-
exports.version = "19.2.0-www-classic-dffacc7b-20250717";
617+
exports.version = "19.2.0-www-classic-074e9277-20250721";
618618
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
619619
"function" ===
620620
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-profiling.modern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ exports.useSyncExternalStore = function (
614614
exports.useTransition = function () {
615615
return ReactSharedInternals.H.useTransition();
616616
};
617-
exports.version = "19.2.0-www-modern-dffacc7b-20250717";
617+
exports.version = "19.2.0-www-modern-074e9277-20250721";
618618
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
619619
"function" ===
620620
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19300,10 +19300,10 @@ __DEV__ &&
1930019300
(function () {
1930119301
var internals = {
1930219302
bundleType: 1,
19303-
version: "19.2.0-www-classic-dffacc7b-20250717",
19303+
version: "19.2.0-www-classic-074e9277-20250721",
1930419304
rendererPackageName: "react-art",
1930519305
currentDispatcherRef: ReactSharedInternals,
19306-
reconcilerVersion: "19.2.0-www-classic-dffacc7b-20250717"
19306+
reconcilerVersion: "19.2.0-www-classic-074e9277-20250721"
1930719307
};
1930819308
internals.overrideHookState = overrideHookState;
1930919309
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -19337,7 +19337,7 @@ __DEV__ &&
1933719337
exports.Shape = Shape;
1933819338
exports.Surface = Surface;
1933919339
exports.Text = Text;
19340-
exports.version = "19.2.0-www-classic-dffacc7b-20250717";
19340+
exports.version = "19.2.0-www-classic-074e9277-20250721";
1934119341
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1934219342
"function" ===
1934319343
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)