babel-plugin-react-compiler 19.0.0-beta-decd7b8-20250118 → 19.0.0-beta-27714ef-20250124
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/dist/index.js +36 -15
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -121306,8 +121306,16 @@ addObject(BUILTIN_SHAPES, BuiltInMixedReadonlyId, [
|
|
121306
121306
|
[
|
121307
121307
|
"map",
|
121308
121308
|
addFunction(BUILTIN_SHAPES, [], {
|
121309
|
+
/**
|
121310
|
+
* Note `map`'s arguments are annotated as Effect.ConditionallyMutate as
|
121311
|
+
* calling `<array>.map(fn)` might invoke `fn`, which means replaying its
|
121312
|
+
* effects.
|
121313
|
+
*
|
121314
|
+
* (Note that Effect.Read / Effect.Capture on a function type means
|
121315
|
+
* potential data dependency or aliasing respectively.)
|
121316
|
+
*/
|
121309
121317
|
positionalParams: [],
|
121310
|
-
restParam: "
|
121318
|
+
restParam: "mutate?" /* ConditionallyMutate */,
|
121311
121319
|
returnType: { kind: "Object", shapeId: BuiltInArrayId },
|
121312
121320
|
calleeEffect: "mutate?" /* ConditionallyMutate */,
|
121313
121321
|
returnValueKind: "mutable" /* Mutable */,
|
@@ -121318,7 +121326,7 @@ addObject(BUILTIN_SHAPES, BuiltInMixedReadonlyId, [
|
|
121318
121326
|
"flatMap",
|
121319
121327
|
addFunction(BUILTIN_SHAPES, [], {
|
121320
121328
|
positionalParams: [],
|
121321
|
-
restParam: "
|
121329
|
+
restParam: "mutate?" /* ConditionallyMutate */,
|
121322
121330
|
returnType: { kind: "Object", shapeId: BuiltInArrayId },
|
121323
121331
|
calleeEffect: "mutate?" /* ConditionallyMutate */,
|
121324
121332
|
returnValueKind: "mutable" /* Mutable */,
|
@@ -121329,7 +121337,7 @@ addObject(BUILTIN_SHAPES, BuiltInMixedReadonlyId, [
|
|
121329
121337
|
"filter",
|
121330
121338
|
addFunction(BUILTIN_SHAPES, [], {
|
121331
121339
|
positionalParams: [],
|
121332
|
-
restParam: "
|
121340
|
+
restParam: "mutate?" /* ConditionallyMutate */,
|
121333
121341
|
returnType: { kind: "Object", shapeId: BuiltInArrayId },
|
121334
121342
|
calleeEffect: "mutate?" /* ConditionallyMutate */,
|
121335
121343
|
returnValueKind: "mutable" /* Mutable */,
|
@@ -133744,7 +133752,7 @@ function codegenInstructionValue(cx, instrValue) {
|
|
133744
133752
|
}
|
133745
133753
|
return value;
|
133746
133754
|
}
|
133747
|
-
var STRING_REQUIRES_EXPR_CONTAINER_PATTERN = /[\u{0000}-\u{001F}\u{007F}\u{0080}-\u{FFFF}]|"
|
133755
|
+
var STRING_REQUIRES_EXPR_CONTAINER_PATTERN = /[\u{0000}-\u{001F}\u{007F}\u{0080}-\u{FFFF}]|"|\\/u;
|
133748
133756
|
function codegenJsxAttribute(cx, attribute) {
|
133749
133757
|
switch (attribute.kind) {
|
133750
133758
|
case "JsxAttribute": {
|
@@ -133789,7 +133797,7 @@ function codegenJsxAttribute(cx, attribute) {
|
|
133789
133797
|
}
|
133790
133798
|
}
|
133791
133799
|
}
|
133792
|
-
var JSX_TEXT_CHILD_REQUIRES_EXPR_CONTAINER_PATTERN = /[<>&]/;
|
133800
|
+
var JSX_TEXT_CHILD_REQUIRES_EXPR_CONTAINER_PATTERN = /[<>&{}]/;
|
133793
133801
|
function codegenJsxElement(cx, place) {
|
133794
133802
|
const value = codegenPlace(cx, place);
|
133795
133803
|
switch (value.type) {
|
@@ -134985,11 +134993,15 @@ function inferOperandEffect(state, place) {
|
|
134985
134993
|
if (isRefOrRefValue(place.identifier)) {
|
134986
134994
|
break;
|
134987
134995
|
} else if (value.kind === "context" /* Context */) {
|
134996
|
+
CompilerError.invariant(value.context.size > 0, {
|
134997
|
+
reason: "[InferFunctionEffects] Expected Context-kind value's capture list to be non-empty.",
|
134998
|
+
loc: place.loc
|
134999
|
+
});
|
134988
135000
|
return {
|
134989
135001
|
kind: "ContextMutation",
|
134990
135002
|
loc: place.loc,
|
134991
135003
|
effect: place.effect,
|
134992
|
-
places: value.context
|
135004
|
+
places: value.context
|
134993
135005
|
};
|
134994
135006
|
} else if (value.kind !== "mutable" /* Mutable */ && // We ignore mutations of primitives since this is not a React-specific problem
|
134995
135007
|
value.kind !== "primitive" /* Primitive */) {
|
@@ -135744,10 +135756,11 @@ function inferBlock(env, state, block, functionEffects) {
|
|
135744
135756
|
break;
|
135745
135757
|
}
|
135746
135758
|
case "ArrayExpression": {
|
135747
|
-
const
|
135759
|
+
const contextRefOperands = getContextRefOperand(state, instrValue);
|
135760
|
+
const valueKind = contextRefOperands.length > 0 ? {
|
135748
135761
|
kind: "context" /* Context */,
|
135749
135762
|
reason: /* @__PURE__ */ new Set(["other" /* Other */]),
|
135750
|
-
context:
|
135763
|
+
context: new Set(contextRefOperands)
|
135751
135764
|
} : {
|
135752
135765
|
kind: "mutable" /* Mutable */,
|
135753
135766
|
reason: /* @__PURE__ */ new Set(["other" /* Other */]),
|
@@ -135788,10 +135801,11 @@ function inferBlock(env, state, block, functionEffects) {
|
|
135788
135801
|
break;
|
135789
135802
|
}
|
135790
135803
|
case "ObjectExpression": {
|
135791
|
-
const
|
135804
|
+
const contextRefOperands = getContextRefOperand(state, instrValue);
|
135805
|
+
const valueKind = contextRefOperands.length > 0 ? {
|
135792
135806
|
kind: "context" /* Context */,
|
135793
135807
|
reason: /* @__PURE__ */ new Set(["other" /* Other */]),
|
135794
|
-
context:
|
135808
|
+
context: new Set(contextRefOperands)
|
135795
135809
|
} : {
|
135796
135810
|
kind: "mutable" /* Mutable */,
|
135797
135811
|
reason: /* @__PURE__ */ new Set(["other" /* Other */]),
|
@@ -136381,11 +136395,17 @@ function inferBlock(env, state, block, functionEffects) {
|
|
136381
136395
|
}
|
136382
136396
|
case "LoadLocal": {
|
136383
136397
|
const lvalue = instr.lvalue;
|
136384
|
-
|
136398
|
+
CompilerError.invariant(
|
136399
|
+
!(state.isDefined(lvalue) && state.kind(lvalue).kind === "context" /* Context */),
|
136400
|
+
{
|
136401
|
+
reason: "[InferReferenceEffects] Unexpected LoadLocal with context kind",
|
136402
|
+
loc: lvalue.loc
|
136403
|
+
}
|
136404
|
+
);
|
136385
136405
|
state.referenceAndRecordEffects(
|
136386
136406
|
freezeActions,
|
136387
136407
|
instrValue.place,
|
136388
|
-
|
136408
|
+
"capture" /* Capture */,
|
136389
136409
|
"other" /* Other */
|
136390
136410
|
);
|
136391
136411
|
lvalue.effect = "mutate?" /* ConditionallyMutate */;
|
@@ -136639,13 +136659,14 @@ function inferBlock(env, state, block, functionEffects) {
|
|
136639
136659
|
({ values, reason }) => state.freezeValues(values, reason)
|
136640
136660
|
);
|
136641
136661
|
}
|
136642
|
-
function
|
136662
|
+
function getContextRefOperand(state, instrValue) {
|
136663
|
+
const result = [];
|
136643
136664
|
for (const place of eachInstructionValueOperand(instrValue)) {
|
136644
136665
|
if (state.isDefined(place) && state.kind(place).kind === "context" /* Context */) {
|
136645
|
-
|
136666
|
+
result.push(place);
|
136646
136667
|
}
|
136647
136668
|
}
|
136648
|
-
return
|
136669
|
+
return result;
|
136649
136670
|
}
|
136650
136671
|
function getFunctionCallSignature(env, type) {
|
136651
136672
|
if (type.kind !== "Function") {
|