eslint-plugin-react-hooks 7.0.0 → 7.0.1
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.
- package/cjs/eslint-plugin-react-hooks.d.ts +4 -1
- package/cjs/eslint-plugin-react-hooks.development.js +879 -341
- package/cjs/eslint-plugin-react-hooks.production.js +879 -341
- package/index.d.ts +3 -1
- package/index.js +10 -0
- package/package.json +3 -3
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
var core$1 = require('@babel/core');
|
|
14
14
|
var BabelParser = require('@babel/parser');
|
|
15
|
-
var
|
|
16
|
-
var
|
|
15
|
+
var v4 = require('zod/v4');
|
|
16
|
+
var v4$1 = require('zod-validation-error/v4');
|
|
17
17
|
var crypto = require('crypto');
|
|
18
18
|
var HermesParser = require('hermes-parser');
|
|
19
19
|
var util = require('util');
|
|
@@ -17639,6 +17639,10 @@ function hasOwnProperty$1(obj, key) {
|
|
|
17639
17639
|
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
17640
17640
|
}
|
|
17641
17641
|
|
|
17642
|
+
const CODEFRAME_LINES_ABOVE = 2;
|
|
17643
|
+
const CODEFRAME_LINES_BELOW = 3;
|
|
17644
|
+
const CODEFRAME_MAX_LINES = 10;
|
|
17645
|
+
const CODEFRAME_ABBREVIATED_SOURCE_LINES = 5;
|
|
17642
17646
|
var ErrorSeverity;
|
|
17643
17647
|
(function (ErrorSeverity) {
|
|
17644
17648
|
ErrorSeverity["Error"] = "Error";
|
|
@@ -17955,7 +17959,7 @@ class CompilerError extends Error {
|
|
|
17955
17959
|
}
|
|
17956
17960
|
}
|
|
17957
17961
|
function printCodeFrame(source, loc, message) {
|
|
17958
|
-
|
|
17962
|
+
const printed = libExports.codeFrameColumns(source, {
|
|
17959
17963
|
start: {
|
|
17960
17964
|
line: loc.start.line,
|
|
17961
17965
|
column: loc.start.column + 1,
|
|
@@ -17966,7 +17970,19 @@ function printCodeFrame(source, loc, message) {
|
|
|
17966
17970
|
},
|
|
17967
17971
|
}, {
|
|
17968
17972
|
message,
|
|
17973
|
+
linesAbove: CODEFRAME_LINES_ABOVE,
|
|
17974
|
+
linesBelow: CODEFRAME_LINES_BELOW,
|
|
17969
17975
|
});
|
|
17976
|
+
const lines = printed.split(/\r?\n/);
|
|
17977
|
+
if (loc.end.line - loc.start.line < CODEFRAME_MAX_LINES) {
|
|
17978
|
+
return printed;
|
|
17979
|
+
}
|
|
17980
|
+
const pipeIndex = lines[0].indexOf('|');
|
|
17981
|
+
return [
|
|
17982
|
+
...lines.slice(0, CODEFRAME_LINES_ABOVE + CODEFRAME_ABBREVIATED_SOURCE_LINES),
|
|
17983
|
+
' '.repeat(pipeIndex) + '…',
|
|
17984
|
+
...lines.slice(-(CODEFRAME_LINES_BELOW + CODEFRAME_ABBREVIATED_SOURCE_LINES)),
|
|
17985
|
+
].join('\n');
|
|
17970
17986
|
}
|
|
17971
17987
|
function printErrorSummary(category, message) {
|
|
17972
17988
|
let heading;
|
|
@@ -18294,7 +18310,7 @@ function getRuleForCategoryImpl(category) {
|
|
|
18294
18310
|
category,
|
|
18295
18311
|
severity: ErrorSeverity.Error,
|
|
18296
18312
|
name: 'void-use-memo',
|
|
18297
|
-
description: 'Validates that useMemos always return a value. See [`useMemo()` docs](https://react.dev/reference/react/useMemo) for more information.',
|
|
18313
|
+
description: 'Validates that useMemos always return a value and that the result of the useMemo is used by the component/hook. See [`useMemo()` docs](https://react.dev/reference/react/useMemo) for more information.',
|
|
18298
18314
|
preset: LintRulePreset.RecommendedLatest,
|
|
18299
18315
|
};
|
|
18300
18316
|
}
|
|
@@ -18726,7 +18742,7 @@ var ValueKind;
|
|
|
18726
18742
|
ValueKind["Mutable"] = "mutable";
|
|
18727
18743
|
ValueKind["Context"] = "context";
|
|
18728
18744
|
})(ValueKind || (ValueKind = {}));
|
|
18729
|
-
const ValueKindSchema =
|
|
18745
|
+
const ValueKindSchema = v4.z.enum([
|
|
18730
18746
|
ValueKind.MaybeFrozen,
|
|
18731
18747
|
ValueKind.Frozen,
|
|
18732
18748
|
ValueKind.Primitive,
|
|
@@ -18734,7 +18750,7 @@ const ValueKindSchema = zod.z.enum([
|
|
|
18734
18750
|
ValueKind.Mutable,
|
|
18735
18751
|
ValueKind.Context,
|
|
18736
18752
|
]);
|
|
18737
|
-
const ValueReasonSchema =
|
|
18753
|
+
const ValueReasonSchema = v4.z.enum([
|
|
18738
18754
|
ValueReason.Context,
|
|
18739
18755
|
ValueReason.Effect,
|
|
18740
18756
|
ValueReason.Global,
|
|
@@ -18758,7 +18774,7 @@ var Effect;
|
|
|
18758
18774
|
Effect["Mutate"] = "mutate";
|
|
18759
18775
|
Effect["Store"] = "store";
|
|
18760
18776
|
})(Effect || (Effect = {}));
|
|
18761
|
-
const EffectSchema =
|
|
18777
|
+
const EffectSchema = v4.z.enum([
|
|
18762
18778
|
Effect.Read,
|
|
18763
18779
|
Effect.Mutate,
|
|
18764
18780
|
Effect.ConditionallyMutate,
|
|
@@ -21176,25 +21192,25 @@ function assertValidBlockNesting(fn) {
|
|
|
21176
21192
|
function assertValidMutableRanges(fn) {
|
|
21177
21193
|
for (const [, block] of fn.body.blocks) {
|
|
21178
21194
|
for (const phi of block.phis) {
|
|
21179
|
-
visit$
|
|
21195
|
+
visit$1(phi.place, `phi for block bb${block.id}`);
|
|
21180
21196
|
for (const [pred, operand] of phi.operands) {
|
|
21181
|
-
visit$
|
|
21197
|
+
visit$1(operand, `phi predecessor bb${pred} for block bb${block.id}`);
|
|
21182
21198
|
}
|
|
21183
21199
|
}
|
|
21184
21200
|
for (const instr of block.instructions) {
|
|
21185
21201
|
for (const operand of eachInstructionLValue(instr)) {
|
|
21186
|
-
visit$
|
|
21202
|
+
visit$1(operand, `instruction [${instr.id}]`);
|
|
21187
21203
|
}
|
|
21188
21204
|
for (const operand of eachInstructionOperand(instr)) {
|
|
21189
|
-
visit$
|
|
21205
|
+
visit$1(operand, `instruction [${instr.id}]`);
|
|
21190
21206
|
}
|
|
21191
21207
|
}
|
|
21192
21208
|
for (const operand of eachTerminalOperand(block.terminal)) {
|
|
21193
|
-
visit$
|
|
21209
|
+
visit$1(operand, `terminal [${block.terminal.id}]`);
|
|
21194
21210
|
}
|
|
21195
21211
|
}
|
|
21196
21212
|
}
|
|
21197
|
-
function visit$
|
|
21213
|
+
function visit$1(place, description) {
|
|
21198
21214
|
validateMutableRange(place, place.identifier.mutableRange, description);
|
|
21199
21215
|
if (place.identifier.scope !== null) {
|
|
21200
21216
|
validateMutableRange(place, place.identifier.scope.range, description);
|
|
@@ -24136,7 +24152,7 @@ function lowerObjectMethod(builder, property) {
|
|
|
24136
24152
|
};
|
|
24137
24153
|
}
|
|
24138
24154
|
function lowerObjectPropertyKey(builder, property) {
|
|
24139
|
-
var _a
|
|
24155
|
+
var _a;
|
|
24140
24156
|
const key = property.get('key');
|
|
24141
24157
|
if (key.isStringLiteral()) {
|
|
24142
24158
|
return {
|
|
@@ -24145,15 +24161,6 @@ function lowerObjectPropertyKey(builder, property) {
|
|
|
24145
24161
|
};
|
|
24146
24162
|
}
|
|
24147
24163
|
else if (property.node.computed && key.isExpression()) {
|
|
24148
|
-
if (!key.isIdentifier() && !key.isMemberExpression()) {
|
|
24149
|
-
builder.errors.push({
|
|
24150
|
-
reason: `(BuildHIR::lowerExpression) Expected Identifier, got ${key.type} key in ObjectExpression`,
|
|
24151
|
-
category: ErrorCategory.Todo,
|
|
24152
|
-
loc: (_a = key.node.loc) !== null && _a !== void 0 ? _a : null,
|
|
24153
|
-
suggestions: null,
|
|
24154
|
-
});
|
|
24155
|
-
return null;
|
|
24156
|
-
}
|
|
24157
24164
|
const place = lowerExpressionToTemporary(builder, key);
|
|
24158
24165
|
return {
|
|
24159
24166
|
kind: 'computed',
|
|
@@ -24175,7 +24182,7 @@ function lowerObjectPropertyKey(builder, property) {
|
|
|
24175
24182
|
builder.errors.push({
|
|
24176
24183
|
reason: `(BuildHIR::lowerExpression) Expected Identifier, got ${key.type} key in ObjectExpression`,
|
|
24177
24184
|
category: ErrorCategory.Todo,
|
|
24178
|
-
loc: (
|
|
24185
|
+
loc: (_a = key.node.loc) !== null && _a !== void 0 ? _a : null,
|
|
24179
24186
|
suggestions: null,
|
|
24180
24187
|
});
|
|
24181
24188
|
return null;
|
|
@@ -31149,85 +31156,85 @@ function getReanimatedModuleType(registry) {
|
|
|
31149
31156
|
return addObject(registry, null, reanimatedType);
|
|
31150
31157
|
}
|
|
31151
31158
|
|
|
31152
|
-
const ObjectPropertiesSchema =
|
|
31153
|
-
.record(
|
|
31159
|
+
const ObjectPropertiesSchema = v4.z
|
|
31160
|
+
.record(v4.z.string(), v4.z.lazy(() => TypeSchema))
|
|
31154
31161
|
.refine(record => {
|
|
31155
31162
|
return Object.keys(record).every(key => key === '*' || key === 'default' || libExports$1.isValidIdentifier(key));
|
|
31156
31163
|
}, 'Expected all "object" property names to be valid identifier, `*` to match any property, of `default` to define a module default export');
|
|
31157
|
-
const ObjectTypeSchema =
|
|
31158
|
-
kind:
|
|
31164
|
+
const ObjectTypeSchema = v4.z.object({
|
|
31165
|
+
kind: v4.z.literal('object'),
|
|
31159
31166
|
properties: ObjectPropertiesSchema.nullable(),
|
|
31160
31167
|
});
|
|
31161
|
-
const LifetimeIdSchema =
|
|
31168
|
+
const LifetimeIdSchema = v4.z.string().refine(id => id.startsWith('@'), {
|
|
31162
31169
|
message: "Placeholder names must start with '@'",
|
|
31163
31170
|
});
|
|
31164
|
-
const FreezeEffectSchema =
|
|
31165
|
-
kind:
|
|
31171
|
+
const FreezeEffectSchema = v4.z.object({
|
|
31172
|
+
kind: v4.z.literal('Freeze'),
|
|
31166
31173
|
value: LifetimeIdSchema,
|
|
31167
31174
|
reason: ValueReasonSchema,
|
|
31168
31175
|
});
|
|
31169
|
-
const MutateEffectSchema =
|
|
31170
|
-
kind:
|
|
31176
|
+
const MutateEffectSchema = v4.z.object({
|
|
31177
|
+
kind: v4.z.literal('Mutate'),
|
|
31171
31178
|
value: LifetimeIdSchema,
|
|
31172
31179
|
});
|
|
31173
|
-
const MutateTransitiveConditionallySchema =
|
|
31174
|
-
kind:
|
|
31180
|
+
const MutateTransitiveConditionallySchema = v4.z.object({
|
|
31181
|
+
kind: v4.z.literal('MutateTransitiveConditionally'),
|
|
31175
31182
|
value: LifetimeIdSchema,
|
|
31176
31183
|
});
|
|
31177
|
-
const CreateEffectSchema =
|
|
31178
|
-
kind:
|
|
31184
|
+
const CreateEffectSchema = v4.z.object({
|
|
31185
|
+
kind: v4.z.literal('Create'),
|
|
31179
31186
|
into: LifetimeIdSchema,
|
|
31180
31187
|
value: ValueKindSchema,
|
|
31181
31188
|
reason: ValueReasonSchema,
|
|
31182
31189
|
});
|
|
31183
|
-
const AssignEffectSchema =
|
|
31184
|
-
kind:
|
|
31190
|
+
const AssignEffectSchema = v4.z.object({
|
|
31191
|
+
kind: v4.z.literal('Assign'),
|
|
31185
31192
|
from: LifetimeIdSchema,
|
|
31186
31193
|
into: LifetimeIdSchema,
|
|
31187
31194
|
});
|
|
31188
|
-
const AliasEffectSchema =
|
|
31189
|
-
kind:
|
|
31195
|
+
const AliasEffectSchema = v4.z.object({
|
|
31196
|
+
kind: v4.z.literal('Alias'),
|
|
31190
31197
|
from: LifetimeIdSchema,
|
|
31191
31198
|
into: LifetimeIdSchema,
|
|
31192
31199
|
});
|
|
31193
|
-
const ImmutableCaptureEffectSchema =
|
|
31194
|
-
kind:
|
|
31200
|
+
const ImmutableCaptureEffectSchema = v4.z.object({
|
|
31201
|
+
kind: v4.z.literal('ImmutableCapture'),
|
|
31195
31202
|
from: LifetimeIdSchema,
|
|
31196
31203
|
into: LifetimeIdSchema,
|
|
31197
31204
|
});
|
|
31198
|
-
const CaptureEffectSchema =
|
|
31199
|
-
kind:
|
|
31205
|
+
const CaptureEffectSchema = v4.z.object({
|
|
31206
|
+
kind: v4.z.literal('Capture'),
|
|
31200
31207
|
from: LifetimeIdSchema,
|
|
31201
31208
|
into: LifetimeIdSchema,
|
|
31202
31209
|
});
|
|
31203
|
-
const CreateFromEffectSchema =
|
|
31204
|
-
kind:
|
|
31210
|
+
const CreateFromEffectSchema = v4.z.object({
|
|
31211
|
+
kind: v4.z.literal('CreateFrom'),
|
|
31205
31212
|
from: LifetimeIdSchema,
|
|
31206
31213
|
into: LifetimeIdSchema,
|
|
31207
31214
|
});
|
|
31208
|
-
const ApplyArgSchema =
|
|
31215
|
+
const ApplyArgSchema = v4.z.union([
|
|
31209
31216
|
LifetimeIdSchema,
|
|
31210
|
-
|
|
31211
|
-
kind:
|
|
31217
|
+
v4.z.object({
|
|
31218
|
+
kind: v4.z.literal('Spread'),
|
|
31212
31219
|
place: LifetimeIdSchema,
|
|
31213
31220
|
}),
|
|
31214
|
-
|
|
31215
|
-
kind:
|
|
31221
|
+
v4.z.object({
|
|
31222
|
+
kind: v4.z.literal('Hole'),
|
|
31216
31223
|
}),
|
|
31217
31224
|
]);
|
|
31218
|
-
const ApplyEffectSchema =
|
|
31219
|
-
kind:
|
|
31225
|
+
const ApplyEffectSchema = v4.z.object({
|
|
31226
|
+
kind: v4.z.literal('Apply'),
|
|
31220
31227
|
receiver: LifetimeIdSchema,
|
|
31221
31228
|
function: LifetimeIdSchema,
|
|
31222
|
-
mutatesFunction:
|
|
31223
|
-
args:
|
|
31229
|
+
mutatesFunction: v4.z.boolean(),
|
|
31230
|
+
args: v4.z.array(ApplyArgSchema),
|
|
31224
31231
|
into: LifetimeIdSchema,
|
|
31225
31232
|
});
|
|
31226
|
-
const ImpureEffectSchema =
|
|
31227
|
-
kind:
|
|
31233
|
+
const ImpureEffectSchema = v4.z.object({
|
|
31234
|
+
kind: v4.z.literal('Impure'),
|
|
31228
31235
|
place: LifetimeIdSchema,
|
|
31229
31236
|
});
|
|
31230
|
-
const AliasingEffectSchema =
|
|
31237
|
+
const AliasingEffectSchema = v4.z.union([
|
|
31231
31238
|
FreezeEffectSchema,
|
|
31232
31239
|
CreateEffectSchema,
|
|
31233
31240
|
CreateFromEffectSchema,
|
|
@@ -31240,50 +31247,50 @@ const AliasingEffectSchema = zod.z.union([
|
|
|
31240
31247
|
MutateTransitiveConditionallySchema,
|
|
31241
31248
|
ApplyEffectSchema,
|
|
31242
31249
|
]);
|
|
31243
|
-
const AliasingSignatureSchema =
|
|
31250
|
+
const AliasingSignatureSchema = v4.z.object({
|
|
31244
31251
|
receiver: LifetimeIdSchema,
|
|
31245
|
-
params:
|
|
31252
|
+
params: v4.z.array(LifetimeIdSchema),
|
|
31246
31253
|
rest: LifetimeIdSchema.nullable(),
|
|
31247
31254
|
returns: LifetimeIdSchema,
|
|
31248
|
-
effects:
|
|
31249
|
-
temporaries:
|
|
31255
|
+
effects: v4.z.array(AliasingEffectSchema),
|
|
31256
|
+
temporaries: v4.z.array(LifetimeIdSchema),
|
|
31250
31257
|
});
|
|
31251
|
-
const FunctionTypeSchema =
|
|
31252
|
-
kind:
|
|
31253
|
-
positionalParams:
|
|
31258
|
+
const FunctionTypeSchema = v4.z.object({
|
|
31259
|
+
kind: v4.z.literal('function'),
|
|
31260
|
+
positionalParams: v4.z.array(EffectSchema),
|
|
31254
31261
|
restParam: EffectSchema.nullable(),
|
|
31255
31262
|
calleeEffect: EffectSchema,
|
|
31256
|
-
returnType:
|
|
31263
|
+
returnType: v4.z.lazy(() => TypeSchema),
|
|
31257
31264
|
returnValueKind: ValueKindSchema,
|
|
31258
|
-
noAlias:
|
|
31259
|
-
mutableOnlyIfOperandsAreMutable:
|
|
31260
|
-
impure:
|
|
31261
|
-
canonicalName:
|
|
31265
|
+
noAlias: v4.z.boolean().nullable().optional(),
|
|
31266
|
+
mutableOnlyIfOperandsAreMutable: v4.z.boolean().nullable().optional(),
|
|
31267
|
+
impure: v4.z.boolean().nullable().optional(),
|
|
31268
|
+
canonicalName: v4.z.string().nullable().optional(),
|
|
31262
31269
|
aliasing: AliasingSignatureSchema.nullable().optional(),
|
|
31263
|
-
knownIncompatible:
|
|
31270
|
+
knownIncompatible: v4.z.string().nullable().optional(),
|
|
31264
31271
|
});
|
|
31265
|
-
const HookTypeSchema =
|
|
31266
|
-
kind:
|
|
31267
|
-
positionalParams:
|
|
31272
|
+
const HookTypeSchema = v4.z.object({
|
|
31273
|
+
kind: v4.z.literal('hook'),
|
|
31274
|
+
positionalParams: v4.z.array(EffectSchema).nullable().optional(),
|
|
31268
31275
|
restParam: EffectSchema.nullable().optional(),
|
|
31269
|
-
returnType:
|
|
31276
|
+
returnType: v4.z.lazy(() => TypeSchema),
|
|
31270
31277
|
returnValueKind: ValueKindSchema.nullable().optional(),
|
|
31271
|
-
noAlias:
|
|
31278
|
+
noAlias: v4.z.boolean().nullable().optional(),
|
|
31272
31279
|
aliasing: AliasingSignatureSchema.nullable().optional(),
|
|
31273
|
-
knownIncompatible:
|
|
31280
|
+
knownIncompatible: v4.z.string().nullable().optional(),
|
|
31274
31281
|
});
|
|
31275
|
-
const BuiltInTypeSchema =
|
|
31276
|
-
|
|
31277
|
-
|
|
31278
|
-
|
|
31279
|
-
|
|
31280
|
-
|
|
31282
|
+
const BuiltInTypeSchema = v4.z.union([
|
|
31283
|
+
v4.z.literal('Any'),
|
|
31284
|
+
v4.z.literal('Ref'),
|
|
31285
|
+
v4.z.literal('Array'),
|
|
31286
|
+
v4.z.literal('Primitive'),
|
|
31287
|
+
v4.z.literal('MixedReadonly'),
|
|
31281
31288
|
]);
|
|
31282
|
-
const TypeReferenceSchema =
|
|
31283
|
-
kind:
|
|
31289
|
+
const TypeReferenceSchema = v4.z.object({
|
|
31290
|
+
kind: v4.z.literal('type'),
|
|
31284
31291
|
name: BuiltInTypeSchema,
|
|
31285
31292
|
});
|
|
31286
|
-
const TypeSchema =
|
|
31293
|
+
const TypeSchema = v4.z.union([
|
|
31287
31294
|
ObjectTypeSchema,
|
|
31288
31295
|
FunctionTypeSchema,
|
|
31289
31296
|
HookTypeSchema,
|
|
@@ -31879,96 +31886,90 @@ function defaultModuleTypeProvider(moduleName) {
|
|
|
31879
31886
|
}
|
|
31880
31887
|
|
|
31881
31888
|
var _Environment_instances, _Environment_globals, _Environment_shapes, _Environment_moduleTypes, _Environment_nextIdentifer, _Environment_nextBlock, _Environment_nextScope, _Environment_scope, _Environment_outlinedFunctions, _Environment_contextIdentifiers, _Environment_hoistedIdentifiers, _Environment_flowTypeEnvironment, _Environment_resolveModuleType, _Environment_isKnownReactModule, _Environment_getCustomHookType;
|
|
31882
|
-
const ReactElementSymbolSchema =
|
|
31883
|
-
elementSymbol:
|
|
31884
|
-
|
|
31885
|
-
|
|
31889
|
+
const ReactElementSymbolSchema = v4.z.object({
|
|
31890
|
+
elementSymbol: v4.z.union([
|
|
31891
|
+
v4.z.literal('react.element'),
|
|
31892
|
+
v4.z.literal('react.transitional.element'),
|
|
31886
31893
|
]),
|
|
31887
|
-
globalDevVar:
|
|
31894
|
+
globalDevVar: v4.z.string(),
|
|
31888
31895
|
});
|
|
31889
|
-
const ExternalFunctionSchema =
|
|
31890
|
-
source:
|
|
31891
|
-
importSpecifierName:
|
|
31896
|
+
const ExternalFunctionSchema = v4.z.object({
|
|
31897
|
+
source: v4.z.string(),
|
|
31898
|
+
importSpecifierName: v4.z.string(),
|
|
31892
31899
|
});
|
|
31893
|
-
const InstrumentationSchema =
|
|
31900
|
+
const InstrumentationSchema = v4.z
|
|
31894
31901
|
.object({
|
|
31895
31902
|
fn: ExternalFunctionSchema,
|
|
31896
31903
|
gating: ExternalFunctionSchema.nullable(),
|
|
31897
|
-
globalGating:
|
|
31904
|
+
globalGating: v4.z.string().nullable(),
|
|
31898
31905
|
})
|
|
31899
31906
|
.refine(opts => opts.gating != null || opts.globalGating != null, 'Expected at least one of gating or globalGating');
|
|
31900
31907
|
const USE_FIRE_FUNCTION_NAME = 'useFire';
|
|
31901
31908
|
const EMIT_FREEZE_GLOBAL_GATING = 'false';
|
|
31902
|
-
const
|
|
31903
|
-
|
|
31904
|
-
|
|
31905
|
-
|
|
31906
|
-
|
|
31907
|
-
|
|
31908
|
-
zod.z.tuple([zod.z.string(), zod.z.array(MacroMethodSchema)]),
|
|
31909
|
-
]);
|
|
31910
|
-
const HookSchema = zod.z.object({
|
|
31911
|
-
effectKind: zod.z.nativeEnum(Effect),
|
|
31912
|
-
valueKind: zod.z.nativeEnum(ValueKind),
|
|
31913
|
-
noAlias: zod.z.boolean().default(false),
|
|
31914
|
-
transitiveMixedData: zod.z.boolean().default(false),
|
|
31909
|
+
const MacroSchema = v4.z.string();
|
|
31910
|
+
const HookSchema = v4.z.object({
|
|
31911
|
+
effectKind: v4.z.nativeEnum(Effect),
|
|
31912
|
+
valueKind: v4.z.nativeEnum(ValueKind),
|
|
31913
|
+
noAlias: v4.z.boolean().default(false),
|
|
31914
|
+
transitiveMixedData: v4.z.boolean().default(false),
|
|
31915
31915
|
});
|
|
31916
|
-
const EnvironmentConfigSchema =
|
|
31917
|
-
customHooks:
|
|
31918
|
-
moduleTypeProvider:
|
|
31919
|
-
customMacros:
|
|
31920
|
-
enableResetCacheOnSourceFileChanges:
|
|
31921
|
-
enablePreserveExistingMemoizationGuarantees:
|
|
31922
|
-
validatePreserveExistingMemoizationGuarantees:
|
|
31923
|
-
enablePreserveExistingManualUseMemo:
|
|
31924
|
-
enableForest:
|
|
31925
|
-
enableUseTypeAnnotations:
|
|
31926
|
-
flowTypeProvider:
|
|
31927
|
-
enableOptionalDependencies:
|
|
31928
|
-
enableFire:
|
|
31929
|
-
enableNameAnonymousFunctions:
|
|
31930
|
-
inferEffectDependencies:
|
|
31931
|
-
.nullable(
|
|
31916
|
+
const EnvironmentConfigSchema = v4.z.object({
|
|
31917
|
+
customHooks: v4.z.map(v4.z.string(), HookSchema).default(new Map()),
|
|
31918
|
+
moduleTypeProvider: v4.z.nullable(v4.z.any()).default(null),
|
|
31919
|
+
customMacros: v4.z.nullable(v4.z.array(MacroSchema)).default(null),
|
|
31920
|
+
enableResetCacheOnSourceFileChanges: v4.z.nullable(v4.z.boolean()).default(null),
|
|
31921
|
+
enablePreserveExistingMemoizationGuarantees: v4.z.boolean().default(true),
|
|
31922
|
+
validatePreserveExistingMemoizationGuarantees: v4.z.boolean().default(true),
|
|
31923
|
+
enablePreserveExistingManualUseMemo: v4.z.boolean().default(false),
|
|
31924
|
+
enableForest: v4.z.boolean().default(false),
|
|
31925
|
+
enableUseTypeAnnotations: v4.z.boolean().default(false),
|
|
31926
|
+
flowTypeProvider: v4.z.nullable(v4.z.any()).default(null),
|
|
31927
|
+
enableOptionalDependencies: v4.z.boolean().default(true),
|
|
31928
|
+
enableFire: v4.z.boolean().default(false),
|
|
31929
|
+
enableNameAnonymousFunctions: v4.z.boolean().default(false),
|
|
31930
|
+
inferEffectDependencies: v4.z
|
|
31931
|
+
.nullable(v4.z.array(v4.z.object({
|
|
31932
31932
|
function: ExternalFunctionSchema,
|
|
31933
|
-
autodepsIndex:
|
|
31933
|
+
autodepsIndex: v4.z.number().min(1, 'autodepsIndex must be > 0'),
|
|
31934
31934
|
})))
|
|
31935
31935
|
.default(null),
|
|
31936
31936
|
inlineJsxTransform: ReactElementSymbolSchema.nullable().default(null),
|
|
31937
|
-
validateHooksUsage:
|
|
31938
|
-
validateRefAccessDuringRender:
|
|
31939
|
-
validateNoSetStateInRender:
|
|
31940
|
-
validateNoSetStateInEffects:
|
|
31941
|
-
validateNoDerivedComputationsInEffects:
|
|
31942
|
-
|
|
31943
|
-
|
|
31944
|
-
|
|
31945
|
-
|
|
31946
|
-
|
|
31947
|
-
|
|
31948
|
-
|
|
31949
|
-
|
|
31950
|
-
|
|
31937
|
+
validateHooksUsage: v4.z.boolean().default(true),
|
|
31938
|
+
validateRefAccessDuringRender: v4.z.boolean().default(true),
|
|
31939
|
+
validateNoSetStateInRender: v4.z.boolean().default(true),
|
|
31940
|
+
validateNoSetStateInEffects: v4.z.boolean().default(false),
|
|
31941
|
+
validateNoDerivedComputationsInEffects: v4.z.boolean().default(false),
|
|
31942
|
+
validateNoDerivedComputationsInEffects_exp: v4.z.boolean().default(false),
|
|
31943
|
+
validateNoJSXInTryStatements: v4.z.boolean().default(false),
|
|
31944
|
+
validateStaticComponents: v4.z.boolean().default(false),
|
|
31945
|
+
validateMemoizedEffectDependencies: v4.z.boolean().default(false),
|
|
31946
|
+
validateNoCapitalizedCalls: v4.z.nullable(v4.z.array(v4.z.string())).default(null),
|
|
31947
|
+
validateBlocklistedImports: v4.z.nullable(v4.z.array(v4.z.string())).default(null),
|
|
31948
|
+
validateNoImpureFunctionsInRender: v4.z.boolean().default(false),
|
|
31949
|
+
validateNoFreezingKnownMutableFunctions: v4.z.boolean().default(false),
|
|
31950
|
+
enableAssumeHooksFollowRulesOfReact: v4.z.boolean().default(true),
|
|
31951
|
+
enableTransitivelyFreezeFunctionExpressions: v4.z.boolean().default(true),
|
|
31951
31952
|
enableEmitFreeze: ExternalFunctionSchema.nullable().default(null),
|
|
31952
31953
|
enableEmitHookGuards: ExternalFunctionSchema.nullable().default(null),
|
|
31953
|
-
enableInstructionReordering:
|
|
31954
|
-
enableFunctionOutlining:
|
|
31955
|
-
enableJsxOutlining:
|
|
31954
|
+
enableInstructionReordering: v4.z.boolean().default(false),
|
|
31955
|
+
enableFunctionOutlining: v4.z.boolean().default(true),
|
|
31956
|
+
enableJsxOutlining: v4.z.boolean().default(false),
|
|
31956
31957
|
enableEmitInstrumentForget: InstrumentationSchema.nullable().default(null),
|
|
31957
|
-
assertValidMutableRanges:
|
|
31958
|
-
enableChangeVariableCodegen:
|
|
31959
|
-
enableMemoizationComments:
|
|
31960
|
-
throwUnknownException__testonly:
|
|
31961
|
-
enableTreatFunctionDepsAsConditional:
|
|
31962
|
-
disableMemoizationForDebugging:
|
|
31958
|
+
assertValidMutableRanges: v4.z.boolean().default(false),
|
|
31959
|
+
enableChangeVariableCodegen: v4.z.boolean().default(false),
|
|
31960
|
+
enableMemoizationComments: v4.z.boolean().default(false),
|
|
31961
|
+
throwUnknownException__testonly: v4.z.boolean().default(false),
|
|
31962
|
+
enableTreatFunctionDepsAsConditional: v4.z.boolean().default(false),
|
|
31963
|
+
disableMemoizationForDebugging: v4.z.boolean().default(false),
|
|
31963
31964
|
enableChangeDetectionForDebugging: ExternalFunctionSchema.nullable().default(null),
|
|
31964
|
-
enableCustomTypeDefinitionForReanimated:
|
|
31965
|
-
hookPattern:
|
|
31966
|
-
enableTreatRefLikeIdentifiersAsRefs:
|
|
31967
|
-
enableTreatSetIdentifiersAsStateSetters:
|
|
31965
|
+
enableCustomTypeDefinitionForReanimated: v4.z.boolean().default(false),
|
|
31966
|
+
hookPattern: v4.z.string().nullable().default(null),
|
|
31967
|
+
enableTreatRefLikeIdentifiersAsRefs: v4.z.boolean().default(true),
|
|
31968
|
+
enableTreatSetIdentifiersAsStateSetters: v4.z.boolean().default(false),
|
|
31968
31969
|
lowerContextAccess: ExternalFunctionSchema.nullable().default(null),
|
|
31969
|
-
validateNoVoidUseMemo:
|
|
31970
|
-
validateNoDynamicallyCreatedComponentsOrHooks:
|
|
31971
|
-
enableAllowSetStateFromRefsInEffects:
|
|
31970
|
+
validateNoVoidUseMemo: v4.z.boolean().default(true),
|
|
31971
|
+
validateNoDynamicallyCreatedComponentsOrHooks: v4.z.boolean().default(false),
|
|
31972
|
+
enableAllowSetStateFromRefsInEffects: v4.z.boolean().default(true),
|
|
31972
31973
|
});
|
|
31973
31974
|
class Environment {
|
|
31974
31975
|
constructor(scope, fnType, compilerMode, config, contextIdentifiers, parentFunction, logger, filename, code, programContext) {
|
|
@@ -32345,7 +32346,7 @@ function validateEnvironmentConfig(partialConfig) {
|
|
|
32345
32346
|
}
|
|
32346
32347
|
CompilerError.throwInvalidConfig({
|
|
32347
32348
|
reason: 'Could not validate environment config. Update React Compiler config to fix the error',
|
|
32348
|
-
description: `${
|
|
32349
|
+
description: `${v4$1.fromZodError(config.error)}`,
|
|
32349
32350
|
loc: null,
|
|
32350
32351
|
suggestions: null,
|
|
32351
32352
|
});
|
|
@@ -32357,7 +32358,7 @@ function tryParseExternalFunction(maybeExternalFunction) {
|
|
|
32357
32358
|
}
|
|
32358
32359
|
CompilerError.throwInvalidConfig({
|
|
32359
32360
|
reason: 'Could not parse external function. Update React Compiler config to fix the error',
|
|
32360
|
-
description: `${
|
|
32361
|
+
description: `${v4$1.fromZodError(externalFunction.error)}`,
|
|
32361
32362
|
loc: null,
|
|
32362
32363
|
suggestions: null,
|
|
32363
32364
|
});
|
|
@@ -36951,160 +36952,189 @@ var GuardKind;
|
|
|
36951
36952
|
GuardKind[GuardKind["DisallowHook"] = 3] = "DisallowHook";
|
|
36952
36953
|
})(GuardKind || (GuardKind = {}));
|
|
36953
36954
|
|
|
36955
|
+
var InlineLevel;
|
|
36956
|
+
(function (InlineLevel) {
|
|
36957
|
+
InlineLevel["Transitive"] = "Transitive";
|
|
36958
|
+
InlineLevel["Shallow"] = "Shallow";
|
|
36959
|
+
})(InlineLevel || (InlineLevel = {}));
|
|
36960
|
+
const SHALLOW_MACRO = {
|
|
36961
|
+
level: InlineLevel.Shallow,
|
|
36962
|
+
properties: null,
|
|
36963
|
+
};
|
|
36964
|
+
const TRANSITIVE_MACRO = {
|
|
36965
|
+
level: InlineLevel.Transitive,
|
|
36966
|
+
properties: null,
|
|
36967
|
+
};
|
|
36968
|
+
const FBT_MACRO = {
|
|
36969
|
+
level: InlineLevel.Transitive,
|
|
36970
|
+
properties: new Map([['*', SHALLOW_MACRO]]),
|
|
36971
|
+
};
|
|
36972
|
+
FBT_MACRO.properties.set('enum', FBT_MACRO);
|
|
36954
36973
|
function memoizeFbtAndMacroOperandsInSameScope(fn) {
|
|
36955
36974
|
var _a;
|
|
36956
|
-
const
|
|
36957
|
-
...Array.from(FBT_TAGS
|
|
36958
|
-
...((_a = fn.env.config.customMacros) !== null && _a !== void 0 ? _a : []),
|
|
36975
|
+
const macroKinds = new Map([
|
|
36976
|
+
...Array.from(FBT_TAGS.entries()),
|
|
36977
|
+
...((_a = fn.env.config.customMacros) !== null && _a !== void 0 ? _a : []).map(name => [name, TRANSITIVE_MACRO]),
|
|
36959
36978
|
]);
|
|
36960
|
-
const
|
|
36961
|
-
const
|
|
36962
|
-
|
|
36963
|
-
|
|
36964
|
-
|
|
36965
|
-
|
|
36966
|
-
|
|
36967
|
-
|
|
36968
|
-
|
|
36969
|
-
|
|
36970
|
-
|
|
36971
|
-
|
|
36972
|
-
|
|
36973
|
-
'fbt',
|
|
36974
|
-
'fbt:param',
|
|
36975
|
-
'fbs',
|
|
36976
|
-
'fbs:param',
|
|
36979
|
+
const macroTags = populateMacroTags(fn, macroKinds);
|
|
36980
|
+
const macroValues = mergeMacroArguments(fn, macroTags, macroKinds);
|
|
36981
|
+
return macroValues;
|
|
36982
|
+
}
|
|
36983
|
+
const FBT_TAGS = new Map([
|
|
36984
|
+
['fbt', FBT_MACRO],
|
|
36985
|
+
['fbt:param', SHALLOW_MACRO],
|
|
36986
|
+
['fbt:enum', FBT_MACRO],
|
|
36987
|
+
['fbt:plural', SHALLOW_MACRO],
|
|
36988
|
+
['fbs', FBT_MACRO],
|
|
36989
|
+
['fbs:param', SHALLOW_MACRO],
|
|
36990
|
+
['fbs:enum', FBT_MACRO],
|
|
36991
|
+
['fbs:plural', SHALLOW_MACRO],
|
|
36977
36992
|
]);
|
|
36978
36993
|
const SINGLE_CHILD_FBT_TAGS = new Set([
|
|
36979
36994
|
'fbt:param',
|
|
36980
36995
|
'fbs:param',
|
|
36981
36996
|
]);
|
|
36982
|
-
function
|
|
36983
|
-
|
|
36984
|
-
|
|
36985
|
-
|
|
36986
|
-
|
|
36987
|
-
|
|
36988
|
-
|
|
36989
|
-
|
|
36990
|
-
|
|
36991
|
-
|
|
36992
|
-
|
|
36993
|
-
|
|
36994
|
-
else if (value.kind === 'LoadGlobal' &&
|
|
36995
|
-
matchesExactTag(value.binding.name, fbtMacroTags)) {
|
|
36996
|
-
fbtValues.add(lvalue.identifier.id);
|
|
36997
|
-
}
|
|
36998
|
-
else if (value.kind === 'LoadGlobal' &&
|
|
36999
|
-
matchTagRoot(value.binding.name, fbtMacroTags) !== null) {
|
|
37000
|
-
const methods = matchTagRoot(value.binding.name, fbtMacroTags);
|
|
37001
|
-
macroMethods.set(lvalue.identifier.id, methods);
|
|
37002
|
-
}
|
|
37003
|
-
else if (value.kind === 'PropertyLoad' &&
|
|
37004
|
-
macroMethods.has(value.object.identifier.id)) {
|
|
37005
|
-
const methods = macroMethods.get(value.object.identifier.id);
|
|
37006
|
-
const newMethods = [];
|
|
37007
|
-
for (const method of methods) {
|
|
37008
|
-
if (method.length > 0 &&
|
|
37009
|
-
(method[0].type === 'wildcard' ||
|
|
37010
|
-
(method[0].type === 'name' && method[0].name === value.property))) {
|
|
37011
|
-
if (method.length > 1) {
|
|
37012
|
-
newMethods.push(method.slice(1));
|
|
37013
|
-
}
|
|
37014
|
-
else {
|
|
37015
|
-
fbtValues.add(lvalue.identifier.id);
|
|
36997
|
+
function populateMacroTags(fn, macroKinds) {
|
|
36998
|
+
var _a;
|
|
36999
|
+
const macroTags = new Map();
|
|
37000
|
+
for (const block of fn.body.blocks.values()) {
|
|
37001
|
+
for (const instr of block.instructions) {
|
|
37002
|
+
const { lvalue, value } = instr;
|
|
37003
|
+
switch (value.kind) {
|
|
37004
|
+
case 'Primitive': {
|
|
37005
|
+
if (typeof value.value === 'string') {
|
|
37006
|
+
const macroDefinition = macroKinds.get(value.value);
|
|
37007
|
+
if (macroDefinition != null) {
|
|
37008
|
+
macroTags.set(lvalue.identifier.id, macroDefinition);
|
|
37016
37009
|
}
|
|
37017
37010
|
}
|
|
37011
|
+
break;
|
|
37018
37012
|
}
|
|
37019
|
-
|
|
37020
|
-
|
|
37021
|
-
|
|
37022
|
-
|
|
37023
|
-
|
|
37024
|
-
|
|
37025
|
-
if (fbtScope === null) {
|
|
37026
|
-
continue;
|
|
37013
|
+
case 'LoadGlobal': {
|
|
37014
|
+
let macroDefinition = macroKinds.get(value.binding.name);
|
|
37015
|
+
if (macroDefinition != null) {
|
|
37016
|
+
macroTags.set(lvalue.identifier.id, macroDefinition);
|
|
37017
|
+
}
|
|
37018
|
+
break;
|
|
37027
37019
|
}
|
|
37028
|
-
|
|
37029
|
-
|
|
37030
|
-
|
|
37031
|
-
|
|
37020
|
+
case 'PropertyLoad': {
|
|
37021
|
+
if (typeof value.property === 'string') {
|
|
37022
|
+
const macroDefinition = macroTags.get(value.object.identifier.id);
|
|
37023
|
+
if (macroDefinition != null) {
|
|
37024
|
+
const propertyDefinition = macroDefinition.properties != null
|
|
37025
|
+
? ((_a = macroDefinition.properties.get(value.property)) !== null && _a !== void 0 ? _a : macroDefinition.properties.get('*'))
|
|
37026
|
+
: null;
|
|
37027
|
+
const propertyMacro = propertyDefinition !== null && propertyDefinition !== void 0 ? propertyDefinition : macroDefinition;
|
|
37028
|
+
macroTags.set(lvalue.identifier.id, propertyMacro);
|
|
37029
|
+
}
|
|
37030
|
+
}
|
|
37031
|
+
break;
|
|
37032
37032
|
}
|
|
37033
37033
|
}
|
|
37034
|
-
|
|
37035
|
-
|
|
37036
|
-
|
|
37037
|
-
|
|
37038
|
-
|
|
37034
|
+
}
|
|
37035
|
+
}
|
|
37036
|
+
return macroTags;
|
|
37037
|
+
}
|
|
37038
|
+
function mergeMacroArguments(fn, macroTags, macroKinds) {
|
|
37039
|
+
var _a;
|
|
37040
|
+
const macroValues = new Set(macroTags.keys());
|
|
37041
|
+
for (const block of Array.from(fn.body.blocks.values()).reverse()) {
|
|
37042
|
+
for (let i = block.instructions.length - 1; i >= 0; i--) {
|
|
37043
|
+
const instr = block.instructions[i];
|
|
37044
|
+
const { lvalue, value } = instr;
|
|
37045
|
+
switch (value.kind) {
|
|
37046
|
+
case 'DeclareContext':
|
|
37047
|
+
case 'DeclareLocal':
|
|
37048
|
+
case 'Destructure':
|
|
37049
|
+
case 'LoadContext':
|
|
37050
|
+
case 'LoadLocal':
|
|
37051
|
+
case 'PostfixUpdate':
|
|
37052
|
+
case 'PrefixUpdate':
|
|
37053
|
+
case 'StoreContext':
|
|
37054
|
+
case 'StoreLocal': {
|
|
37055
|
+
break;
|
|
37039
37056
|
}
|
|
37040
|
-
|
|
37041
|
-
|
|
37042
|
-
|
|
37043
|
-
|
|
37057
|
+
case 'CallExpression':
|
|
37058
|
+
case 'MethodCall': {
|
|
37059
|
+
const scope = lvalue.identifier.scope;
|
|
37060
|
+
if (scope == null) {
|
|
37061
|
+
continue;
|
|
37062
|
+
}
|
|
37063
|
+
const callee = value.kind === 'CallExpression' ? value.callee : value.property;
|
|
37064
|
+
const macroDefinition = (_a = macroTags.get(callee.identifier.id)) !== null && _a !== void 0 ? _a : macroTags.get(lvalue.identifier.id);
|
|
37065
|
+
if (macroDefinition != null) {
|
|
37066
|
+
visitOperands(macroDefinition, scope, lvalue, value, macroValues, macroTags);
|
|
37067
|
+
}
|
|
37068
|
+
break;
|
|
37044
37069
|
}
|
|
37045
|
-
|
|
37046
|
-
|
|
37047
|
-
|
|
37048
|
-
|
|
37049
|
-
|
|
37070
|
+
case 'JsxExpression': {
|
|
37071
|
+
const scope = lvalue.identifier.scope;
|
|
37072
|
+
if (scope == null) {
|
|
37073
|
+
continue;
|
|
37074
|
+
}
|
|
37075
|
+
let macroDefinition;
|
|
37076
|
+
if (value.tag.kind === 'Identifier') {
|
|
37077
|
+
macroDefinition = macroTags.get(value.tag.identifier.id);
|
|
37078
|
+
}
|
|
37079
|
+
else {
|
|
37080
|
+
macroDefinition = macroKinds.get(value.tag.name);
|
|
37081
|
+
}
|
|
37082
|
+
macroDefinition !== null && macroDefinition !== void 0 ? macroDefinition : (macroDefinition = macroTags.get(lvalue.identifier.id));
|
|
37083
|
+
if (macroDefinition != null) {
|
|
37084
|
+
visitOperands(macroDefinition, scope, lvalue, value, macroValues, macroTags);
|
|
37085
|
+
}
|
|
37086
|
+
break;
|
|
37050
37087
|
}
|
|
37051
|
-
|
|
37052
|
-
|
|
37053
|
-
|
|
37088
|
+
default: {
|
|
37089
|
+
const scope = lvalue.identifier.scope;
|
|
37090
|
+
if (scope == null) {
|
|
37054
37091
|
continue;
|
|
37055
37092
|
}
|
|
37056
|
-
|
|
37057
|
-
|
|
37093
|
+
const macroDefinition = macroTags.get(lvalue.identifier.id);
|
|
37094
|
+
if (macroDefinition != null) {
|
|
37095
|
+
visitOperands(macroDefinition, scope, lvalue, value, macroValues, macroTags);
|
|
37096
|
+
}
|
|
37097
|
+
break;
|
|
37058
37098
|
}
|
|
37059
37099
|
}
|
|
37060
37100
|
}
|
|
37061
|
-
|
|
37062
|
-
|
|
37063
|
-
|
|
37064
|
-
|
|
37065
|
-
|
|
37066
|
-
|
|
37067
|
-
|
|
37068
|
-
|
|
37069
|
-
|
|
37070
|
-
|
|
37071
|
-
|
|
37072
|
-
|
|
37073
|
-
|
|
37074
|
-
|
|
37075
|
-
|
|
37076
|
-
|
|
37101
|
+
for (const phi of block.phis) {
|
|
37102
|
+
const scope = phi.place.identifier.scope;
|
|
37103
|
+
if (scope == null) {
|
|
37104
|
+
continue;
|
|
37105
|
+
}
|
|
37106
|
+
const macroDefinition = macroTags.get(phi.place.identifier.id);
|
|
37107
|
+
if (macroDefinition == null ||
|
|
37108
|
+
macroDefinition.level === InlineLevel.Shallow) {
|
|
37109
|
+
continue;
|
|
37110
|
+
}
|
|
37111
|
+
macroValues.add(phi.place.identifier.id);
|
|
37112
|
+
for (const operand of phi.operands.values()) {
|
|
37113
|
+
operand.identifier.scope = scope;
|
|
37114
|
+
expandFbtScopeRange(scope.range, operand.identifier.mutableRange);
|
|
37115
|
+
macroTags.set(operand.identifier.id, macroDefinition);
|
|
37116
|
+
macroValues.add(operand.identifier.id);
|
|
37117
|
+
}
|
|
37077
37118
|
}
|
|
37078
37119
|
}
|
|
37079
|
-
|
|
37080
|
-
return methods;
|
|
37081
|
-
}
|
|
37082
|
-
else {
|
|
37083
|
-
return null;
|
|
37084
|
-
}
|
|
37085
|
-
}
|
|
37086
|
-
function isFbtCallExpression(fbtValues, value) {
|
|
37087
|
-
return ((value.kind === 'CallExpression' &&
|
|
37088
|
-
fbtValues.has(value.callee.identifier.id)) ||
|
|
37089
|
-
(value.kind === 'MethodCall' && fbtValues.has(value.property.identifier.id)));
|
|
37090
|
-
}
|
|
37091
|
-
function isFbtJsxExpression(fbtMacroTags, fbtValues, value) {
|
|
37092
|
-
return (value.kind === 'JsxExpression' &&
|
|
37093
|
-
((value.tag.kind === 'Identifier' &&
|
|
37094
|
-
fbtValues.has(value.tag.identifier.id)) ||
|
|
37095
|
-
(value.tag.kind === 'BuiltinTag' &&
|
|
37096
|
-
matchesExactTag(value.tag.name, fbtMacroTags))));
|
|
37097
|
-
}
|
|
37098
|
-
function isFbtJsxChild(fbtValues, lvalue, value) {
|
|
37099
|
-
return ((value.kind === 'JsxExpression' || value.kind === 'JsxFragment') &&
|
|
37100
|
-
lvalue !== null &&
|
|
37101
|
-
fbtValues.has(lvalue.identifier.id));
|
|
37120
|
+
return macroValues;
|
|
37102
37121
|
}
|
|
37103
37122
|
function expandFbtScopeRange(fbtRange, extendWith) {
|
|
37104
37123
|
if (extendWith.start !== 0) {
|
|
37105
37124
|
fbtRange.start = makeInstructionId(Math.min(fbtRange.start, extendWith.start));
|
|
37106
37125
|
}
|
|
37107
37126
|
}
|
|
37127
|
+
function visitOperands(macroDefinition, scope, lvalue, value, macroValues, macroTags) {
|
|
37128
|
+
macroValues.add(lvalue.identifier.id);
|
|
37129
|
+
for (const operand of eachInstructionValueOperand(value)) {
|
|
37130
|
+
if (macroDefinition.level === InlineLevel.Transitive) {
|
|
37131
|
+
operand.identifier.scope = scope;
|
|
37132
|
+
expandFbtScopeRange(scope.range, operand.identifier.mutableRange);
|
|
37133
|
+
macroTags.set(operand.identifier.id, macroDefinition);
|
|
37134
|
+
}
|
|
37135
|
+
macroValues.add(operand.identifier.id);
|
|
37136
|
+
}
|
|
37137
|
+
}
|
|
37108
37138
|
|
|
37109
37139
|
var _Context_nextCacheIndex, _Context_declarations;
|
|
37110
37140
|
const MEMO_CACHE_SENTINEL = 'react.memo_cache_sentinel';
|
|
@@ -40302,7 +40332,7 @@ function inferMutationAliasingEffects(fn, { isFunctionExpression } = {
|
|
|
40302
40332
|
}
|
|
40303
40333
|
queue(fn.body.entry, initialState);
|
|
40304
40334
|
const hoistedContextDeclarations = findHoistedContextDeclarations(fn);
|
|
40305
|
-
const context = new Context$1(isFunctionExpression, fn, hoistedContextDeclarations);
|
|
40335
|
+
const context = new Context$1(isFunctionExpression, fn, hoistedContextDeclarations, findNonMutatedDestructureSpreads(fn));
|
|
40306
40336
|
let iterationCount = 0;
|
|
40307
40337
|
while (queuedStates.size !== 0) {
|
|
40308
40338
|
iterationCount++;
|
|
@@ -40366,7 +40396,7 @@ function findHoistedContextDeclarations(fn) {
|
|
|
40366
40396
|
return hoisted;
|
|
40367
40397
|
}
|
|
40368
40398
|
let Context$1 = class Context {
|
|
40369
|
-
constructor(isFunctionExpression, fn, hoistedContextDeclarations) {
|
|
40399
|
+
constructor(isFunctionExpression, fn, hoistedContextDeclarations, nonMutatingSpreads) {
|
|
40370
40400
|
this.internedEffects = new Map();
|
|
40371
40401
|
this.instructionSignatureCache = new Map();
|
|
40372
40402
|
this.effectInstructionValueCache = new Map();
|
|
@@ -40376,6 +40406,7 @@ let Context$1 = class Context {
|
|
|
40376
40406
|
this.isFuctionExpression = isFunctionExpression;
|
|
40377
40407
|
this.fn = fn;
|
|
40378
40408
|
this.hoistedContextDeclarations = hoistedContextDeclarations;
|
|
40409
|
+
this.nonMutatingSpreads = nonMutatingSpreads;
|
|
40379
40410
|
}
|
|
40380
40411
|
cacheApplySignature(signature, effect, f) {
|
|
40381
40412
|
const inner = getOrInsertDefault(this.applySignatureCache, signature, new Map());
|
|
@@ -40391,6 +40422,114 @@ let Context$1 = class Context {
|
|
|
40391
40422
|
return interned;
|
|
40392
40423
|
}
|
|
40393
40424
|
};
|
|
40425
|
+
function findNonMutatedDestructureSpreads(fn) {
|
|
40426
|
+
const knownFrozen = new Set();
|
|
40427
|
+
if (fn.fnType === 'Component') {
|
|
40428
|
+
const [props] = fn.params;
|
|
40429
|
+
if (props != null && props.kind === 'Identifier') {
|
|
40430
|
+
knownFrozen.add(props.identifier.id);
|
|
40431
|
+
}
|
|
40432
|
+
}
|
|
40433
|
+
else {
|
|
40434
|
+
for (const param of fn.params) {
|
|
40435
|
+
if (param.kind === 'Identifier') {
|
|
40436
|
+
knownFrozen.add(param.identifier.id);
|
|
40437
|
+
}
|
|
40438
|
+
}
|
|
40439
|
+
}
|
|
40440
|
+
const candidateNonMutatingSpreads = new Map();
|
|
40441
|
+
for (const block of fn.body.blocks.values()) {
|
|
40442
|
+
if (candidateNonMutatingSpreads.size !== 0) {
|
|
40443
|
+
for (const phi of block.phis) {
|
|
40444
|
+
for (const operand of phi.operands.values()) {
|
|
40445
|
+
const spread = candidateNonMutatingSpreads.get(operand.identifier.id);
|
|
40446
|
+
if (spread != null) {
|
|
40447
|
+
candidateNonMutatingSpreads.delete(spread);
|
|
40448
|
+
}
|
|
40449
|
+
}
|
|
40450
|
+
}
|
|
40451
|
+
}
|
|
40452
|
+
for (const instr of block.instructions) {
|
|
40453
|
+
const { lvalue, value } = instr;
|
|
40454
|
+
switch (value.kind) {
|
|
40455
|
+
case 'Destructure': {
|
|
40456
|
+
if (!knownFrozen.has(value.value.identifier.id) ||
|
|
40457
|
+
!(value.lvalue.kind === InstructionKind.Let ||
|
|
40458
|
+
value.lvalue.kind === InstructionKind.Const) ||
|
|
40459
|
+
value.lvalue.pattern.kind !== 'ObjectPattern') {
|
|
40460
|
+
continue;
|
|
40461
|
+
}
|
|
40462
|
+
for (const item of value.lvalue.pattern.properties) {
|
|
40463
|
+
if (item.kind !== 'Spread') {
|
|
40464
|
+
continue;
|
|
40465
|
+
}
|
|
40466
|
+
candidateNonMutatingSpreads.set(item.place.identifier.id, item.place.identifier.id);
|
|
40467
|
+
}
|
|
40468
|
+
break;
|
|
40469
|
+
}
|
|
40470
|
+
case 'LoadLocal': {
|
|
40471
|
+
const spread = candidateNonMutatingSpreads.get(value.place.identifier.id);
|
|
40472
|
+
if (spread != null) {
|
|
40473
|
+
candidateNonMutatingSpreads.set(lvalue.identifier.id, spread);
|
|
40474
|
+
}
|
|
40475
|
+
break;
|
|
40476
|
+
}
|
|
40477
|
+
case 'StoreLocal': {
|
|
40478
|
+
const spread = candidateNonMutatingSpreads.get(value.value.identifier.id);
|
|
40479
|
+
if (spread != null) {
|
|
40480
|
+
candidateNonMutatingSpreads.set(lvalue.identifier.id, spread);
|
|
40481
|
+
candidateNonMutatingSpreads.set(value.lvalue.place.identifier.id, spread);
|
|
40482
|
+
}
|
|
40483
|
+
break;
|
|
40484
|
+
}
|
|
40485
|
+
case 'JsxFragment':
|
|
40486
|
+
case 'JsxExpression': {
|
|
40487
|
+
break;
|
|
40488
|
+
}
|
|
40489
|
+
case 'PropertyLoad': {
|
|
40490
|
+
break;
|
|
40491
|
+
}
|
|
40492
|
+
case 'CallExpression':
|
|
40493
|
+
case 'MethodCall': {
|
|
40494
|
+
const callee = value.kind === 'CallExpression' ? value.callee : value.property;
|
|
40495
|
+
if (getHookKind(fn.env, callee.identifier) != null) {
|
|
40496
|
+
if (!isRefOrRefValue(lvalue.identifier)) {
|
|
40497
|
+
knownFrozen.add(lvalue.identifier.id);
|
|
40498
|
+
}
|
|
40499
|
+
}
|
|
40500
|
+
else {
|
|
40501
|
+
if (candidateNonMutatingSpreads.size !== 0) {
|
|
40502
|
+
for (const operand of eachInstructionValueOperand(value)) {
|
|
40503
|
+
const spread = candidateNonMutatingSpreads.get(operand.identifier.id);
|
|
40504
|
+
if (spread != null) {
|
|
40505
|
+
candidateNonMutatingSpreads.delete(spread);
|
|
40506
|
+
}
|
|
40507
|
+
}
|
|
40508
|
+
}
|
|
40509
|
+
}
|
|
40510
|
+
break;
|
|
40511
|
+
}
|
|
40512
|
+
default: {
|
|
40513
|
+
if (candidateNonMutatingSpreads.size !== 0) {
|
|
40514
|
+
for (const operand of eachInstructionValueOperand(value)) {
|
|
40515
|
+
const spread = candidateNonMutatingSpreads.get(operand.identifier.id);
|
|
40516
|
+
if (spread != null) {
|
|
40517
|
+
candidateNonMutatingSpreads.delete(spread);
|
|
40518
|
+
}
|
|
40519
|
+
}
|
|
40520
|
+
}
|
|
40521
|
+
}
|
|
40522
|
+
}
|
|
40523
|
+
}
|
|
40524
|
+
}
|
|
40525
|
+
const nonMutatingSpreads = new Set();
|
|
40526
|
+
for (const [key, value] of candidateNonMutatingSpreads) {
|
|
40527
|
+
if (key === value) {
|
|
40528
|
+
nonMutatingSpreads.add(key);
|
|
40529
|
+
}
|
|
40530
|
+
}
|
|
40531
|
+
return nonMutatingSpreads;
|
|
40532
|
+
}
|
|
40394
40533
|
function inferParam(param, initialState, paramKind) {
|
|
40395
40534
|
const place = param.kind === 'Identifier' ? param : param.place;
|
|
40396
40535
|
const value = {
|
|
@@ -41645,7 +41784,9 @@ function computeSignatureForInstruction(context, env, instr) {
|
|
|
41645
41784
|
kind: 'Create',
|
|
41646
41785
|
into: place,
|
|
41647
41786
|
reason: ValueReason.Other,
|
|
41648
|
-
value:
|
|
41787
|
+
value: context.nonMutatingSpreads.has(place.identifier.id)
|
|
41788
|
+
? ValueKind.Frozen
|
|
41789
|
+
: ValueKind.Mutable,
|
|
41649
41790
|
});
|
|
41650
41791
|
effects.push({
|
|
41651
41792
|
kind: 'Capture',
|
|
@@ -44336,7 +44477,6 @@ function extractManualMemoizationArgs(instr, kind, sidemap, errors) {
|
|
|
44336
44477
|
};
|
|
44337
44478
|
}
|
|
44338
44479
|
function dropManualMemoization(func) {
|
|
44339
|
-
var _a;
|
|
44340
44480
|
const errors = new CompilerError();
|
|
44341
44481
|
const isValidationEnabled = func.env.config.validatePreserveExistingMemoizationGuarantees ||
|
|
44342
44482
|
func.env.config.validateNoSetStateInRender ||
|
|
@@ -44366,26 +44506,6 @@ function dropManualMemoization(func) {
|
|
|
44366
44506
|
if (fnPlace == null) {
|
|
44367
44507
|
continue;
|
|
44368
44508
|
}
|
|
44369
|
-
if (func.env.config.validateNoVoidUseMemo &&
|
|
44370
|
-
manualMemo.kind === 'useMemo') {
|
|
44371
|
-
const funcToCheck = (_a = sidemap.functions.get(fnPlace.identifier.id)) === null || _a === void 0 ? void 0 : _a.value;
|
|
44372
|
-
if (funcToCheck !== undefined && funcToCheck.loweredFunc.func) {
|
|
44373
|
-
if (!hasNonVoidReturn(funcToCheck.loweredFunc.func)) {
|
|
44374
|
-
errors.pushDiagnostic(CompilerDiagnostic.create({
|
|
44375
|
-
category: ErrorCategory.VoidUseMemo,
|
|
44376
|
-
reason: 'useMemo() callbacks must return a value',
|
|
44377
|
-
description: `This ${manualMemo.loadInstr.value.kind === 'PropertyLoad'
|
|
44378
|
-
? 'React.useMemo'
|
|
44379
|
-
: 'useMemo'} callback doesn't return a value. useMemo is for computing and caching values, not for arbitrary side effects`,
|
|
44380
|
-
suggestions: null,
|
|
44381
|
-
}).withDetails({
|
|
44382
|
-
kind: 'error',
|
|
44383
|
-
loc: instr.value.loc,
|
|
44384
|
-
message: 'useMemo() callbacks must return a value',
|
|
44385
|
-
}));
|
|
44386
|
-
}
|
|
44387
|
-
}
|
|
44388
|
-
}
|
|
44389
44509
|
instr.value = getManualMemoizationReplacement(fnPlace, instr.value.loc, manualMemo.kind);
|
|
44390
44510
|
if (isValidationEnabled) {
|
|
44391
44511
|
if (!sidemap.functions.has(fnPlace.identifier.id)) {
|
|
@@ -44497,17 +44617,6 @@ function findOptionalPlaces(fn) {
|
|
|
44497
44617
|
}
|
|
44498
44618
|
return optionals;
|
|
44499
44619
|
}
|
|
44500
|
-
function hasNonVoidReturn(func) {
|
|
44501
|
-
for (const [, block] of func.body.blocks) {
|
|
44502
|
-
if (block.terminal.kind === 'return') {
|
|
44503
|
-
if (block.terminal.returnVariant === 'Explicit' ||
|
|
44504
|
-
block.terminal.returnVariant === 'Implicit') {
|
|
44505
|
-
return true;
|
|
44506
|
-
}
|
|
44507
|
-
}
|
|
44508
|
-
}
|
|
44509
|
-
return false;
|
|
44510
|
-
}
|
|
44511
44620
|
|
|
44512
44621
|
class StableSidemap {
|
|
44513
44622
|
constructor(env) {
|
|
@@ -47951,7 +48060,7 @@ function* generateInstructionTypes(env, names, instr) {
|
|
|
47951
48060
|
});
|
|
47952
48061
|
}
|
|
47953
48062
|
else {
|
|
47954
|
-
|
|
48063
|
+
continue;
|
|
47955
48064
|
}
|
|
47956
48065
|
}
|
|
47957
48066
|
}
|
|
@@ -49990,11 +50099,18 @@ function isUnmemoized(operand, scopes) {
|
|
|
49990
50099
|
|
|
49991
50100
|
function validateUseMemo(fn) {
|
|
49992
50101
|
const errors = new CompilerError();
|
|
50102
|
+
const voidMemoErrors = new CompilerError();
|
|
49993
50103
|
const useMemos = new Set();
|
|
49994
50104
|
const react = new Set();
|
|
49995
50105
|
const functions = new Map();
|
|
50106
|
+
const unusedUseMemos = new Map();
|
|
49996
50107
|
for (const [, block] of fn.body.blocks) {
|
|
49997
50108
|
for (const { lvalue, value } of block.instructions) {
|
|
50109
|
+
if (unusedUseMemos.size !== 0) {
|
|
50110
|
+
for (const operand of eachInstructionValueOperand(value)) {
|
|
50111
|
+
unusedUseMemos.delete(operand.identifier.id);
|
|
50112
|
+
}
|
|
50113
|
+
}
|
|
49998
50114
|
switch (value.kind) {
|
|
49999
50115
|
case 'LoadGlobal': {
|
|
50000
50116
|
if (value.binding.name === 'useMemo') {
|
|
@@ -50019,10 +50135,8 @@ function validateUseMemo(fn) {
|
|
|
50019
50135
|
}
|
|
50020
50136
|
case 'MethodCall':
|
|
50021
50137
|
case 'CallExpression': {
|
|
50022
|
-
const callee = value.kind === 'CallExpression'
|
|
50023
|
-
|
|
50024
|
-
: value.property.identifier.id;
|
|
50025
|
-
const isUseMemo = useMemos.has(callee);
|
|
50138
|
+
const callee = value.kind === 'CallExpression' ? value.callee : value.property;
|
|
50139
|
+
const isUseMemo = useMemos.has(callee.identifier.id);
|
|
50026
50140
|
if (!isUseMemo || value.args.length === 0) {
|
|
50027
50141
|
continue;
|
|
50028
50142
|
}
|
|
@@ -50062,13 +50176,87 @@ function validateUseMemo(fn) {
|
|
|
50062
50176
|
message: 'Async and generator functions are not supported',
|
|
50063
50177
|
}));
|
|
50064
50178
|
}
|
|
50179
|
+
validateNoContextVariableAssignment(body.loweredFunc.func, errors);
|
|
50180
|
+
if (fn.env.config.validateNoVoidUseMemo) {
|
|
50181
|
+
if (!hasNonVoidReturn(body.loweredFunc.func)) {
|
|
50182
|
+
voidMemoErrors.pushDiagnostic(CompilerDiagnostic.create({
|
|
50183
|
+
category: ErrorCategory.VoidUseMemo,
|
|
50184
|
+
reason: 'useMemo() callbacks must return a value',
|
|
50185
|
+
description: `This useMemo() callback doesn't return a value. useMemo() is for computing and caching values, not for arbitrary side effects`,
|
|
50186
|
+
suggestions: null,
|
|
50187
|
+
}).withDetails({
|
|
50188
|
+
kind: 'error',
|
|
50189
|
+
loc: body.loc,
|
|
50190
|
+
message: 'useMemo() callbacks must return a value',
|
|
50191
|
+
}));
|
|
50192
|
+
}
|
|
50193
|
+
else {
|
|
50194
|
+
unusedUseMemos.set(lvalue.identifier.id, callee.loc);
|
|
50195
|
+
}
|
|
50196
|
+
}
|
|
50065
50197
|
break;
|
|
50066
50198
|
}
|
|
50067
50199
|
}
|
|
50068
50200
|
}
|
|
50201
|
+
if (unusedUseMemos.size !== 0) {
|
|
50202
|
+
for (const operand of eachTerminalOperand(block.terminal)) {
|
|
50203
|
+
unusedUseMemos.delete(operand.identifier.id);
|
|
50204
|
+
}
|
|
50205
|
+
}
|
|
50206
|
+
}
|
|
50207
|
+
if (unusedUseMemos.size !== 0) {
|
|
50208
|
+
for (const loc of unusedUseMemos.values()) {
|
|
50209
|
+
voidMemoErrors.pushDiagnostic(CompilerDiagnostic.create({
|
|
50210
|
+
category: ErrorCategory.VoidUseMemo,
|
|
50211
|
+
reason: 'useMemo() result is unused',
|
|
50212
|
+
description: `This useMemo() value is unused. useMemo() is for computing and caching values, not for arbitrary side effects`,
|
|
50213
|
+
suggestions: null,
|
|
50214
|
+
}).withDetails({
|
|
50215
|
+
kind: 'error',
|
|
50216
|
+
loc,
|
|
50217
|
+
message: 'useMemo() result is unused',
|
|
50218
|
+
}));
|
|
50219
|
+
}
|
|
50069
50220
|
}
|
|
50221
|
+
fn.env.logErrors(voidMemoErrors.asResult());
|
|
50070
50222
|
return errors.asResult();
|
|
50071
50223
|
}
|
|
50224
|
+
function validateNoContextVariableAssignment(fn, errors) {
|
|
50225
|
+
const context = new Set(fn.context.map(place => place.identifier.id));
|
|
50226
|
+
for (const block of fn.body.blocks.values()) {
|
|
50227
|
+
for (const instr of block.instructions) {
|
|
50228
|
+
const value = instr.value;
|
|
50229
|
+
switch (value.kind) {
|
|
50230
|
+
case 'StoreContext': {
|
|
50231
|
+
if (context.has(value.lvalue.place.identifier.id)) {
|
|
50232
|
+
errors.pushDiagnostic(CompilerDiagnostic.create({
|
|
50233
|
+
category: ErrorCategory.UseMemo,
|
|
50234
|
+
reason: 'useMemo() callbacks may not reassign variables declared outside of the callback',
|
|
50235
|
+
description: 'useMemo() callbacks must be pure functions and cannot reassign variables defined outside of the callback function',
|
|
50236
|
+
suggestions: null,
|
|
50237
|
+
}).withDetails({
|
|
50238
|
+
kind: 'error',
|
|
50239
|
+
loc: value.lvalue.place.loc,
|
|
50240
|
+
message: 'Cannot reassign variable',
|
|
50241
|
+
}));
|
|
50242
|
+
}
|
|
50243
|
+
break;
|
|
50244
|
+
}
|
|
50245
|
+
}
|
|
50246
|
+
}
|
|
50247
|
+
}
|
|
50248
|
+
}
|
|
50249
|
+
function hasNonVoidReturn(func) {
|
|
50250
|
+
for (const [, block] of func.body.blocks) {
|
|
50251
|
+
if (block.terminal.kind === 'return') {
|
|
50252
|
+
if (block.terminal.returnVariant === 'Explicit' ||
|
|
50253
|
+
block.terminal.returnVariant === 'Implicit') {
|
|
50254
|
+
return true;
|
|
50255
|
+
}
|
|
50256
|
+
}
|
|
50257
|
+
}
|
|
50258
|
+
return false;
|
|
50259
|
+
}
|
|
50072
50260
|
|
|
50073
50261
|
function validateLocalsNotReassignedAfterRender(fn) {
|
|
50074
50262
|
const contextVariables = new Set();
|
|
@@ -51694,7 +51882,7 @@ function validateNoDerivedComputationsInEffects(fn) {
|
|
|
51694
51882
|
});
|
|
51695
51883
|
return (_a = locals.get(dep.identifier.id)) !== null && _a !== void 0 ? _a : dep.identifier.id;
|
|
51696
51884
|
});
|
|
51697
|
-
validateEffect(effectFunction.loweredFunc.func, dependencies, errors);
|
|
51885
|
+
validateEffect$1(effectFunction.loweredFunc.func, dependencies, errors);
|
|
51698
51886
|
}
|
|
51699
51887
|
}
|
|
51700
51888
|
}
|
|
@@ -51704,7 +51892,7 @@ function validateNoDerivedComputationsInEffects(fn) {
|
|
|
51704
51892
|
throw errors;
|
|
51705
51893
|
}
|
|
51706
51894
|
}
|
|
51707
|
-
function validateEffect(effectFunction, effectDeps, errors) {
|
|
51895
|
+
function validateEffect$1(effectFunction, effectDeps, errors) {
|
|
51708
51896
|
for (const operand of effectFunction.context) {
|
|
51709
51897
|
if (isSetStateType(operand.identifier)) {
|
|
51710
51898
|
continue;
|
|
@@ -51817,6 +52005,339 @@ function validateEffect(effectFunction, effectDeps, errors) {
|
|
|
51817
52005
|
}
|
|
51818
52006
|
}
|
|
51819
52007
|
|
|
52008
|
+
class DerivationCache {
|
|
52009
|
+
constructor() {
|
|
52010
|
+
this.hasChanges = false;
|
|
52011
|
+
this.cache = new Map();
|
|
52012
|
+
}
|
|
52013
|
+
snapshot() {
|
|
52014
|
+
const hasChanges = this.hasChanges;
|
|
52015
|
+
this.hasChanges = false;
|
|
52016
|
+
return hasChanges;
|
|
52017
|
+
}
|
|
52018
|
+
addDerivationEntry(derivedVar, sourcesIds, typeOfValue) {
|
|
52019
|
+
var _a, _b;
|
|
52020
|
+
let newValue = {
|
|
52021
|
+
place: derivedVar,
|
|
52022
|
+
sourcesIds: new Set(),
|
|
52023
|
+
typeOfValue: typeOfValue !== null && typeOfValue !== void 0 ? typeOfValue : 'ignored',
|
|
52024
|
+
};
|
|
52025
|
+
if (sourcesIds !== undefined) {
|
|
52026
|
+
for (const id of sourcesIds) {
|
|
52027
|
+
const sourcePlace = (_a = this.cache.get(id)) === null || _a === void 0 ? void 0 : _a.place;
|
|
52028
|
+
if (sourcePlace === undefined) {
|
|
52029
|
+
continue;
|
|
52030
|
+
}
|
|
52031
|
+
if (sourcePlace.identifier.name === null ||
|
|
52032
|
+
((_b = sourcePlace.identifier.name) === null || _b === void 0 ? void 0 : _b.kind) === 'promoted') {
|
|
52033
|
+
newValue.sourcesIds.add(derivedVar.identifier.id);
|
|
52034
|
+
}
|
|
52035
|
+
else {
|
|
52036
|
+
newValue.sourcesIds.add(sourcePlace.identifier.id);
|
|
52037
|
+
}
|
|
52038
|
+
}
|
|
52039
|
+
}
|
|
52040
|
+
if (newValue.sourcesIds.size === 0) {
|
|
52041
|
+
newValue.sourcesIds.add(derivedVar.identifier.id);
|
|
52042
|
+
}
|
|
52043
|
+
const existingValue = this.cache.get(derivedVar.identifier.id);
|
|
52044
|
+
if (existingValue === undefined ||
|
|
52045
|
+
!this.isDerivationEqual(existingValue, newValue)) {
|
|
52046
|
+
this.cache.set(derivedVar.identifier.id, newValue);
|
|
52047
|
+
this.hasChanges = true;
|
|
52048
|
+
}
|
|
52049
|
+
}
|
|
52050
|
+
isDerivationEqual(a, b) {
|
|
52051
|
+
if (a.typeOfValue !== b.typeOfValue) {
|
|
52052
|
+
return false;
|
|
52053
|
+
}
|
|
52054
|
+
if (a.sourcesIds.size !== b.sourcesIds.size) {
|
|
52055
|
+
return false;
|
|
52056
|
+
}
|
|
52057
|
+
for (const id of a.sourcesIds) {
|
|
52058
|
+
if (!b.sourcesIds.has(id)) {
|
|
52059
|
+
return false;
|
|
52060
|
+
}
|
|
52061
|
+
}
|
|
52062
|
+
return true;
|
|
52063
|
+
}
|
|
52064
|
+
}
|
|
52065
|
+
function validateNoDerivedComputationsInEffects_exp(fn) {
|
|
52066
|
+
const functions = new Map();
|
|
52067
|
+
const derivationCache = new DerivationCache();
|
|
52068
|
+
const errors = new CompilerError();
|
|
52069
|
+
const effects = new Set();
|
|
52070
|
+
const setStateCache = new Map();
|
|
52071
|
+
const effectSetStateCache = new Map();
|
|
52072
|
+
const context = {
|
|
52073
|
+
functions,
|
|
52074
|
+
errors,
|
|
52075
|
+
derivationCache,
|
|
52076
|
+
effects,
|
|
52077
|
+
setStateCache,
|
|
52078
|
+
effectSetStateCache,
|
|
52079
|
+
};
|
|
52080
|
+
if (fn.fnType === 'Hook') {
|
|
52081
|
+
for (const param of fn.params) {
|
|
52082
|
+
if (param.kind === 'Identifier') {
|
|
52083
|
+
context.derivationCache.cache.set(param.identifier.id, {
|
|
52084
|
+
place: param,
|
|
52085
|
+
sourcesIds: new Set([param.identifier.id]),
|
|
52086
|
+
typeOfValue: 'fromProps',
|
|
52087
|
+
});
|
|
52088
|
+
context.derivationCache.hasChanges = true;
|
|
52089
|
+
}
|
|
52090
|
+
}
|
|
52091
|
+
}
|
|
52092
|
+
else if (fn.fnType === 'Component') {
|
|
52093
|
+
const props = fn.params[0];
|
|
52094
|
+
if (props != null && props.kind === 'Identifier') {
|
|
52095
|
+
context.derivationCache.cache.set(props.identifier.id, {
|
|
52096
|
+
place: props,
|
|
52097
|
+
sourcesIds: new Set([props.identifier.id]),
|
|
52098
|
+
typeOfValue: 'fromProps',
|
|
52099
|
+
});
|
|
52100
|
+
context.derivationCache.hasChanges = true;
|
|
52101
|
+
}
|
|
52102
|
+
}
|
|
52103
|
+
let isFirstPass = true;
|
|
52104
|
+
do {
|
|
52105
|
+
for (const block of fn.body.blocks.values()) {
|
|
52106
|
+
recordPhiDerivations(block, context);
|
|
52107
|
+
for (const instr of block.instructions) {
|
|
52108
|
+
recordInstructionDerivations(instr, context, isFirstPass);
|
|
52109
|
+
}
|
|
52110
|
+
}
|
|
52111
|
+
isFirstPass = false;
|
|
52112
|
+
} while (context.derivationCache.snapshot());
|
|
52113
|
+
for (const effect of effects) {
|
|
52114
|
+
validateEffect(effect, context);
|
|
52115
|
+
}
|
|
52116
|
+
if (errors.hasAnyErrors()) {
|
|
52117
|
+
throw errors;
|
|
52118
|
+
}
|
|
52119
|
+
}
|
|
52120
|
+
function recordPhiDerivations(block, context) {
|
|
52121
|
+
for (const phi of block.phis) {
|
|
52122
|
+
let typeOfValue = 'ignored';
|
|
52123
|
+
let sourcesIds = new Set();
|
|
52124
|
+
for (const operand of phi.operands.values()) {
|
|
52125
|
+
const operandMetadata = context.derivationCache.cache.get(operand.identifier.id);
|
|
52126
|
+
if (operandMetadata === undefined) {
|
|
52127
|
+
continue;
|
|
52128
|
+
}
|
|
52129
|
+
typeOfValue = joinValue(typeOfValue, operandMetadata.typeOfValue);
|
|
52130
|
+
sourcesIds.add(operand.identifier.id);
|
|
52131
|
+
}
|
|
52132
|
+
if (typeOfValue !== 'ignored') {
|
|
52133
|
+
context.derivationCache.addDerivationEntry(phi.place, sourcesIds, typeOfValue);
|
|
52134
|
+
}
|
|
52135
|
+
}
|
|
52136
|
+
}
|
|
52137
|
+
function joinValue(lvalueType, valueType) {
|
|
52138
|
+
if (lvalueType === 'ignored')
|
|
52139
|
+
return valueType;
|
|
52140
|
+
if (valueType === 'ignored')
|
|
52141
|
+
return lvalueType;
|
|
52142
|
+
if (lvalueType === valueType)
|
|
52143
|
+
return lvalueType;
|
|
52144
|
+
return 'fromPropsAndState';
|
|
52145
|
+
}
|
|
52146
|
+
function recordInstructionDerivations(instr, context, isFirstPass) {
|
|
52147
|
+
let typeOfValue = 'ignored';
|
|
52148
|
+
const sources = new Set();
|
|
52149
|
+
const { lvalue, value } = instr;
|
|
52150
|
+
if (value.kind === 'FunctionExpression') {
|
|
52151
|
+
context.functions.set(lvalue.identifier.id, value);
|
|
52152
|
+
for (const [, block] of value.loweredFunc.func.body.blocks) {
|
|
52153
|
+
for (const instr of block.instructions) {
|
|
52154
|
+
recordInstructionDerivations(instr, context, isFirstPass);
|
|
52155
|
+
}
|
|
52156
|
+
}
|
|
52157
|
+
}
|
|
52158
|
+
else if (value.kind === 'CallExpression' || value.kind === 'MethodCall') {
|
|
52159
|
+
const callee = value.kind === 'CallExpression' ? value.callee : value.property;
|
|
52160
|
+
if (isUseEffectHookType(callee.identifier) &&
|
|
52161
|
+
value.args.length === 2 &&
|
|
52162
|
+
value.args[0].kind === 'Identifier' &&
|
|
52163
|
+
value.args[1].kind === 'Identifier') {
|
|
52164
|
+
const effectFunction = context.functions.get(value.args[0].identifier.id);
|
|
52165
|
+
if (effectFunction != null) {
|
|
52166
|
+
context.effects.add(effectFunction.loweredFunc.func);
|
|
52167
|
+
}
|
|
52168
|
+
}
|
|
52169
|
+
else if (isUseStateType(lvalue.identifier) && value.args.length > 0) {
|
|
52170
|
+
const stateValueSource = value.args[0];
|
|
52171
|
+
if (stateValueSource.kind === 'Identifier') {
|
|
52172
|
+
sources.add(stateValueSource.identifier.id);
|
|
52173
|
+
}
|
|
52174
|
+
typeOfValue = joinValue(typeOfValue, 'fromState');
|
|
52175
|
+
}
|
|
52176
|
+
}
|
|
52177
|
+
for (const operand of eachInstructionOperand(instr)) {
|
|
52178
|
+
if (isSetStateType(operand.identifier) &&
|
|
52179
|
+
operand.loc !== GeneratedSource &&
|
|
52180
|
+
isFirstPass) {
|
|
52181
|
+
if (context.setStateCache.has(operand.loc.identifierName)) {
|
|
52182
|
+
context.setStateCache.get(operand.loc.identifierName).push(operand);
|
|
52183
|
+
}
|
|
52184
|
+
else {
|
|
52185
|
+
context.setStateCache.set(operand.loc.identifierName, [operand]);
|
|
52186
|
+
}
|
|
52187
|
+
}
|
|
52188
|
+
const operandMetadata = context.derivationCache.cache.get(operand.identifier.id);
|
|
52189
|
+
if (operandMetadata === undefined) {
|
|
52190
|
+
continue;
|
|
52191
|
+
}
|
|
52192
|
+
typeOfValue = joinValue(typeOfValue, operandMetadata.typeOfValue);
|
|
52193
|
+
for (const id of operandMetadata.sourcesIds) {
|
|
52194
|
+
sources.add(id);
|
|
52195
|
+
}
|
|
52196
|
+
}
|
|
52197
|
+
if (typeOfValue === 'ignored') {
|
|
52198
|
+
return;
|
|
52199
|
+
}
|
|
52200
|
+
for (const lvalue of eachInstructionLValue(instr)) {
|
|
52201
|
+
context.derivationCache.addDerivationEntry(lvalue, sources, typeOfValue);
|
|
52202
|
+
}
|
|
52203
|
+
for (const operand of eachInstructionOperand(instr)) {
|
|
52204
|
+
switch (operand.effect) {
|
|
52205
|
+
case Effect.Capture:
|
|
52206
|
+
case Effect.Store:
|
|
52207
|
+
case Effect.ConditionallyMutate:
|
|
52208
|
+
case Effect.ConditionallyMutateIterator:
|
|
52209
|
+
case Effect.Mutate: {
|
|
52210
|
+
if (isMutable(instr, operand)) {
|
|
52211
|
+
context.derivationCache.addDerivationEntry(operand, sources, typeOfValue);
|
|
52212
|
+
}
|
|
52213
|
+
break;
|
|
52214
|
+
}
|
|
52215
|
+
case Effect.Freeze:
|
|
52216
|
+
case Effect.Read: {
|
|
52217
|
+
break;
|
|
52218
|
+
}
|
|
52219
|
+
case Effect.Unknown: {
|
|
52220
|
+
CompilerError.invariant(false, {
|
|
52221
|
+
reason: 'Unexpected unknown effect',
|
|
52222
|
+
description: null,
|
|
52223
|
+
details: [
|
|
52224
|
+
{
|
|
52225
|
+
kind: 'error',
|
|
52226
|
+
loc: operand.loc,
|
|
52227
|
+
message: 'Unexpected unknown effect',
|
|
52228
|
+
},
|
|
52229
|
+
],
|
|
52230
|
+
});
|
|
52231
|
+
}
|
|
52232
|
+
default: {
|
|
52233
|
+
assertExhaustive$1(operand.effect, `Unexpected effect kind \`${operand.effect}\``);
|
|
52234
|
+
}
|
|
52235
|
+
}
|
|
52236
|
+
}
|
|
52237
|
+
}
|
|
52238
|
+
function validateEffect(effectFunction, context) {
|
|
52239
|
+
const seenBlocks = new Set();
|
|
52240
|
+
const effectDerivedSetStateCalls = [];
|
|
52241
|
+
const globals = new Set();
|
|
52242
|
+
for (const block of effectFunction.body.blocks.values()) {
|
|
52243
|
+
for (const pred of block.preds) {
|
|
52244
|
+
if (!seenBlocks.has(pred)) {
|
|
52245
|
+
return;
|
|
52246
|
+
}
|
|
52247
|
+
}
|
|
52248
|
+
for (const instr of block.instructions) {
|
|
52249
|
+
if (isUseRefType(instr.lvalue.identifier)) {
|
|
52250
|
+
return;
|
|
52251
|
+
}
|
|
52252
|
+
for (const operand of eachInstructionOperand(instr)) {
|
|
52253
|
+
if (isSetStateType(operand.identifier) &&
|
|
52254
|
+
operand.loc !== GeneratedSource) {
|
|
52255
|
+
if (context.effectSetStateCache.has(operand.loc.identifierName)) {
|
|
52256
|
+
context.effectSetStateCache
|
|
52257
|
+
.get(operand.loc.identifierName)
|
|
52258
|
+
.push(operand);
|
|
52259
|
+
}
|
|
52260
|
+
else {
|
|
52261
|
+
context.effectSetStateCache.set(operand.loc.identifierName, [
|
|
52262
|
+
operand,
|
|
52263
|
+
]);
|
|
52264
|
+
}
|
|
52265
|
+
}
|
|
52266
|
+
}
|
|
52267
|
+
if (instr.value.kind === 'CallExpression' &&
|
|
52268
|
+
isSetStateType(instr.value.callee.identifier) &&
|
|
52269
|
+
instr.value.args.length === 1 &&
|
|
52270
|
+
instr.value.args[0].kind === 'Identifier') {
|
|
52271
|
+
const argMetadata = context.derivationCache.cache.get(instr.value.args[0].identifier.id);
|
|
52272
|
+
if (argMetadata !== undefined) {
|
|
52273
|
+
effectDerivedSetStateCalls.push({
|
|
52274
|
+
value: instr.value,
|
|
52275
|
+
loc: instr.value.callee.loc,
|
|
52276
|
+
sourceIds: argMetadata.sourcesIds,
|
|
52277
|
+
typeOfValue: argMetadata.typeOfValue,
|
|
52278
|
+
});
|
|
52279
|
+
}
|
|
52280
|
+
}
|
|
52281
|
+
else if (instr.value.kind === 'CallExpression') {
|
|
52282
|
+
const calleeMetadata = context.derivationCache.cache.get(instr.value.callee.identifier.id);
|
|
52283
|
+
if (calleeMetadata !== undefined &&
|
|
52284
|
+
(calleeMetadata.typeOfValue === 'fromProps' ||
|
|
52285
|
+
calleeMetadata.typeOfValue === 'fromPropsAndState')) {
|
|
52286
|
+
return;
|
|
52287
|
+
}
|
|
52288
|
+
if (globals.has(instr.value.callee.identifier.id)) {
|
|
52289
|
+
return;
|
|
52290
|
+
}
|
|
52291
|
+
}
|
|
52292
|
+
else if (instr.value.kind === 'LoadGlobal') {
|
|
52293
|
+
globals.add(instr.lvalue.identifier.id);
|
|
52294
|
+
for (const operand of eachInstructionOperand(instr)) {
|
|
52295
|
+
globals.add(operand.identifier.id);
|
|
52296
|
+
}
|
|
52297
|
+
}
|
|
52298
|
+
}
|
|
52299
|
+
seenBlocks.add(block.id);
|
|
52300
|
+
}
|
|
52301
|
+
for (const derivedSetStateCall of effectDerivedSetStateCalls) {
|
|
52302
|
+
if (derivedSetStateCall.loc !== GeneratedSource &&
|
|
52303
|
+
context.effectSetStateCache.has(derivedSetStateCall.loc.identifierName) &&
|
|
52304
|
+
context.setStateCache.has(derivedSetStateCall.loc.identifierName) &&
|
|
52305
|
+
context.effectSetStateCache.get(derivedSetStateCall.loc.identifierName)
|
|
52306
|
+
.length ===
|
|
52307
|
+
context.setStateCache.get(derivedSetStateCall.loc.identifierName)
|
|
52308
|
+
.length -
|
|
52309
|
+
1) {
|
|
52310
|
+
const derivedDepsStr = Array.from(derivedSetStateCall.sourceIds)
|
|
52311
|
+
.map(sourceId => {
|
|
52312
|
+
var _a;
|
|
52313
|
+
const sourceMetadata = context.derivationCache.cache.get(sourceId);
|
|
52314
|
+
return (_a = sourceMetadata === null || sourceMetadata === void 0 ? void 0 : sourceMetadata.place.identifier.name) === null || _a === void 0 ? void 0 : _a.value;
|
|
52315
|
+
})
|
|
52316
|
+
.filter(Boolean)
|
|
52317
|
+
.join(', ');
|
|
52318
|
+
let description;
|
|
52319
|
+
if (derivedSetStateCall.typeOfValue === 'fromProps') {
|
|
52320
|
+
description = `From props: [${derivedDepsStr}]`;
|
|
52321
|
+
}
|
|
52322
|
+
else if (derivedSetStateCall.typeOfValue === 'fromState') {
|
|
52323
|
+
description = `From local state: [${derivedDepsStr}]`;
|
|
52324
|
+
}
|
|
52325
|
+
else {
|
|
52326
|
+
description = `From props and local state: [${derivedDepsStr}]`;
|
|
52327
|
+
}
|
|
52328
|
+
context.errors.pushDiagnostic(CompilerDiagnostic.create({
|
|
52329
|
+
description: `Derived values (${description}) should be computed during render, rather than in effects. Using an effect triggers an additional render which can hurt performance and user experience, potentially briefly showing stale values to the user`,
|
|
52330
|
+
category: ErrorCategory.EffectDerivationsOfState,
|
|
52331
|
+
reason: 'You might not need an effect. Derive values in render, not effects.',
|
|
52332
|
+
}).withDetails({
|
|
52333
|
+
kind: 'error',
|
|
52334
|
+
loc: derivedSetStateCall.value.callee.loc,
|
|
52335
|
+
message: 'This should be computed during render, not in an effect',
|
|
52336
|
+
}));
|
|
52337
|
+
}
|
|
52338
|
+
}
|
|
52339
|
+
}
|
|
52340
|
+
|
|
51820
52341
|
function nameAnonymousFunctions(fn) {
|
|
51821
52342
|
if (fn.id == null) {
|
|
51822
52343
|
return;
|
|
@@ -52058,6 +52579,9 @@ function runWithEnvironment(func, env) {
|
|
|
52058
52579
|
if (env.config.validateNoDerivedComputationsInEffects) {
|
|
52059
52580
|
validateNoDerivedComputationsInEffects(hir);
|
|
52060
52581
|
}
|
|
52582
|
+
if (env.config.validateNoDerivedComputationsInEffects_exp) {
|
|
52583
|
+
validateNoDerivedComputationsInEffects_exp(hir);
|
|
52584
|
+
}
|
|
52061
52585
|
if (env.config.validateNoSetStateInEffects) {
|
|
52062
52586
|
env.logErrors(validateNoSetStateInEffects(hir, env));
|
|
52063
52587
|
}
|
|
@@ -53513,27 +54037,27 @@ function isNonNamespacedImport(importDeclPath) {
|
|
|
53513
54037
|
importDeclPath.node.importKind !== 'typeof');
|
|
53514
54038
|
}
|
|
53515
54039
|
|
|
53516
|
-
|
|
54040
|
+
v4.z.enum([
|
|
53517
54041
|
'all_errors',
|
|
53518
54042
|
'critical_errors',
|
|
53519
54043
|
'none',
|
|
53520
54044
|
]);
|
|
53521
|
-
const DynamicGatingOptionsSchema =
|
|
53522
|
-
source:
|
|
54045
|
+
const DynamicGatingOptionsSchema = v4.z.object({
|
|
54046
|
+
source: v4.z.string(),
|
|
53523
54047
|
});
|
|
53524
|
-
const CustomOptOutDirectiveSchema =
|
|
53525
|
-
.nullable(
|
|
54048
|
+
const CustomOptOutDirectiveSchema = v4.z
|
|
54049
|
+
.nullable(v4.z.array(v4.z.string()))
|
|
53526
54050
|
.default(null);
|
|
53527
|
-
const CompilerReactTargetSchema =
|
|
53528
|
-
|
|
53529
|
-
|
|
53530
|
-
|
|
53531
|
-
|
|
53532
|
-
kind:
|
|
53533
|
-
runtimeModule:
|
|
54051
|
+
const CompilerReactTargetSchema = v4.z.union([
|
|
54052
|
+
v4.z.literal('17'),
|
|
54053
|
+
v4.z.literal('18'),
|
|
54054
|
+
v4.z.literal('19'),
|
|
54055
|
+
v4.z.object({
|
|
54056
|
+
kind: v4.z.literal('donotuse_meta_internal'),
|
|
54057
|
+
runtimeModule: v4.z.string().default('react'),
|
|
53534
54058
|
}),
|
|
53535
54059
|
]);
|
|
53536
|
-
|
|
54060
|
+
v4.z.enum([
|
|
53537
54061
|
'infer',
|
|
53538
54062
|
'syntax',
|
|
53539
54063
|
'annotation',
|
|
@@ -53606,7 +54130,7 @@ function parsePluginOptions(obj) {
|
|
|
53606
54130
|
else {
|
|
53607
54131
|
CompilerError.throwInvalidConfig({
|
|
53608
54132
|
reason: 'Could not parse dynamic gating. Update React Compiler config to fix the error',
|
|
53609
|
-
description: `${
|
|
54133
|
+
description: `${v4$1.fromZodError(result.error)}`,
|
|
53610
54134
|
loc: null,
|
|
53611
54135
|
suggestions: null,
|
|
53612
54136
|
});
|
|
@@ -53622,7 +54146,7 @@ function parsePluginOptions(obj) {
|
|
|
53622
54146
|
else {
|
|
53623
54147
|
CompilerError.throwInvalidConfig({
|
|
53624
54148
|
reason: 'Could not parse custom opt out directives. Update React Compiler config to fix the error',
|
|
53625
|
-
description: `${
|
|
54149
|
+
description: `${v4$1.fromZodError(result.error)}`,
|
|
53626
54150
|
loc: null,
|
|
53627
54151
|
suggestions: null,
|
|
53628
54152
|
});
|
|
@@ -53645,7 +54169,7 @@ function parseTargetConfig(value) {
|
|
|
53645
54169
|
else {
|
|
53646
54170
|
CompilerError.throwInvalidConfig({
|
|
53647
54171
|
reason: 'Not a valid target',
|
|
53648
|
-
description: `${
|
|
54172
|
+
description: `${v4$1.fromZodError(parsed.error)}`,
|
|
53649
54173
|
suggestions: null,
|
|
53650
54174
|
loc: null,
|
|
53651
54175
|
});
|
|
@@ -57159,6 +57683,10 @@ function isUseEffectEventIdentifier(node) {
|
|
|
57159
57683
|
return node.type === 'Identifier' && node.name === 'useEffectEvent';
|
|
57160
57684
|
}
|
|
57161
57685
|
function useEffectEventError(fn, called) {
|
|
57686
|
+
if (fn === null) {
|
|
57687
|
+
return (`React Hook "useEffectEvent" can only be called at the top level of your component.` +
|
|
57688
|
+
` It cannot be passed down.`);
|
|
57689
|
+
}
|
|
57162
57690
|
return (`\`${fn}\` is a function created with React Hook "useEffectEvent", and can only be called from ` +
|
|
57163
57691
|
'Effects and Effect Events in the same component.' +
|
|
57164
57692
|
(called ? '' : ' It cannot be assigned to a variable or passed down.'));
|
|
@@ -57458,6 +57986,7 @@ const rule = {
|
|
|
57458
57986
|
analyzer.leaveNode(node);
|
|
57459
57987
|
},
|
|
57460
57988
|
CallExpression(node) {
|
|
57989
|
+
var _a, _b;
|
|
57461
57990
|
if (isHook(node.callee)) {
|
|
57462
57991
|
const reactHooksMap = last(codePathReactHooksMapStack);
|
|
57463
57992
|
const codePathSegment = last(codePathSegmentStack);
|
|
@@ -57474,6 +58003,15 @@ const rule = {
|
|
|
57474
58003
|
node.arguments.length > 0) {
|
|
57475
58004
|
lastEffect = node;
|
|
57476
58005
|
}
|
|
58006
|
+
if (isUseEffectEventIdentifier(nodeWithoutNamespace) &&
|
|
58007
|
+
((_a = node.parent) === null || _a === void 0 ? void 0 : _a.type) !== 'VariableDeclarator' &&
|
|
58008
|
+
((_b = node.parent) === null || _b === void 0 ? void 0 : _b.type) !== 'ExpressionStatement') {
|
|
58009
|
+
const message = useEffectEventError(null, false);
|
|
58010
|
+
context.report({
|
|
58011
|
+
node,
|
|
58012
|
+
message,
|
|
58013
|
+
});
|
|
58014
|
+
}
|
|
57477
58015
|
},
|
|
57478
58016
|
Identifier(node) {
|
|
57479
58017
|
if (lastEffect == null && useEffectEventFunctions.has(node)) {
|