@farm.js/react 0.1.0-beta.38 → 0.1.0-beta.39
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/README.md +4 -0
- package/dist/client.d.mts +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/compiler-runtime.cjs +199 -139
- package/dist/compiler-runtime.cjs.map +1 -1
- package/dist/compiler-runtime.d.mts +13 -1
- package/dist/compiler-runtime.d.ts +13 -1
- package/dist/compiler-runtime.mjs +196 -140
- package/dist/compiler-runtime.mjs.map +1 -1
- package/dist/server.d.mts +0 -1
- package/dist/server.d.ts +0 -1
- package/dist/vite.cjs +362 -192
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +362 -192
- package/dist/vite.mjs.map +1 -1
- package/package.json +2 -2
package/dist/vite.mjs
CHANGED
|
@@ -74,9 +74,12 @@ var COMPILER_RUNTIME_FEATURE_EXPORTS = {
|
|
|
74
74
|
"keyed-rows-hinted": "keyedRowsHintedRuntimeFeature",
|
|
75
75
|
"keyed-rows-append-only": "keyedRowsAppendOnlyRuntimeFeature",
|
|
76
76
|
"keyed-rows-position-hinted": "keyedRowsPositionHintedRuntimeFeature",
|
|
77
|
+
"keyed-rows-plain-position-hinted": "keyedRowsPlainPositionHintedRuntimeFeature",
|
|
77
78
|
"keyed-rows-batch-position-hinted": "keyedRowsBatchPositionHintedRuntimeFeature",
|
|
78
79
|
"keyed-rows-window-position-hinted": "keyedRowsWindowPositionHintedRuntimeFeature",
|
|
79
80
|
"keyed-rows-reorder-hinted": "keyedRowsReorderHintedRuntimeFeature",
|
|
81
|
+
"keyed-rows-plain-reorder-hinted": "keyedRowsPlainReorderHintedRuntimeFeature",
|
|
82
|
+
"keyed-rows-plain-map-reorder-hinted": "keyedRowsPlainMapReorderHintedRuntimeFeature",
|
|
80
83
|
"keyed-rows-map-reorder-hinted": "keyedRowsMapReorderHintedRuntimeFeature",
|
|
81
84
|
"keyed-rows-all-hinted": "keyedRowsAllHintedRuntimeFeature",
|
|
82
85
|
"keyed-rows-mapped-rolling-window-hinted": "keyedRowsMappedRollingWindowHintedRuntimeFeature",
|
|
@@ -183,6 +186,12 @@ function runtimeFeaturesForPlans(plans, keyedUpdateHints, keyedArrayFilterHints,
|
|
|
183
186
|
features.add("keyed-rows-filter-only");
|
|
184
187
|
} else if (keyedRowsFeature === "keyed-rows" && hintSuffix === "-prepend-hinted" && keyedTargetKinds.size === 0 && !keyedMapOrAppendHints) {
|
|
185
188
|
features.add("keyed-rows-prepend-only");
|
|
189
|
+
} else if (keyedRowsFeature === "keyed-rows" && hintSuffix === "-position-hinted" && keyedTargetKinds.size === 0) {
|
|
190
|
+
features.add("keyed-rows-plain-position-hinted");
|
|
191
|
+
} else if (keyedRowsFeature === "keyed-rows" && hintSuffix === "-reorder-hinted" && keyedTargetKinds.size === 0) {
|
|
192
|
+
features.add("keyed-rows-plain-reorder-hinted");
|
|
193
|
+
} else if (keyedRowsFeature === "keyed-rows" && hintSuffix === "-map-reorder-hinted" && keyedTargetKinds.size === 0) {
|
|
194
|
+
features.add("keyed-rows-plain-map-reorder-hinted");
|
|
186
195
|
} else if (keyedRowsFeature === "keyed-rows" && hintSuffix === "-filter-hinted" && keyedTargetKinds.size === 1 && keyedTargetKinds.has("identity")) {
|
|
187
196
|
features.add(
|
|
188
197
|
keyedMapOrAppendHints ? "keyed-rows-identity-filter-hinted" : "keyed-rows-identity-filter-only"
|
|
@@ -240,6 +249,14 @@ function collectStateDependencies(expression, statesByValue) {
|
|
|
240
249
|
return [...dependencies].sort((left, right) => left - right);
|
|
241
250
|
}
|
|
242
251
|
function referencesIdentifier(expression, name) {
|
|
252
|
+
let possible = false;
|
|
253
|
+
types.traverseFast(expression, (node) => {
|
|
254
|
+
if ((types.isIdentifier(node) || types.isJSXIdentifier(node)) && node.name === name) {
|
|
255
|
+
possible = true;
|
|
256
|
+
return types.traverseFast.stop;
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
if (!possible) return false;
|
|
243
260
|
let referenced = false;
|
|
244
261
|
traverse(expressionFile(cloneExpression(expression)), {
|
|
245
262
|
ReferencedIdentifier(path) {
|
|
@@ -319,12 +336,10 @@ function isPotentialKeyedMembershipCall(expression, reactiveByValue) {
|
|
|
319
336
|
}
|
|
320
337
|
function containsPotentialKeyedMembershipCall(expression, reactiveByValue) {
|
|
321
338
|
let found = false;
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
path.stop();
|
|
327
|
-
}
|
|
339
|
+
types.traverseFast(expression, (node) => {
|
|
340
|
+
if (!types.isCallExpression(node) || !isPotentialKeyedMembershipCall(node, reactiveByValue)) return;
|
|
341
|
+
found = true;
|
|
342
|
+
return types.traverseFast.stop;
|
|
328
343
|
});
|
|
329
344
|
return found;
|
|
330
345
|
}
|
|
@@ -337,12 +352,10 @@ function isPotentialKeyedMapLookupCall(expression, reactiveByValue) {
|
|
|
337
352
|
}
|
|
338
353
|
function containsPotentialKeyedMapLookupCall(expression, reactiveByValue) {
|
|
339
354
|
let found = false;
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
path.stop();
|
|
345
|
-
}
|
|
355
|
+
types.traverseFast(expression, (node) => {
|
|
356
|
+
if (!types.isCallExpression(node) || !isPotentialKeyedMapLookupCall(node, reactiveByValue)) return;
|
|
357
|
+
found = true;
|
|
358
|
+
return types.traverseFast.stop;
|
|
346
359
|
});
|
|
347
360
|
return found;
|
|
348
361
|
}
|
|
@@ -419,6 +432,15 @@ function keyedMapLookupTarget(binding, keyCallback, renderCallback, reactiveByVa
|
|
|
419
432
|
return valid && target && calls > 0 ? { dependency: target.index, value: types.identifier(target.valueName) } : void 0;
|
|
420
433
|
}
|
|
421
434
|
function collectReferencedLocals(expression, names) {
|
|
435
|
+
if (names.size === 0) return [];
|
|
436
|
+
let possible = false;
|
|
437
|
+
types.traverseFast(expression, (node) => {
|
|
438
|
+
if ((types.isIdentifier(node) || types.isJSXIdentifier(node)) && names.has(node.name)) {
|
|
439
|
+
possible = true;
|
|
440
|
+
return types.traverseFast.stop;
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
if (!possible) return [];
|
|
422
444
|
const references = /* @__PURE__ */ new Set();
|
|
423
445
|
traverse(expressionFile(cloneExpression(expression)), {
|
|
424
446
|
ReferencedIdentifier(path) {
|
|
@@ -430,6 +452,7 @@ function collectReferencedLocals(expression, names) {
|
|
|
430
452
|
return [...references];
|
|
431
453
|
}
|
|
432
454
|
function rewriteDerivedAccess(expression, derivedByName) {
|
|
455
|
+
if (derivedByName.size === 0) return cloneExpression(expression);
|
|
433
456
|
const file = expressionFile(cloneExpression(expression));
|
|
434
457
|
traverse(file, {
|
|
435
458
|
ReferencedIdentifier(path) {
|
|
@@ -688,7 +711,7 @@ function keyedMapUpdatePipeline(expression, parameterName, safeGlobals) {
|
|
|
688
711
|
return outerCallbacks.reverse();
|
|
689
712
|
}
|
|
690
713
|
function rewriteKeyedMapUpdateHints(root, hintedStateIndices, statesBySetter, helperIdentifier, safeGlobals) {
|
|
691
|
-
if (hintedStateIndices.size === 0) return { root
|
|
714
|
+
if (hintedStateIndices.size === 0) return { root, count: 0 };
|
|
692
715
|
const file = expressionFile(types.cloneNode(root, true));
|
|
693
716
|
let count = 0;
|
|
694
717
|
traverse(file, {
|
|
@@ -742,7 +765,7 @@ function rewriteKeyedMapUpdateHints(root, hintedStateIndices, statesBySetter, he
|
|
|
742
765
|
}
|
|
743
766
|
path.node.arguments[0] = types.arrowFunctionExpression(
|
|
744
767
|
[types.cloneNode(previous)],
|
|
745
|
-
types.callExpression(types.cloneNode(helperIdentifier), [
|
|
768
|
+
types.callExpression(types.cloneNode(helperIdentifier()), [
|
|
746
769
|
types.cloneNode(previous),
|
|
747
770
|
types.arrowFunctionExpression(
|
|
748
771
|
[types.cloneNode(pipelineValue), types.cloneNode(applyMap)],
|
|
@@ -760,7 +783,7 @@ function rewriteKeyedMapUpdateHints(root, hintedStateIndices, statesBySetter, he
|
|
|
760
783
|
};
|
|
761
784
|
}
|
|
762
785
|
function rewriteKeyedArrayAppendHints(root, hintedStateIndices, statesBySetter, helperIdentifier, safeGlobals) {
|
|
763
|
-
if (hintedStateIndices.size === 0) return { root
|
|
786
|
+
if (hintedStateIndices.size === 0) return { root, count: 0 };
|
|
764
787
|
const file = expressionFile(types.cloneNode(root, true));
|
|
765
788
|
let count = 0;
|
|
766
789
|
traverse(file, {
|
|
@@ -814,7 +837,7 @@ function rewriteKeyedArrayAppendHints(root, hintedStateIndices, statesBySetter,
|
|
|
814
837
|
types.variableDeclarator(types.cloneNode(nextValue), types.cloneNode(updateExpression, true))
|
|
815
838
|
]),
|
|
816
839
|
types.returnStatement(
|
|
817
|
-
types.callExpression(types.cloneNode(helperIdentifier), [
|
|
840
|
+
types.callExpression(types.cloneNode(helperIdentifier()), [
|
|
818
841
|
types.cloneNode(previous),
|
|
819
842
|
types.cloneNode(nextValue)
|
|
820
843
|
])
|
|
@@ -832,7 +855,7 @@ function rewriteKeyedArrayAppendHints(root, hintedStateIndices, statesBySetter,
|
|
|
832
855
|
}
|
|
833
856
|
function rewriteKeyedArrayPrependHints(root, hintedStateIndices, statesBySetter, helperIdentifier, safeGlobals) {
|
|
834
857
|
if (hintedStateIndices.size === 0) {
|
|
835
|
-
return { root
|
|
858
|
+
return { root, count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
836
859
|
}
|
|
837
860
|
const file = expressionFile(types.cloneNode(root, true));
|
|
838
861
|
const stateIndices = /* @__PURE__ */ new Set();
|
|
@@ -890,7 +913,7 @@ function rewriteKeyedArrayPrependHints(root, hintedStateIndices, statesBySetter,
|
|
|
890
913
|
types.variableDeclarator(types.cloneNode(nextValue), types.cloneNode(updateExpression, true))
|
|
891
914
|
]),
|
|
892
915
|
types.returnStatement(
|
|
893
|
-
types.callExpression(types.cloneNode(helperIdentifier), [
|
|
916
|
+
types.callExpression(types.cloneNode(helperIdentifier()), [
|
|
894
917
|
types.cloneNode(previous),
|
|
895
918
|
types.cloneNode(nextValue)
|
|
896
919
|
])
|
|
@@ -910,7 +933,7 @@ function rewriteKeyedArrayPrependHints(root, hintedStateIndices, statesBySetter,
|
|
|
910
933
|
}
|
|
911
934
|
function rewriteKeyedArrayRollingWindowHints(root, hintedStateIndices, statesBySetter, sliceHelperIdentifier, rollingWindowHelperIdentifier, safeGlobals) {
|
|
912
935
|
if (hintedStateIndices.size === 0) {
|
|
913
|
-
return { root
|
|
936
|
+
return { root, count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
914
937
|
}
|
|
915
938
|
const file = expressionFile(types.cloneNode(root, true));
|
|
916
939
|
const stateIndices = /* @__PURE__ */ new Set();
|
|
@@ -981,7 +1004,7 @@ function rewriteKeyedArrayRollingWindowHints(root, hintedStateIndices, statesByS
|
|
|
981
1004
|
),
|
|
982
1005
|
types.variableDeclarator(
|
|
983
1006
|
types.cloneNode(retained),
|
|
984
|
-
types.callExpression(types.cloneNode(sliceHelperIdentifier), [
|
|
1007
|
+
types.callExpression(types.cloneNode(sliceHelperIdentifier()), [
|
|
985
1008
|
types.cloneNode(previous),
|
|
986
1009
|
types.cloneNode(sliceMethod),
|
|
987
1010
|
types.cloneNode(retainedStart, true)
|
|
@@ -990,7 +1013,7 @@ function rewriteKeyedArrayRollingWindowHints(root, hintedStateIndices, statesByS
|
|
|
990
1013
|
types.variableDeclarator(types.cloneNode(nextValue), types.arrayExpression(nextElements))
|
|
991
1014
|
]),
|
|
992
1015
|
types.returnStatement(
|
|
993
|
-
types.callExpression(types.cloneNode(rollingWindowHelperIdentifier), [
|
|
1016
|
+
types.callExpression(types.cloneNode(rollingWindowHelperIdentifier()), [
|
|
994
1017
|
types.cloneNode(previous),
|
|
995
1018
|
types.cloneNode(retained),
|
|
996
1019
|
types.cloneNode(nextValue)
|
|
@@ -1029,7 +1052,7 @@ function validateKeyedArrayPositionExpression(expression, safeGlobals) {
|
|
|
1029
1052
|
function rewriteKeyedArrayPositionHints(root, hintedStateIndices, statesBySetter, helperIdentifier, batchInsertHelperIdentifier, windowReplaceHelperIdentifier, safeGlobals) {
|
|
1030
1053
|
if (hintedStateIndices.size === 0) {
|
|
1031
1054
|
return {
|
|
1032
|
-
root
|
|
1055
|
+
root,
|
|
1033
1056
|
count: 0,
|
|
1034
1057
|
batchInsertCount: 0,
|
|
1035
1058
|
windowReplaceCount: 0,
|
|
@@ -1089,18 +1112,18 @@ function rewriteKeyedArrayPositionHints(root, hintedStateIndices, statesBySetter
|
|
|
1089
1112
|
)
|
|
1090
1113
|
]),
|
|
1091
1114
|
types.returnStatement(
|
|
1092
|
-
kind === "batch-insert" ? types.callExpression(types.cloneNode(batchInsertHelperIdentifier), [
|
|
1115
|
+
kind === "batch-insert" ? types.callExpression(types.cloneNode(batchInsertHelperIdentifier()), [
|
|
1093
1116
|
types.cloneNode(previous),
|
|
1094
1117
|
types.cloneNode(method),
|
|
1095
1118
|
types.cloneNode(position, true),
|
|
1096
1119
|
...args.slice(2).map((argument) => types.cloneNode(argument, true))
|
|
1097
|
-
]) : kind === "window-replace" ? types.callExpression(types.cloneNode(windowReplaceHelperIdentifier), [
|
|
1120
|
+
]) : kind === "window-replace" ? types.callExpression(types.cloneNode(windowReplaceHelperIdentifier()), [
|
|
1098
1121
|
types.cloneNode(previous),
|
|
1099
1122
|
types.cloneNode(method),
|
|
1100
1123
|
types.cloneNode(position, true),
|
|
1101
1124
|
types.cloneNode(args[1], true),
|
|
1102
1125
|
...args.slice(2).map((argument) => types.cloneNode(argument, true))
|
|
1103
|
-
]) : types.callExpression(types.cloneNode(helperIdentifier), [
|
|
1126
|
+
]) : types.callExpression(types.cloneNode(helperIdentifier()), [
|
|
1104
1127
|
types.cloneNode(previous),
|
|
1105
1128
|
types.cloneNode(method),
|
|
1106
1129
|
types.stringLiteral(kind),
|
|
@@ -1126,7 +1149,7 @@ function rewriteKeyedArrayPositionHints(root, hintedStateIndices, statesBySetter
|
|
|
1126
1149
|
}
|
|
1127
1150
|
function rewriteKeyedArrayReorderHints(root, hintedStateIndices, statesBySetter, helperIdentifier) {
|
|
1128
1151
|
if (hintedStateIndices.size === 0) {
|
|
1129
|
-
return { root
|
|
1152
|
+
return { root, count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
1130
1153
|
}
|
|
1131
1154
|
const file = expressionFile(types.cloneNode(root, true));
|
|
1132
1155
|
const stateIndices = /* @__PURE__ */ new Set();
|
|
@@ -1160,7 +1183,7 @@ function rewriteKeyedArrayReorderHints(root, hintedStateIndices, statesBySetter,
|
|
|
1160
1183
|
)
|
|
1161
1184
|
]),
|
|
1162
1185
|
types.returnStatement(
|
|
1163
|
-
types.callExpression(types.cloneNode(helperIdentifier), [
|
|
1186
|
+
types.callExpression(types.cloneNode(helperIdentifier()), [
|
|
1164
1187
|
types.cloneNode(previous),
|
|
1165
1188
|
types.cloneNode(method)
|
|
1166
1189
|
])
|
|
@@ -1267,7 +1290,7 @@ function keyedArrayReorderPipeline(expression, parameterName, safeGlobals) {
|
|
|
1267
1290
|
function rewriteKeyedArrayReorderPipelineHints(root, hintedStateIndices, statesBySetter, filterHelperIdentifier, mapHelperIdentifier, mapReorderHelperIdentifier, mappedStructuralHelperIdentifier, reorderHelperIdentifier, structuralReorderHelperIdentifier, sliceHelperIdentifier, sortHelperIdentifier, structuralSortHelperIdentifier, safeGlobals, allowMapPipelines) {
|
|
1268
1291
|
if (hintedStateIndices.size === 0) {
|
|
1269
1292
|
return {
|
|
1270
|
-
root
|
|
1293
|
+
root,
|
|
1271
1294
|
filterCount: 0,
|
|
1272
1295
|
mapCount: 0,
|
|
1273
1296
|
mapReorderCount: 0,
|
|
@@ -1366,7 +1389,7 @@ function rewriteKeyedArrayReorderPipelineHints(root, hintedStateIndices, statesB
|
|
|
1366
1389
|
types.variableDeclaration("const", [
|
|
1367
1390
|
types.variableDeclarator(
|
|
1368
1391
|
types.cloneNode(result2),
|
|
1369
|
-
types.callExpression(types.cloneNode(mapHelperIdentifier), [
|
|
1392
|
+
types.callExpression(types.cloneNode(mapHelperIdentifier()), [
|
|
1370
1393
|
types.cloneNode(value),
|
|
1371
1394
|
types.arrowFunctionExpression(
|
|
1372
1395
|
[types.cloneNode(pipelineValue), types.cloneNode(applyMap)],
|
|
@@ -1403,7 +1426,7 @@ function rewriteKeyedArrayReorderPipelineHints(root, hintedStateIndices, statesB
|
|
|
1403
1426
|
types.variableDeclaration("const", [
|
|
1404
1427
|
types.variableDeclarator(
|
|
1405
1428
|
types.cloneNode(result),
|
|
1406
|
-
types.callExpression(types.cloneNode(helper), [
|
|
1429
|
+
types.callExpression(types.cloneNode(helper()), [
|
|
1407
1430
|
types.cloneNode(value),
|
|
1408
1431
|
types.cloneNode(method),
|
|
1409
1432
|
...args
|
|
@@ -1429,7 +1452,9 @@ function rewriteKeyedArrayReorderPipelineHints(root, hintedStateIndices, statesB
|
|
|
1429
1452
|
}
|
|
1430
1453
|
statements.push(
|
|
1431
1454
|
types.returnStatement(
|
|
1432
|
-
terminalStructuralPipeline ? types.callExpression(types.cloneNode(mappedStructuralHelperIdentifier), [
|
|
1455
|
+
terminalStructuralPipeline ? types.callExpression(types.cloneNode(mappedStructuralHelperIdentifier()), [
|
|
1456
|
+
types.cloneNode(value)
|
|
1457
|
+
]) : types.cloneNode(value)
|
|
1433
1458
|
)
|
|
1434
1459
|
);
|
|
1435
1460
|
if (terminalStructuralPipeline) terminalStructuralPipelineCount += 1;
|
|
@@ -1457,7 +1482,7 @@ function rewriteKeyedArrayReorderPipelineHints(root, hintedStateIndices, statesB
|
|
|
1457
1482
|
};
|
|
1458
1483
|
}
|
|
1459
1484
|
function rewriteQueuedKeyedArrayReorderMapHints(root, statesBySetter, mapUpdateIdentifier, queuedMapPipelineIdentifier, mapReorderIdentifier, reorderIdentifier, sortIdentifier, structuralReorderIdentifier, structuralSortIdentifier, allowed) {
|
|
1460
|
-
if (!allowed) return { root
|
|
1485
|
+
if (!allowed) return { root, mapCount: 0 };
|
|
1461
1486
|
const file = expressionFile(types.cloneNode(root, true));
|
|
1462
1487
|
let mapCount = 0;
|
|
1463
1488
|
const containsHelperCall = (updater, helperNames) => {
|
|
@@ -1470,13 +1495,13 @@ function rewriteQueuedKeyedArrayReorderMapHints(root, statesBySetter, mapUpdateI
|
|
|
1470
1495
|
return found;
|
|
1471
1496
|
};
|
|
1472
1497
|
const reorderHelperNames = /* @__PURE__ */ new Set([
|
|
1473
|
-
mapReorderIdentifier.name,
|
|
1474
|
-
reorderIdentifier.name,
|
|
1475
|
-
sortIdentifier.name
|
|
1498
|
+
mapReorderIdentifier().name,
|
|
1499
|
+
reorderIdentifier().name,
|
|
1500
|
+
sortIdentifier().name
|
|
1476
1501
|
]);
|
|
1477
1502
|
const structuralHelperNames = /* @__PURE__ */ new Set([
|
|
1478
|
-
structuralReorderIdentifier.name,
|
|
1479
|
-
structuralSortIdentifier.name
|
|
1503
|
+
structuralReorderIdentifier().name,
|
|
1504
|
+
structuralSortIdentifier().name
|
|
1480
1505
|
]);
|
|
1481
1506
|
traverse(file, {
|
|
1482
1507
|
BlockStatement(path) {
|
|
@@ -1503,7 +1528,7 @@ function rewriteQueuedKeyedArrayReorderMapHints(root, statesBySetter, mapUpdateI
|
|
|
1503
1528
|
queuedReorderState = state.index;
|
|
1504
1529
|
continue;
|
|
1505
1530
|
}
|
|
1506
|
-
if (queuedReorderState !== state.index || !types.isCallExpression(updater.body) || !types.isIdentifier(updater.body.callee, { name: mapUpdateIdentifier.name }) || updater.body.arguments.length !== 2) {
|
|
1531
|
+
if (queuedReorderState !== state.index || !types.isCallExpression(updater.body) || !types.isIdentifier(updater.body.callee, { name: mapUpdateIdentifier().name }) || updater.body.arguments.length !== 2) {
|
|
1507
1532
|
queuedReorderState = void 0;
|
|
1508
1533
|
continue;
|
|
1509
1534
|
}
|
|
@@ -1523,7 +1548,7 @@ function rewriteQueuedKeyedArrayReorderMapHints(root, statesBySetter, mapUpdateI
|
|
|
1523
1548
|
queuedReorderState = void 0;
|
|
1524
1549
|
continue;
|
|
1525
1550
|
}
|
|
1526
|
-
updater.body.callee = types.cloneNode(queuedMapPipelineIdentifier);
|
|
1551
|
+
updater.body.callee = types.cloneNode(queuedMapPipelineIdentifier());
|
|
1527
1552
|
mapCount += pipelineMapCount;
|
|
1528
1553
|
}
|
|
1529
1554
|
}
|
|
@@ -1534,7 +1559,7 @@ function rewriteQueuedKeyedArrayReorderMapHints(root, statesBySetter, mapUpdateI
|
|
|
1534
1559
|
};
|
|
1535
1560
|
}
|
|
1536
1561
|
function countKeyedArrayMapPipeline(updater, mapUpdateIdentifier) {
|
|
1537
|
-
if (!types.isCallExpression(updater.body) || !types.isIdentifier(updater.body.callee, { name: mapUpdateIdentifier.name }) || updater.body.arguments.length !== 2) {
|
|
1562
|
+
if (!types.isCallExpression(updater.body) || !types.isIdentifier(updater.body.callee, { name: mapUpdateIdentifier().name }) || updater.body.arguments.length !== 2) {
|
|
1538
1563
|
return 0;
|
|
1539
1564
|
}
|
|
1540
1565
|
const pipeline = updater.body.arguments[1];
|
|
@@ -1553,7 +1578,7 @@ function countKeyedArrayMapPipeline(updater, mapUpdateIdentifier) {
|
|
|
1553
1578
|
function rewriteQueuedKeyedArrayMappedStructuralHints(root, statesBySetter, mapUpdateIdentifier, queuedMapPipelineIdentifier, mappedStructuralIdentifier, filterIdentifier, sliceIdentifier, allowed) {
|
|
1554
1579
|
if (!allowed) {
|
|
1555
1580
|
return {
|
|
1556
|
-
root
|
|
1581
|
+
root,
|
|
1557
1582
|
mapCount: 0,
|
|
1558
1583
|
structuralCount: 0,
|
|
1559
1584
|
stateIndices: /* @__PURE__ */ new Set()
|
|
@@ -1566,7 +1591,7 @@ function rewriteQueuedKeyedArrayMappedStructuralHints(root, statesBySetter, mapU
|
|
|
1566
1591
|
const terminalStructuralReturn = (updater) => {
|
|
1567
1592
|
if (!types.isBlockStatement(updater.body)) return void 0;
|
|
1568
1593
|
const statement = updater.body.body.at(-1);
|
|
1569
|
-
if (!types.isReturnStatement(statement) || !statement.argument || !types.isCallExpression(statement.argument) || !types.isIdentifier(statement.argument.callee) || statement.argument.callee.name !== filterIdentifier.name && statement.argument.callee.name !== sliceIdentifier.name) {
|
|
1594
|
+
if (!types.isReturnStatement(statement) || !statement.argument || !types.isCallExpression(statement.argument) || !types.isIdentifier(statement.argument.callee) || statement.argument.callee.name !== filterIdentifier().name && statement.argument.callee.name !== sliceIdentifier().name) {
|
|
1570
1595
|
return void 0;
|
|
1571
1596
|
}
|
|
1572
1597
|
return statement;
|
|
@@ -1620,7 +1645,7 @@ function rewriteQueuedKeyedArrayMappedStructuralHints(root, statesBySetter, mapU
|
|
|
1620
1645
|
}
|
|
1621
1646
|
if (hasPendingMaps) {
|
|
1622
1647
|
for (const candidate of pendingMaps) {
|
|
1623
|
-
candidate.updater.body.callee = types.cloneNode(queuedMapPipelineIdentifier);
|
|
1648
|
+
candidate.updater.body.callee = types.cloneNode(queuedMapPipelineIdentifier());
|
|
1624
1649
|
mapCount += candidate.count;
|
|
1625
1650
|
}
|
|
1626
1651
|
}
|
|
@@ -1630,7 +1655,7 @@ function rewriteQueuedKeyedArrayMappedStructuralHints(root, statesBySetter, mapU
|
|
|
1630
1655
|
pendingMaps = [];
|
|
1631
1656
|
continue;
|
|
1632
1657
|
}
|
|
1633
|
-
structuralReturn.argument = types.callExpression(types.cloneNode(mappedStructuralIdentifier), [
|
|
1658
|
+
structuralReturn.argument = types.callExpression(types.cloneNode(mappedStructuralIdentifier()), [
|
|
1634
1659
|
types.cloneNode(structuralValue)
|
|
1635
1660
|
]);
|
|
1636
1661
|
structuralCount += 1;
|
|
@@ -1650,7 +1675,7 @@ function rewriteQueuedKeyedArrayMappedStructuralHints(root, statesBySetter, mapU
|
|
|
1650
1675
|
function rewriteQueuedKeyedArrayStructuralMapHints(root, statesBySetter, mapUpdateIdentifier, mapPipelineIdentifier, appendIdentifier, mappedStructuralAppendIdentifier, structuralAppendMapPipelineIdentifier, filterIdentifier, sliceIdentifier, mappedStructuralIdentifier, allowed) {
|
|
1651
1676
|
if (!allowed) {
|
|
1652
1677
|
return {
|
|
1653
|
-
root
|
|
1678
|
+
root,
|
|
1654
1679
|
mapCount: 0,
|
|
1655
1680
|
mappedStructuralAppendCount: 0,
|
|
1656
1681
|
structuralAppendMapCount: 0,
|
|
@@ -1670,10 +1695,10 @@ function rewriteQueuedKeyedArrayStructuralMapHints(root, statesBySetter, mapUpda
|
|
|
1670
1695
|
let mapped = false;
|
|
1671
1696
|
types.traverseFast(statement.argument, (node) => {
|
|
1672
1697
|
if (!found && types.isCallExpression(node) && types.isIdentifier(node.callee)) {
|
|
1673
|
-
if (node.callee.name === filterIdentifier.name) found = "filter";
|
|
1674
|
-
if (node.callee.name === sliceIdentifier.name) found = "slice";
|
|
1698
|
+
if (node.callee.name === filterIdentifier().name) found = "filter";
|
|
1699
|
+
if (node.callee.name === sliceIdentifier().name) found = "slice";
|
|
1675
1700
|
}
|
|
1676
|
-
if (!mapped && types.isCallExpression(node) && types.isIdentifier(node.callee, { name: mappedStructuralIdentifier.name })) {
|
|
1701
|
+
if (!mapped && types.isCallExpression(node) && types.isIdentifier(node.callee, { name: mappedStructuralIdentifier().name })) {
|
|
1677
1702
|
mapped = true;
|
|
1678
1703
|
}
|
|
1679
1704
|
});
|
|
@@ -1722,7 +1747,7 @@ function rewriteQueuedKeyedArrayStructuralMapHints(root, statesBySetter, mapUpda
|
|
|
1722
1747
|
}
|
|
1723
1748
|
const appendCalls = [];
|
|
1724
1749
|
types.traverseFast(updater.body, (node) => {
|
|
1725
|
-
if (types.isCallExpression(node) && types.isIdentifier(node.callee, { name: appendIdentifier.name })) {
|
|
1750
|
+
if (types.isCallExpression(node) && types.isIdentifier(node.callee, { name: appendIdentifier().name })) {
|
|
1726
1751
|
appendCalls.push(node);
|
|
1727
1752
|
}
|
|
1728
1753
|
});
|
|
@@ -1731,7 +1756,7 @@ function rewriteQueuedKeyedArrayStructuralMapHints(root, statesBySetter, mapUpda
|
|
|
1731
1756
|
structuralAppendState = state.index;
|
|
1732
1757
|
if (structuralMapState === state.index) {
|
|
1733
1758
|
for (const call of appendCalls) {
|
|
1734
|
-
call.callee = types.cloneNode(mappedStructuralAppendIdentifier);
|
|
1759
|
+
call.callee = types.cloneNode(mappedStructuralAppendIdentifier());
|
|
1735
1760
|
}
|
|
1736
1761
|
mappedStructuralAppendCount += appendCalls.length;
|
|
1737
1762
|
}
|
|
@@ -1752,7 +1777,7 @@ function rewriteQueuedKeyedArrayStructuralMapHints(root, statesBySetter, mapUpda
|
|
|
1752
1777
|
continue;
|
|
1753
1778
|
}
|
|
1754
1779
|
updater.body.callee = types.cloneNode(
|
|
1755
|
-
structuralAppendState === state.index ? structuralAppendMapPipelineIdentifier : mapPipelineIdentifier
|
|
1780
|
+
structuralAppendState === state.index ? structuralAppendMapPipelineIdentifier() : mapPipelineIdentifier()
|
|
1756
1781
|
);
|
|
1757
1782
|
mapCount += pipelineMapCount;
|
|
1758
1783
|
if (structuralAppendState === state.index) {
|
|
@@ -1774,7 +1799,7 @@ function rewriteQueuedKeyedArrayStructuralMapHints(root, statesBySetter, mapUpda
|
|
|
1774
1799
|
function rewriteQueuedKeyedArrayStructuralPrependMapHints(root, statesBySetter, mapUpdateIdentifier, mapPipelineIdentifier, prependIdentifier, mappedStructuralPrependIdentifier, structuralPrependMapPipelineIdentifier, filterIdentifier, sliceIdentifier, mappedStructuralIdentifier, allowed) {
|
|
1775
1800
|
if (!allowed) {
|
|
1776
1801
|
return {
|
|
1777
|
-
root
|
|
1802
|
+
root,
|
|
1778
1803
|
mapCount: 0,
|
|
1779
1804
|
mappedStructuralPrependCount: 0,
|
|
1780
1805
|
structuralPrependMapCount: 0,
|
|
@@ -1794,10 +1819,10 @@ function rewriteQueuedKeyedArrayStructuralPrependMapHints(root, statesBySetter,
|
|
|
1794
1819
|
let mapped = false;
|
|
1795
1820
|
types.traverseFast(statement.argument, (node) => {
|
|
1796
1821
|
if (!found && types.isCallExpression(node) && types.isIdentifier(node.callee)) {
|
|
1797
|
-
if (node.callee.name === filterIdentifier.name) found = "filter";
|
|
1798
|
-
if (node.callee.name === sliceIdentifier.name) found = "slice";
|
|
1822
|
+
if (node.callee.name === filterIdentifier().name) found = "filter";
|
|
1823
|
+
if (node.callee.name === sliceIdentifier().name) found = "slice";
|
|
1799
1824
|
}
|
|
1800
|
-
if (!mapped && types.isCallExpression(node) && types.isIdentifier(node.callee, { name: mappedStructuralIdentifier.name })) {
|
|
1825
|
+
if (!mapped && types.isCallExpression(node) && types.isIdentifier(node.callee, { name: mappedStructuralIdentifier().name })) {
|
|
1801
1826
|
mapped = true;
|
|
1802
1827
|
}
|
|
1803
1828
|
});
|
|
@@ -1846,7 +1871,7 @@ function rewriteQueuedKeyedArrayStructuralPrependMapHints(root, statesBySetter,
|
|
|
1846
1871
|
}
|
|
1847
1872
|
const prependCalls = [];
|
|
1848
1873
|
types.traverseFast(updater.body, (node) => {
|
|
1849
|
-
if (types.isCallExpression(node) && types.isIdentifier(node.callee, { name: prependIdentifier.name })) {
|
|
1874
|
+
if (types.isCallExpression(node) && types.isIdentifier(node.callee, { name: prependIdentifier().name })) {
|
|
1850
1875
|
prependCalls.push(node);
|
|
1851
1876
|
}
|
|
1852
1877
|
});
|
|
@@ -1855,7 +1880,7 @@ function rewriteQueuedKeyedArrayStructuralPrependMapHints(root, statesBySetter,
|
|
|
1855
1880
|
structuralPrependState = state.index;
|
|
1856
1881
|
if (structuralMapState === state.index) {
|
|
1857
1882
|
for (const call of prependCalls) {
|
|
1858
|
-
call.callee = types.cloneNode(mappedStructuralPrependIdentifier);
|
|
1883
|
+
call.callee = types.cloneNode(mappedStructuralPrependIdentifier());
|
|
1859
1884
|
}
|
|
1860
1885
|
mappedStructuralPrependCount += prependCalls.length;
|
|
1861
1886
|
}
|
|
@@ -1876,7 +1901,7 @@ function rewriteQueuedKeyedArrayStructuralPrependMapHints(root, statesBySetter,
|
|
|
1876
1901
|
continue;
|
|
1877
1902
|
}
|
|
1878
1903
|
updater.body.callee = types.cloneNode(
|
|
1879
|
-
structuralPrependState === state.index ? structuralPrependMapPipelineIdentifier : mapPipelineIdentifier
|
|
1904
|
+
structuralPrependState === state.index ? structuralPrependMapPipelineIdentifier() : mapPipelineIdentifier()
|
|
1880
1905
|
);
|
|
1881
1906
|
mapCount += pipelineMapCount;
|
|
1882
1907
|
if (structuralPrependState === state.index) {
|
|
@@ -1900,7 +1925,7 @@ function rewriteQueuedKeyedArrayRollingWindowMapHints(root, statesBySetter, mapU
|
|
|
1900
1925
|
return {
|
|
1901
1926
|
chainedMapCount: 0,
|
|
1902
1927
|
chainedRollingWindowCount: 0,
|
|
1903
|
-
root
|
|
1928
|
+
root,
|
|
1904
1929
|
leadingMapCount: 0,
|
|
1905
1930
|
mappedRollingWindowCount: 0,
|
|
1906
1931
|
rollingWindowCount: 0,
|
|
@@ -1927,7 +1952,7 @@ function rewriteQueuedKeyedArrayRollingWindowMapHints(root, statesBySetter, mapU
|
|
|
1927
1952
|
const rollingStep = (updater) => {
|
|
1928
1953
|
if (!types.isBlockStatement(updater.body)) return void 0;
|
|
1929
1954
|
const statement = updater.body.body.at(-1);
|
|
1930
|
-
if (!types.isReturnStatement(statement) || !statement.argument || !types.isCallExpression(statement.argument) || !types.isIdentifier(statement.argument.callee, { name: rollingWindowIdentifier.name }) || statement.argument.arguments.length !== 3 || !types.isExpression(statement.argument.arguments[1]) || !types.isExpression(statement.argument.arguments[2])) {
|
|
1955
|
+
if (!types.isReturnStatement(statement) || !statement.argument || !types.isCallExpression(statement.argument) || !types.isIdentifier(statement.argument.callee, { name: rollingWindowIdentifier().name }) || statement.argument.arguments.length !== 3 || !types.isExpression(statement.argument.arguments[1]) || !types.isExpression(statement.argument.arguments[2])) {
|
|
1931
1956
|
return void 0;
|
|
1932
1957
|
}
|
|
1933
1958
|
return { call: statement.argument };
|
|
@@ -1954,13 +1979,13 @@ function rewriteQueuedKeyedArrayRollingWindowMapHints(root, statesBySetter, mapU
|
|
|
1954
1979
|
}
|
|
1955
1980
|
for (const step of maps) {
|
|
1956
1981
|
if (step.kind !== "map") continue;
|
|
1957
|
-
step.value.updater.body.callee = types.cloneNode(rollingWindowMapPipelineIdentifier);
|
|
1982
|
+
step.value.updater.body.callee = types.cloneNode(rollingWindowMapPipelineIdentifier());
|
|
1958
1983
|
chainedMapCount += step.value.count;
|
|
1959
1984
|
}
|
|
1960
1985
|
for (const index of rollingIndices) {
|
|
1961
1986
|
const step = segment[index];
|
|
1962
1987
|
if (step.kind === "rolling") {
|
|
1963
|
-
step.value.call.callee = types.cloneNode(mappedRollingWindowIdentifier);
|
|
1988
|
+
step.value.call.callee = types.cloneNode(mappedRollingWindowIdentifier());
|
|
1964
1989
|
}
|
|
1965
1990
|
}
|
|
1966
1991
|
chainedRollingWindowCount += rollingIndices.length;
|
|
@@ -1984,10 +2009,10 @@ function rewriteQueuedKeyedArrayRollingWindowMapHints(root, statesBySetter, mapU
|
|
|
1984
2009
|
if (!types.isExpression(retained) || !types.isExpression(value)) return;
|
|
1985
2010
|
const hasLeadingMaps = leadingMaps.length > 0;
|
|
1986
2011
|
rolling.value.call.callee = types.cloneNode(
|
|
1987
|
-
hasLeadingMaps ? mappedStructuralAppendIdentifier : structuralAppendIdentifier
|
|
2012
|
+
hasLeadingMaps ? mappedStructuralAppendIdentifier() : structuralAppendIdentifier()
|
|
1988
2013
|
);
|
|
1989
2014
|
rolling.value.call.arguments = [
|
|
1990
|
-
hasLeadingMaps ? types.callExpression(types.cloneNode(mappedStructuralIdentifier), [
|
|
2015
|
+
hasLeadingMaps ? types.callExpression(types.cloneNode(mappedStructuralIdentifier()), [
|
|
1991
2016
|
types.cloneNode(retained, true)
|
|
1992
2017
|
]) : types.cloneNode(retained, true),
|
|
1993
2018
|
types.cloneNode(value, true)
|
|
@@ -1997,7 +2022,7 @@ function rewriteQueuedKeyedArrayRollingWindowMapHints(root, statesBySetter, mapU
|
|
|
1997
2022
|
mappedRollingWindowCount += 1;
|
|
1998
2023
|
for (const step of leadingMaps) {
|
|
1999
2024
|
if (step.kind !== "map") continue;
|
|
2000
|
-
step.value.updater.body.callee = types.cloneNode(queuedMapPipelineIdentifier);
|
|
2025
|
+
step.value.updater.body.callee = types.cloneNode(queuedMapPipelineIdentifier());
|
|
2001
2026
|
leadingMapCount += step.value.count;
|
|
2002
2027
|
}
|
|
2003
2028
|
} else {
|
|
@@ -2005,7 +2030,7 @@ function rewriteQueuedKeyedArrayRollingWindowMapHints(root, statesBySetter, mapU
|
|
|
2005
2030
|
}
|
|
2006
2031
|
for (const step of trailingMaps) {
|
|
2007
2032
|
if (step.kind !== "map") continue;
|
|
2008
|
-
step.value.updater.body.callee = types.cloneNode(structuralAppendMapPipelineIdentifier);
|
|
2033
|
+
step.value.updater.body.callee = types.cloneNode(structuralAppendMapPipelineIdentifier());
|
|
2009
2034
|
trailingMapCount += step.value.count;
|
|
2010
2035
|
}
|
|
2011
2036
|
segment = [];
|
|
@@ -2058,7 +2083,7 @@ function rewriteQueuedKeyedArrayRollingWindowMapHints(root, statesBySetter, mapU
|
|
|
2058
2083
|
function rewriteQueuedKeyedArrayStructuralReorderHints(root, statesBySetter, filterIdentifier, sliceIdentifier, mapPipelineIdentifier, queuedMapPipelineIdentifier, mappedStructuralIdentifier, mapReorderIdentifier, reorderIdentifier, sortIdentifier, structuralReorderIdentifier, structuralSortIdentifier, allowed) {
|
|
2059
2084
|
if (!allowed) {
|
|
2060
2085
|
return {
|
|
2061
|
-
root
|
|
2086
|
+
root,
|
|
2062
2087
|
reorderCount: 0,
|
|
2063
2088
|
sortCount: 0,
|
|
2064
2089
|
replacedMapReorderCount: 0,
|
|
@@ -2109,34 +2134,34 @@ function rewriteQueuedKeyedArrayStructuralReorderHints(root, statesBySetter, fil
|
|
|
2109
2134
|
types.traverseFast(updater.body, (node) => {
|
|
2110
2135
|
if (!types.isCallExpression(node) || !types.isIdentifier(node.callee)) return;
|
|
2111
2136
|
const helperName = node.callee.name;
|
|
2112
|
-
if (helperName === filterIdentifier.name || helperName === sliceIdentifier.name || helperName === mappedStructuralIdentifier.name) {
|
|
2137
|
+
if (helperName === filterIdentifier().name || helperName === sliceIdentifier().name || helperName === mappedStructuralIdentifier().name) {
|
|
2113
2138
|
startsStructuralLineage = true;
|
|
2114
2139
|
return;
|
|
2115
2140
|
}
|
|
2116
|
-
if (helperName === structuralReorderIdentifier.name || helperName === structuralSortIdentifier.name) {
|
|
2141
|
+
if (helperName === structuralReorderIdentifier().name || helperName === structuralSortIdentifier().name) {
|
|
2117
2142
|
startsStructuralLineage = true;
|
|
2118
2143
|
return;
|
|
2119
2144
|
}
|
|
2120
|
-
if (helperName === mapPipelineIdentifier.name) {
|
|
2145
|
+
if (helperName === mapPipelineIdentifier().name) {
|
|
2121
2146
|
continuesStructuralLineage = true;
|
|
2122
2147
|
return;
|
|
2123
2148
|
}
|
|
2124
|
-
if (helperName === queuedMapPipelineIdentifier.name) {
|
|
2149
|
+
if (helperName === queuedMapPipelineIdentifier().name) {
|
|
2125
2150
|
continuesStructuralLineage = true;
|
|
2126
2151
|
queuedMaps.push(node);
|
|
2127
2152
|
return;
|
|
2128
2153
|
}
|
|
2129
|
-
if (helperName === reorderIdentifier.name) {
|
|
2154
|
+
if (helperName === reorderIdentifier().name) {
|
|
2130
2155
|
continuesStructuralLineage = true;
|
|
2131
2156
|
reorderCalls.push({ call: node, kind: "reverse", mapped: false });
|
|
2132
2157
|
return;
|
|
2133
2158
|
}
|
|
2134
|
-
if (helperName === sortIdentifier.name) {
|
|
2159
|
+
if (helperName === sortIdentifier().name) {
|
|
2135
2160
|
continuesStructuralLineage = true;
|
|
2136
2161
|
reorderCalls.push({ call: node, kind: "sort", mapped: false });
|
|
2137
2162
|
return;
|
|
2138
2163
|
}
|
|
2139
|
-
if (helperName === mapReorderIdentifier.name) {
|
|
2164
|
+
if (helperName === mapReorderIdentifier().name) {
|
|
2140
2165
|
const method = node.arguments[1];
|
|
2141
2166
|
const kind = types.isIdentifier(method) ? methodKinds.get(method.name) : void 0;
|
|
2142
2167
|
if (!kind) {
|
|
@@ -2157,12 +2182,12 @@ function rewriteQueuedKeyedArrayStructuralReorderHints(root, statesBySetter, fil
|
|
|
2157
2182
|
continue;
|
|
2158
2183
|
}
|
|
2159
2184
|
for (const call of queuedMaps) {
|
|
2160
|
-
call.callee = types.cloneNode(mapPipelineIdentifier);
|
|
2185
|
+
call.callee = types.cloneNode(mapPipelineIdentifier());
|
|
2161
2186
|
replacedQueuedMapCount += 1;
|
|
2162
2187
|
}
|
|
2163
2188
|
for (const { call, kind, mapped } of reorderCalls) {
|
|
2164
2189
|
call.callee = types.cloneNode(
|
|
2165
|
-
kind === "reverse" ? structuralReorderIdentifier : structuralSortIdentifier
|
|
2190
|
+
kind === "reverse" ? structuralReorderIdentifier() : structuralSortIdentifier()
|
|
2166
2191
|
);
|
|
2167
2192
|
if (kind === "reverse") {
|
|
2168
2193
|
reorderCount += 1;
|
|
@@ -2188,7 +2213,7 @@ function rewriteQueuedKeyedArrayStructuralReorderHints(root, statesBySetter, fil
|
|
|
2188
2213
|
function rewriteQueuedKeyedArrayMapReorderHints(root, statesBySetter, mapUpdateIdentifier, queuedMapPipelineIdentifier, mapReorderIdentifier, reorderIdentifier, sortIdentifier, structuralReorderIdentifier, structuralSortIdentifier, allowed) {
|
|
2189
2214
|
if (!allowed) {
|
|
2190
2215
|
return {
|
|
2191
|
-
root
|
|
2216
|
+
root,
|
|
2192
2217
|
mapCount: 0,
|
|
2193
2218
|
mapReorderCount: 0,
|
|
2194
2219
|
mapSortCount: 0
|
|
@@ -2223,7 +2248,7 @@ function rewriteQueuedKeyedArrayMapReorderHints(root, statesBySetter, mapUpdateI
|
|
|
2223
2248
|
pendingMaps = [];
|
|
2224
2249
|
continue;
|
|
2225
2250
|
}
|
|
2226
|
-
if (types.isCallExpression(updater.body) && types.isIdentifier(updater.body.callee, { name: mapUpdateIdentifier.name }) && updater.body.arguments.length === 2) {
|
|
2251
|
+
if (types.isCallExpression(updater.body) && types.isIdentifier(updater.body.callee, { name: mapUpdateIdentifier().name }) && updater.body.arguments.length === 2) {
|
|
2227
2252
|
const pipeline = updater.body.arguments[1];
|
|
2228
2253
|
let pipelineMapCount = 0;
|
|
2229
2254
|
if (types.isArrowFunctionExpression(pipeline) && pipeline.params.length === 2 && types.isIdentifier(pipeline.params[1])) {
|
|
@@ -2250,13 +2275,13 @@ function rewriteQueuedKeyedArrayMapReorderHints(root, statesBySetter, mapUpdateI
|
|
|
2250
2275
|
let structural = false;
|
|
2251
2276
|
types.traverseFast(updater.body, (node) => {
|
|
2252
2277
|
if (!types.isCallExpression(node) || !types.isIdentifier(node.callee)) return;
|
|
2253
|
-
if (node.callee.name === structuralReorderIdentifier.name || node.callee.name === structuralSortIdentifier.name) {
|
|
2278
|
+
if (node.callee.name === structuralReorderIdentifier().name || node.callee.name === structuralSortIdentifier().name) {
|
|
2254
2279
|
structural = true;
|
|
2255
|
-
} else if (node.callee.name === mapReorderIdentifier.name) {
|
|
2280
|
+
} else if (node.callee.name === mapReorderIdentifier().name) {
|
|
2256
2281
|
containsMappedReorder = true;
|
|
2257
|
-
} else if (node.callee.name === reorderIdentifier.name) {
|
|
2282
|
+
} else if (node.callee.name === reorderIdentifier().name) {
|
|
2258
2283
|
reorderCalls.push({ call: node, kind: "reverse" });
|
|
2259
|
-
} else if (node.callee.name === sortIdentifier.name) {
|
|
2284
|
+
} else if (node.callee.name === sortIdentifier().name) {
|
|
2260
2285
|
reorderCalls.push({ call: node, kind: "sort" });
|
|
2261
2286
|
}
|
|
2262
2287
|
});
|
|
@@ -2278,12 +2303,12 @@ function rewriteQueuedKeyedArrayMapReorderHints(root, statesBySetter, mapUpdateI
|
|
|
2278
2303
|
}
|
|
2279
2304
|
if (hasPendingMaps) {
|
|
2280
2305
|
for (const candidate of pendingMaps) {
|
|
2281
|
-
candidate.updater.body.callee = types.cloneNode(queuedMapPipelineIdentifier);
|
|
2306
|
+
candidate.updater.body.callee = types.cloneNode(queuedMapPipelineIdentifier());
|
|
2282
2307
|
mapCount += candidate.count;
|
|
2283
2308
|
}
|
|
2284
2309
|
}
|
|
2285
2310
|
for (const { call, kind } of reorderCalls) {
|
|
2286
|
-
call.callee = types.cloneNode(mapReorderIdentifier);
|
|
2311
|
+
call.callee = types.cloneNode(mapReorderIdentifier());
|
|
2287
2312
|
if (kind === "reverse") mapReorderCount += 1;
|
|
2288
2313
|
else mapSortCount += 1;
|
|
2289
2314
|
}
|
|
@@ -2301,7 +2326,7 @@ function rewriteQueuedKeyedArrayMapReorderHints(root, statesBySetter, mapUpdateI
|
|
|
2301
2326
|
}
|
|
2302
2327
|
function rewriteKeyedArraySortHints(root, hintedStateIndices, statesBySetter, helperIdentifier, safeGlobals) {
|
|
2303
2328
|
if (hintedStateIndices.size === 0) {
|
|
2304
|
-
return { root
|
|
2329
|
+
return { root, count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
2305
2330
|
}
|
|
2306
2331
|
const file = expressionFile(types.cloneNode(root, true));
|
|
2307
2332
|
const stateIndices = /* @__PURE__ */ new Set();
|
|
@@ -2340,7 +2365,7 @@ function rewriteKeyedArraySortHints(root, hintedStateIndices, statesBySetter, he
|
|
|
2340
2365
|
)
|
|
2341
2366
|
]),
|
|
2342
2367
|
types.returnStatement(
|
|
2343
|
-
types.callExpression(types.cloneNode(helperIdentifier), [
|
|
2368
|
+
types.callExpression(types.cloneNode(helperIdentifier()), [
|
|
2344
2369
|
types.cloneNode(previous),
|
|
2345
2370
|
types.cloneNode(method),
|
|
2346
2371
|
...comparator ? [types.cloneNode(comparator, true)] : []
|
|
@@ -2361,7 +2386,7 @@ function rewriteKeyedArraySortHints(root, hintedStateIndices, statesBySetter, he
|
|
|
2361
2386
|
}
|
|
2362
2387
|
function rewriteKeyedArraySliceHints(root, hintedStateIndices, statesBySetter, helperIdentifier, safeGlobals) {
|
|
2363
2388
|
if (hintedStateIndices.size === 0) {
|
|
2364
|
-
return { root
|
|
2389
|
+
return { root, count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
2365
2390
|
}
|
|
2366
2391
|
const file = expressionFile(types.cloneNode(root, true));
|
|
2367
2392
|
const stateIndices = /* @__PURE__ */ new Set();
|
|
@@ -2402,7 +2427,7 @@ function rewriteKeyedArraySliceHints(root, hintedStateIndices, statesBySetter, h
|
|
|
2402
2427
|
)
|
|
2403
2428
|
]),
|
|
2404
2429
|
types.returnStatement(
|
|
2405
|
-
types.callExpression(types.cloneNode(helperIdentifier), [
|
|
2430
|
+
types.callExpression(types.cloneNode(helperIdentifier()), [
|
|
2406
2431
|
types.cloneNode(previous),
|
|
2407
2432
|
types.cloneNode(sliceMethod),
|
|
2408
2433
|
...bounds.map((bound) => types.cloneNode(bound, true))
|
|
@@ -2423,7 +2448,7 @@ function rewriteKeyedArraySliceHints(root, hintedStateIndices, statesBySetter, h
|
|
|
2423
2448
|
}
|
|
2424
2449
|
function rewriteKeyedArrayFilterHints(root, hintedStateIndices, statesBySetter, helperIdentifier, safeGlobals) {
|
|
2425
2450
|
if (hintedStateIndices.size === 0) {
|
|
2426
|
-
return { root
|
|
2451
|
+
return { root, count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
2427
2452
|
}
|
|
2428
2453
|
const file = expressionFile(types.cloneNode(root, true));
|
|
2429
2454
|
const stateIndices = /* @__PURE__ */ new Set();
|
|
@@ -2464,7 +2489,7 @@ function rewriteKeyedArrayFilterHints(root, hintedStateIndices, statesBySetter,
|
|
|
2464
2489
|
)
|
|
2465
2490
|
]),
|
|
2466
2491
|
types.returnStatement(
|
|
2467
|
-
types.callExpression(types.cloneNode(helperIdentifier), [
|
|
2492
|
+
types.callExpression(types.cloneNode(helperIdentifier()), [
|
|
2468
2493
|
types.cloneNode(previous),
|
|
2469
2494
|
types.cloneNode(filterMethod),
|
|
2470
2495
|
types.cloneNode(predicate, true)
|
|
@@ -2569,9 +2594,9 @@ function prepareKeyedCollectionUpdater(updater, kind, updateHelper, mutationHelp
|
|
|
2569
2594
|
)
|
|
2570
2595
|
]),
|
|
2571
2596
|
types.returnStatement(
|
|
2572
|
-
types.callExpression(types.cloneNode(updateHelper), [
|
|
2597
|
+
types.callExpression(types.cloneNode(updateHelper()), [
|
|
2573
2598
|
types.cloneNode(previous),
|
|
2574
|
-
types.callExpression(types.cloneNode(mutationHelper), [
|
|
2599
|
+
types.callExpression(types.cloneNode(mutationHelper()), [
|
|
2575
2600
|
types.cloneNode(collection),
|
|
2576
2601
|
types.memberExpression(types.cloneNode(collection), types.cloneNode(updater.body.callee.property)),
|
|
2577
2602
|
types.stringLiteral(operation),
|
|
@@ -2706,7 +2731,7 @@ function prepareKeyedCollectionUpdater(updater, kind, updateHelper, mutationHelp
|
|
|
2706
2731
|
const operation = collectionMutationOperation(kind, callee.property.name);
|
|
2707
2732
|
if (!collectionMutationArgumentsAreValid(operation, path.node.arguments)) return;
|
|
2708
2733
|
path.replaceWith(
|
|
2709
|
-
types.callExpression(types.cloneNode(mutationHelper), [
|
|
2734
|
+
types.callExpression(types.cloneNode(mutationHelper()), [
|
|
2710
2735
|
types.cloneNode(callee.object),
|
|
2711
2736
|
types.memberExpression(types.cloneNode(callee.object), types.cloneNode(callee.property)),
|
|
2712
2737
|
types.stringLiteral(operation),
|
|
@@ -2717,7 +2742,7 @@ function prepareKeyedCollectionUpdater(updater, kind, updateHelper, mutationHelp
|
|
|
2717
2742
|
},
|
|
2718
2743
|
ReturnStatement(path) {
|
|
2719
2744
|
if (path.getFunctionParent()?.node !== functionPath?.node || !path.node.argument) return;
|
|
2720
|
-
path.node.argument = types.callExpression(types.cloneNode(updateHelper), [
|
|
2745
|
+
path.node.argument = types.callExpression(types.cloneNode(updateHelper()), [
|
|
2721
2746
|
types.cloneNode(clonedPrevious),
|
|
2722
2747
|
types.cloneNode(path.node.argument, true),
|
|
2723
2748
|
types.stringLiteral(kind)
|
|
@@ -2728,7 +2753,7 @@ function prepareKeyedCollectionUpdater(updater, kind, updateHelper, mutationHelp
|
|
|
2728
2753
|
return types.isArrowFunctionExpression(prepared) || types.isFunctionExpression(prepared) ? { updater: prepared, mutations } : void 0;
|
|
2729
2754
|
}
|
|
2730
2755
|
function rewriteKeyedCollectionUpdateHints(root, targetKinds, states, statesBySetter, updateHelper, mutationHelper, globalCollections) {
|
|
2731
|
-
if (targetKinds.size === 0) return { root
|
|
2756
|
+
if (targetKinds.size === 0) return { root, count: 0 };
|
|
2732
2757
|
const file = expressionFile(types.cloneNode(root, true));
|
|
2733
2758
|
let count = 0;
|
|
2734
2759
|
for (const [stateIndex, kind] of targetKinds) {
|
|
@@ -3263,6 +3288,45 @@ function stabilizeDeferredEventCurrentTargets(root, compilerSetters) {
|
|
|
3263
3288
|
const expression = file.program.body[0].expression;
|
|
3264
3289
|
return types.isJSXElement(expression) ? expression : types.cloneNode(root, true);
|
|
3265
3290
|
}
|
|
3291
|
+
var FOREIGN_ELEMENT_NAMES = new Set(
|
|
3292
|
+
[
|
|
3293
|
+
"animate animateMotion animateTransform circle clipPath defs desc ellipse",
|
|
3294
|
+
"feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix",
|
|
3295
|
+
"feDiffuseLighting feDisplacementMap feDistantLight feDropShadow feFlood",
|
|
3296
|
+
"feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode",
|
|
3297
|
+
"feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile",
|
|
3298
|
+
"feTurbulence filter foreignObject g image line linearGradient marker mask",
|
|
3299
|
+
"metadata mpath path pattern polygon polyline radialGradient rect set stop svg",
|
|
3300
|
+
"switch symbol text textPath tspan use view",
|
|
3301
|
+
"math maction menclose merror mfrac mi mmultiscripts mn mo mover mpadded",
|
|
3302
|
+
"mphantom mprescripts mroot mrow ms mspace msqrt mstyle msub msubsup msup",
|
|
3303
|
+
"mtable mtd mtext mtr munder munderover semantics annotation"
|
|
3304
|
+
].join(" ").split(" ")
|
|
3305
|
+
);
|
|
3306
|
+
function markForeignContent(programPath) {
|
|
3307
|
+
let depth = 0;
|
|
3308
|
+
programPath.traverse({
|
|
3309
|
+
JSXElement: {
|
|
3310
|
+
enter(path) {
|
|
3311
|
+
if (depth > 0) path.node.extra = { ...path.node.extra, farmForeignContent: true };
|
|
3312
|
+
const name = path.node.openingElement.name;
|
|
3313
|
+
if (types.isJSXIdentifier(name) && (name.name === "svg" || name.name === "math")) depth++;
|
|
3314
|
+
},
|
|
3315
|
+
exit(path) {
|
|
3316
|
+
const name = path.node.openingElement.name;
|
|
3317
|
+
if (types.isJSXIdentifier(name) && (name.name === "svg" || name.name === "math")) depth--;
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
});
|
|
3321
|
+
}
|
|
3322
|
+
function isForeignContent(element) {
|
|
3323
|
+
const name = element.openingElement.name;
|
|
3324
|
+
return element.extra?.farmForeignContent === true || types.isJSXIdentifier(name) && FOREIGN_ELEMENT_NAMES.has(name.name);
|
|
3325
|
+
}
|
|
3326
|
+
function reactOwnedAttribute(name, attribute) {
|
|
3327
|
+
if (name === "defaultValue" || name === "defaultChecked") return true;
|
|
3328
|
+
return (name === "spellCheck" || name === "draggable" || name === "contentEditable") && !types.isStringLiteral(attribute.value);
|
|
3329
|
+
}
|
|
3266
3330
|
function analyzeKeyedRowTree(row, renderCallback, safeGlobals, compilerSetters, keyedTargetReactiveByValue) {
|
|
3267
3331
|
if (renderCallback.async || renderCallback.generator || renderCallback.params.length < 1 || renderCallback.params.length > 2 || !types.isIdentifier(renderCallback.params[0]) || renderCallback.params[1] !== void 0 && !types.isIdentifier(renderCallback.params[1])) {
|
|
3268
3332
|
return {
|
|
@@ -3282,7 +3346,12 @@ function analyzeKeyedRowTree(row, renderCallback, safeGlobals, compilerSetters,
|
|
|
3282
3346
|
if (!types.isJSXIdentifier(tag) || !/^[a-z]/.test(tag.name)) {
|
|
3283
3347
|
return "compiled keyed rows support host elements only";
|
|
3284
3348
|
}
|
|
3285
|
-
if (
|
|
3349
|
+
if (isForeignContent(element)) return "compiled keyed rows do not support SVG yet";
|
|
3350
|
+
if (tag.name.includes("-")) return "custom elements require React ownership";
|
|
3351
|
+
if (tag.name === "script") return "script elements require React ownership";
|
|
3352
|
+
if (tag.name === "title" || tag.name === "meta") {
|
|
3353
|
+
return "document metadata requires React ownership";
|
|
3354
|
+
}
|
|
3286
3355
|
const attributeNames = new Set(
|
|
3287
3356
|
element.openingElement.attributes.filter((attribute) => types.isJSXAttribute(attribute)).map(jsxAttributeName).filter((name) => name !== void 0)
|
|
3288
3357
|
);
|
|
@@ -3312,7 +3381,8 @@ function analyzeKeyedRowTree(row, renderCallback, safeGlobals, compilerSetters,
|
|
|
3312
3381
|
}
|
|
3313
3382
|
const name = jsxAttributeName(attribute);
|
|
3314
3383
|
if (!name) return "compiled keyed rows do not support namespaced JSX attributes";
|
|
3315
|
-
if (name === "
|
|
3384
|
+
if (name === "is") return "customized built-in elements require React ownership";
|
|
3385
|
+
if (name === "ref" || name === "dangerouslySetInnerHTML" || reactOwnedAttribute(name, attribute)) {
|
|
3316
3386
|
return `compiled keyed row ${name} requires React ownership`;
|
|
3317
3387
|
}
|
|
3318
3388
|
if (name === "key") continue;
|
|
@@ -3680,7 +3750,12 @@ function analyzeHostConditionalTree(branch, safeGlobals, allowStaticEvents = fal
|
|
|
3680
3750
|
if (!types.isJSXIdentifier(tag) || !/^[a-z]/.test(tag.name)) {
|
|
3681
3751
|
return "compiler-owned conditionals support host elements only";
|
|
3682
3752
|
}
|
|
3683
|
-
if (
|
|
3753
|
+
if (isForeignContent(element)) return "compiler-owned conditionals do not support SVG yet";
|
|
3754
|
+
if (tag.name.includes("-")) return "custom elements require React ownership";
|
|
3755
|
+
if (tag.name === "script") return "script elements require React ownership";
|
|
3756
|
+
if (tag.name === "title" || tag.name === "meta") {
|
|
3757
|
+
return "document metadata requires React ownership";
|
|
3758
|
+
}
|
|
3684
3759
|
for (const attribute of element.openingElement.attributes) {
|
|
3685
3760
|
if (types.isJSXSpreadAttribute(attribute)) {
|
|
3686
3761
|
if (statefulOnly && !needsStaticBinding(attribute.argument)) continue;
|
|
@@ -3688,6 +3763,10 @@ function analyzeHostConditionalTree(branch, safeGlobals, allowStaticEvents = fal
|
|
|
3688
3763
|
}
|
|
3689
3764
|
const name = jsxAttributeName(attribute);
|
|
3690
3765
|
if (!name) return "compiler-owned conditionals do not support namespaced JSX attributes";
|
|
3766
|
+
if (name === "is") return "customized built-in elements require React ownership";
|
|
3767
|
+
if (reactOwnedAttribute(name, attribute)) {
|
|
3768
|
+
return `compiler-owned conditional ${name} requires React ownership`;
|
|
3769
|
+
}
|
|
3691
3770
|
if (name === "ref" || name === "dangerouslySetInnerHTML" || name === "key") {
|
|
3692
3771
|
if (statefulOnly && (!types.isJSXExpressionContainer(attribute.value) || types.isJSXEmptyExpression(attribute.value.expression) || !needsStaticBinding(attribute.value.expression))) {
|
|
3693
3772
|
continue;
|
|
@@ -3800,13 +3879,24 @@ function analyzeRecursiveHostTree(branch, statesByValue, safeGlobals, listNames,
|
|
|
3800
3879
|
if (!types.isJSXIdentifier(tag) || !/^[a-z]/.test(tag.name)) {
|
|
3801
3880
|
return "recursive compiler-owned blocks support host elements only";
|
|
3802
3881
|
}
|
|
3803
|
-
if (
|
|
3882
|
+
if (isForeignContent(element)) {
|
|
3883
|
+
return "recursive compiler-owned blocks do not support SVG yet";
|
|
3884
|
+
}
|
|
3885
|
+
if (tag.name.includes("-")) return "custom elements require React ownership";
|
|
3886
|
+
if (tag.name === "script") return "script elements require React ownership";
|
|
3887
|
+
if (tag.name === "title" || tag.name === "meta") {
|
|
3888
|
+
return "document metadata requires React ownership";
|
|
3889
|
+
}
|
|
3804
3890
|
for (const attribute of element.openingElement.attributes) {
|
|
3805
3891
|
if (types.isJSXSpreadAttribute(attribute)) {
|
|
3806
3892
|
return "recursive compiler-owned blocks do not support JSX attribute spreads";
|
|
3807
3893
|
}
|
|
3808
3894
|
const name = jsxAttributeName(attribute);
|
|
3809
3895
|
if (!name) return "recursive compiler-owned blocks do not support namespaced attributes";
|
|
3896
|
+
if (name === "is") return "customized built-in elements require React ownership";
|
|
3897
|
+
if (reactOwnedAttribute(name, attribute)) {
|
|
3898
|
+
return `recursive compiler-owned block ${name} requires React ownership`;
|
|
3899
|
+
}
|
|
3810
3900
|
if (name === "ref" || name === "dangerouslySetInnerHTML" || name === "key") {
|
|
3811
3901
|
return `recursive compiler-owned block ${name} requires React ownership`;
|
|
3812
3902
|
}
|
|
@@ -4167,7 +4257,7 @@ function analyzeCompilerOwnedKeyedRowHostBlocks(shape, statesByValue, safeGlobal
|
|
|
4167
4257
|
}
|
|
4168
4258
|
function analyzeHostConditionalContainer(container, statesByValue, safeGlobals, listNames, parent, allocateId) {
|
|
4169
4259
|
const containerName = container.openingElement.name;
|
|
4170
|
-
if (!types.isJSXIdentifier(containerName) || !/^[a-z]/.test(containerName.name) ||
|
|
4260
|
+
if (!types.isJSXIdentifier(containerName) || !/^[a-z]/.test(containerName.name) || isForeignContent(container)) {
|
|
4171
4261
|
return void 0;
|
|
4172
4262
|
}
|
|
4173
4263
|
if (container.openingElement.attributes.some(
|
|
@@ -4232,7 +4322,7 @@ function analyzeHostConditionalContainer(container, statesByValue, safeGlobals,
|
|
|
4232
4322
|
}
|
|
4233
4323
|
function analyzeConditionalRangesContainer(container, statesByValue, safeGlobals, allowSingleRange, listNames, parent, allocateId) {
|
|
4234
4324
|
const containerName = container.openingElement.name;
|
|
4235
|
-
if (!types.isJSXIdentifier(containerName) || !/^[a-z]/.test(containerName.name) ||
|
|
4325
|
+
if (!types.isJSXIdentifier(containerName) || !/^[a-z]/.test(containerName.name) || isForeignContent(container) || container.openingElement.attributes.some(
|
|
4236
4326
|
(attribute) => types.isJSXSpreadAttribute(attribute) || types.isJSXAttribute(attribute) && types.isJSXIdentifier(attribute.name) && (attribute.name.name === "ref" || attribute.name.name === "dangerouslySetInnerHTML")
|
|
4237
4327
|
)) {
|
|
4238
4328
|
return void 0;
|
|
@@ -4328,7 +4418,7 @@ function analyzeConditionalRangesContainer(container, statesByValue, safeGlobals
|
|
|
4328
4418
|
}
|
|
4329
4419
|
function analyzeMixedRangesContainer(container, statesByValue, safeGlobals, listNames, parent, allocateId) {
|
|
4330
4420
|
const containerName = container.openingElement.name;
|
|
4331
|
-
if (!types.isJSXIdentifier(containerName) || !/^[a-z]/.test(containerName.name) ||
|
|
4421
|
+
if (!types.isJSXIdentifier(containerName) || !/^[a-z]/.test(containerName.name) || isForeignContent(container) || container.openingElement.attributes.some(
|
|
4332
4422
|
(attribute) => types.isJSXSpreadAttribute(attribute) || types.isJSXAttribute(attribute) && types.isJSXIdentifier(attribute.name) && (attribute.name.name === "ref" || attribute.name.name === "dangerouslySetInnerHTML")
|
|
4333
4423
|
)) {
|
|
4334
4424
|
return void 0;
|
|
@@ -4880,6 +4970,57 @@ function canCloneKeyedRows(plan) {
|
|
|
4880
4970
|
};
|
|
4881
4971
|
return cloneable(plan.row);
|
|
4882
4972
|
}
|
|
4973
|
+
function keyedRowBindingTargets(plan) {
|
|
4974
|
+
if (!canCloneKeyedRows(plan)) return void 0;
|
|
4975
|
+
const root = types.identifier("row");
|
|
4976
|
+
const targets = /* @__PURE__ */ new Map([["", root]]);
|
|
4977
|
+
const statements = [];
|
|
4978
|
+
let independentReads = 0;
|
|
4979
|
+
for (const binding of plan.bindings) {
|
|
4980
|
+
const path = [];
|
|
4981
|
+
for (const index of binding.path) {
|
|
4982
|
+
independentReads += index + 1;
|
|
4983
|
+
for (let sibling = 0; sibling <= index; sibling += 1) {
|
|
4984
|
+
const key = [...path, sibling].join(".");
|
|
4985
|
+
if (targets.has(key)) continue;
|
|
4986
|
+
if (statements.length === 32) return void 0;
|
|
4987
|
+
const parent = targets.get(
|
|
4988
|
+
sibling === 0 ? path.join(".") : [...path, sibling - 1].join(".")
|
|
4989
|
+
);
|
|
4990
|
+
const target = types.identifier(`target${statements.length}`);
|
|
4991
|
+
statements.push(
|
|
4992
|
+
types.variableDeclaration("const", [
|
|
4993
|
+
types.variableDeclarator(
|
|
4994
|
+
target,
|
|
4995
|
+
types.optionalMemberExpression(
|
|
4996
|
+
parent,
|
|
4997
|
+
types.identifier(sibling === 0 ? "firstElementChild" : "nextElementSibling"),
|
|
4998
|
+
false,
|
|
4999
|
+
true
|
|
5000
|
+
)
|
|
5001
|
+
)
|
|
5002
|
+
])
|
|
5003
|
+
);
|
|
5004
|
+
targets.set(key, target);
|
|
5005
|
+
}
|
|
5006
|
+
path.push(index);
|
|
5007
|
+
}
|
|
5008
|
+
}
|
|
5009
|
+
if (statements.length >= independentReads) return void 0;
|
|
5010
|
+
return types.arrowFunctionExpression(
|
|
5011
|
+
[root],
|
|
5012
|
+
types.blockStatement([
|
|
5013
|
+
...statements,
|
|
5014
|
+
types.returnStatement(
|
|
5015
|
+
types.arrayExpression(
|
|
5016
|
+
plan.bindings.map(
|
|
5017
|
+
(binding) => types.logicalExpression("??", targets.get(binding.path.join(".")), types.nullLiteral())
|
|
5018
|
+
)
|
|
5019
|
+
)
|
|
5020
|
+
)
|
|
5021
|
+
])
|
|
5022
|
+
);
|
|
5023
|
+
}
|
|
4883
5024
|
function keyedRowsBoundary(blockRuntime, plan, keyedMapUpdateHints, keyedArrayFilterHintedStateIndices, keyedArrayPrependHintedStateIndices, keyedArrayPositionHintedStateIndices, keyedArrayReorderHintedStateIndices) {
|
|
4884
5025
|
const name = types.jsxMemberExpression(
|
|
4885
5026
|
types.jsxIdentifier(blockRuntime.name),
|
|
@@ -4897,6 +5038,7 @@ function keyedRowsBoundary(blockRuntime, plan, keyedMapUpdateHints, keyedArrayFi
|
|
|
4897
5038
|
...plan.conditionals.map((conditional) => conditional.test)
|
|
4898
5039
|
]);
|
|
4899
5040
|
const delegatedEvents = canDelegateKeyedRowEvents(plan);
|
|
5041
|
+
const bindingTargets = keyedRowBindingTargets(plan);
|
|
4900
5042
|
const renderSource = keyedRowsRenderSource(plan, eventFactory, conditionalFactory);
|
|
4901
5043
|
const renderFactoryParameters = plan.conditionals.length > 0 ? [types.cloneNode(eventFactory), types.cloneNode(conditionalFactory)] : plan.events.length > 0 ? [types.cloneNode(eventFactory)] : [];
|
|
4902
5044
|
return types.jsxElement(
|
|
@@ -5017,6 +5159,7 @@ function keyedRowsBoundary(blockRuntime, plan, keyedMapUpdateHints, keyedArrayFi
|
|
|
5017
5159
|
types.jsxExpressionContainer(types.booleanLiteral(true))
|
|
5018
5160
|
)
|
|
5019
5161
|
] : [],
|
|
5162
|
+
...bindingTargets ? [types.jsxAttribute(types.jsxIdentifier("targets"), types.jsxExpressionContainer(bindingTargets))] : [],
|
|
5020
5163
|
...canCloneKeyedRows(plan) ? [
|
|
5021
5164
|
types.jsxAttribute(
|
|
5022
5165
|
types.jsxIdentifier("cloneRows"),
|
|
@@ -6019,10 +6162,12 @@ function analyzeHostTree(root, statesByValue, safeGlobals, conditionalExpression
|
|
|
6019
6162
|
if (!types.isJSXIdentifier(tag) || !/^[a-z]/.test(tag.name)) {
|
|
6020
6163
|
return "compiled trees currently support host elements only";
|
|
6021
6164
|
}
|
|
6165
|
+
if (tag.name.includes("-")) return "custom elements require React ownership";
|
|
6022
6166
|
for (const attribute of element.openingElement.attributes) {
|
|
6023
6167
|
if (types.isJSXSpreadAttribute(attribute)) return "JSX attribute spreads are not supported yet";
|
|
6024
6168
|
const name = jsxAttributeName(attribute);
|
|
6025
6169
|
if (!name) return "namespaced JSX attributes are not supported yet";
|
|
6170
|
+
if (name === "is") return "customized built-in elements require React ownership";
|
|
6026
6171
|
if (name === "ref" || name === "dangerouslySetInnerHTML") {
|
|
6027
6172
|
return `${name} requires React ownership`;
|
|
6028
6173
|
}
|
|
@@ -6031,7 +6176,14 @@ function analyzeHostTree(root, statesByValue, safeGlobals, conditionalExpression
|
|
|
6031
6176
|
}
|
|
6032
6177
|
const expression = attribute.value.expression;
|
|
6033
6178
|
const dependencies = collectStateDependencies(expression, statesByValue);
|
|
6034
|
-
if (dependencies.length === 0
|
|
6179
|
+
if (dependencies.length === 0) continue;
|
|
6180
|
+
if (name === "contentEditable") return "stateful contentEditable requires React ownership";
|
|
6181
|
+
if (/^on[A-Z]/.test(name)) {
|
|
6182
|
+
if (!types.isArrowFunctionExpression(expression) && !types.isFunctionExpression(expression)) {
|
|
6183
|
+
return "stateful event handler selection requires React ownership";
|
|
6184
|
+
}
|
|
6185
|
+
continue;
|
|
6186
|
+
}
|
|
6035
6187
|
if (name === "style") {
|
|
6036
6188
|
const reason2 = analyzeStyle(expression, path);
|
|
6037
6189
|
if (reason2) return reason2;
|
|
@@ -7257,6 +7409,14 @@ function compileCandidate(candidate, createComponentIdentifier, keyedMapUpdateId
|
|
|
7257
7409
|
appliedKeyedMapUpdateHints > 0 || appliedKeyedArrayAppendHints > 0,
|
|
7258
7410
|
appliedKeyedArrayAppendHints > 0 && appliedKeyedMapUpdateHints === 0
|
|
7259
7411
|
);
|
|
7412
|
+
for (const feature of runtimeFeatures) {
|
|
7413
|
+
if (!runtimeFeatureIdentifiers.has(feature)) {
|
|
7414
|
+
runtimeFeatureIdentifiers.set(
|
|
7415
|
+
feature,
|
|
7416
|
+
path.scope.getProgramParent().generateUidIdentifier(COMPILER_RUNTIME_FEATURE_EXPORTS[feature])
|
|
7417
|
+
);
|
|
7418
|
+
}
|
|
7419
|
+
}
|
|
7260
7420
|
markShortCircuitBindings(analysis.bindings || []);
|
|
7261
7421
|
assignStableBindingTargets(analysis.bindings || []);
|
|
7262
7422
|
const stateParameter = path.scope.generateUidIdentifier("farmState");
|
|
@@ -7385,8 +7545,17 @@ function compileCandidate(candidate, createComponentIdentifier, keyedMapUpdateId
|
|
|
7385
7545
|
for (const feature of runtimeFeatures) usedRuntimeFeatures.add(feature);
|
|
7386
7546
|
return void 0;
|
|
7387
7547
|
}
|
|
7388
|
-
function collectCandidates(programPath) {
|
|
7548
|
+
function collectCandidates(programPath, options, moduleSelected) {
|
|
7389
7549
|
const candidates = [];
|
|
7550
|
+
function collect(name, path, statementPath) {
|
|
7551
|
+
const functionDirectives = new Set(
|
|
7552
|
+
types.isBlockStatement(path.node.body) ? directiveValues(path.node.body) : []
|
|
7553
|
+
);
|
|
7554
|
+
const explicitlySelected = moduleSelected || functionDirectives.has(options.directive);
|
|
7555
|
+
if (functionDirectives.has("use no compiler")) return;
|
|
7556
|
+
if (options.mode === "annotation" && !explicitlySelected) return;
|
|
7557
|
+
candidates.push({ name, path, statementPath, explicitlySelected });
|
|
7558
|
+
}
|
|
7390
7559
|
programPath.traverse({
|
|
7391
7560
|
FunctionDeclaration(path) {
|
|
7392
7561
|
if (!path.node.id || !isComponentName(path.node.id.name)) return;
|
|
@@ -7394,11 +7563,7 @@ function collectCandidates(programPath) {
|
|
|
7394
7563
|
if (!parent.isProgram() && !parent.isExportNamedDeclaration() && !parent.isExportDefaultDeclaration()) {
|
|
7395
7564
|
return;
|
|
7396
7565
|
}
|
|
7397
|
-
|
|
7398
|
-
name: path.node.id.name,
|
|
7399
|
-
path,
|
|
7400
|
-
statementPath: parent.isProgram() ? path : parent
|
|
7401
|
-
});
|
|
7566
|
+
collect(path.node.id.name, path, parent.isProgram() ? path : parent);
|
|
7402
7567
|
},
|
|
7403
7568
|
VariableDeclarator(path) {
|
|
7404
7569
|
if (!types.isIdentifier(path.node.id) || !isComponentName(path.node.id.name) || !types.isFunctionExpression(path.node.init) && !types.isArrowFunctionExpression(path.node.init)) {
|
|
@@ -7409,11 +7574,7 @@ function collectCandidates(programPath) {
|
|
|
7409
7574
|
if (!statement) return;
|
|
7410
7575
|
const topLevel = statement.isProgram() ? declaration : statement.isExportNamedDeclaration() && statement.parentPath.isProgram() ? statement : null;
|
|
7411
7576
|
if (!topLevel) return;
|
|
7412
|
-
|
|
7413
|
-
name: path.node.id.name,
|
|
7414
|
-
path: path.get("init"),
|
|
7415
|
-
statementPath: topLevel
|
|
7416
|
-
});
|
|
7577
|
+
collect(path.node.id.name, path.get("init"), topLevel);
|
|
7417
7578
|
}
|
|
7418
7579
|
});
|
|
7419
7580
|
return candidates;
|
|
@@ -7460,6 +7621,7 @@ async function compileReactModule(code, id, options) {
|
|
|
7460
7621
|
visitor: {
|
|
7461
7622
|
Program(programPath) {
|
|
7462
7623
|
const moduleDirectives = new Set(directiveValues(programPath.node));
|
|
7624
|
+
markForeignContent(programPath);
|
|
7463
7625
|
const useStateNames = /* @__PURE__ */ new Set();
|
|
7464
7626
|
const reactNames = /* @__PURE__ */ new Set();
|
|
7465
7627
|
const listNames = /* @__PURE__ */ new Set();
|
|
@@ -7482,97 +7644,85 @@ async function compileReactModule(code, id, options) {
|
|
|
7482
7644
|
}
|
|
7483
7645
|
}
|
|
7484
7646
|
}
|
|
7485
|
-
const candidates = collectCandidates(
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
);
|
|
7490
|
-
const keyedArrayAppendIdentifier = programPath.scope.generateUidIdentifier(
|
|
7491
|
-
"createCompilerKeyedArrayAppend"
|
|
7647
|
+
const candidates = collectCandidates(
|
|
7648
|
+
programPath,
|
|
7649
|
+
options,
|
|
7650
|
+
moduleDirectives.has(options.directive)
|
|
7492
7651
|
);
|
|
7493
|
-
|
|
7494
|
-
|
|
7652
|
+
if (candidates.length === 0) return;
|
|
7653
|
+
const createComponentIdentifier = programPath.scope.generateUidIdentifier("createCompiledComponent");
|
|
7654
|
+
const createRefreshComponentIdentifier = programPath.scope.generateUidIdentifier("createRefreshComponent");
|
|
7655
|
+
const createProductionComponentIdentifier = programPath.scope.generateUidIdentifier(
|
|
7656
|
+
"createProductionComponent"
|
|
7495
7657
|
);
|
|
7496
|
-
const
|
|
7658
|
+
const helperIdentifier = (name) => {
|
|
7659
|
+
let identifier;
|
|
7660
|
+
return () => identifier ?? (identifier = programPath.scope.generateUidIdentifier(name));
|
|
7661
|
+
};
|
|
7662
|
+
const keyedMapUpdateIdentifier = helperIdentifier("createCompilerKeyedMapUpdate");
|
|
7663
|
+
const keyedArrayAppendIdentifier = helperIdentifier("createCompilerKeyedArrayAppend");
|
|
7664
|
+
const keyedArrayFilterIdentifier = helperIdentifier("createCompilerKeyedArrayFilter");
|
|
7665
|
+
const keyedArrayMapPipelineIdentifier = helperIdentifier(
|
|
7497
7666
|
"createCompilerKeyedArrayMapPipeline"
|
|
7498
7667
|
);
|
|
7499
|
-
const keyedArrayMappedStructuralAppendIdentifier =
|
|
7668
|
+
const keyedArrayMappedStructuralAppendIdentifier = helperIdentifier(
|
|
7500
7669
|
"createCompilerKeyedArrayMappedStructuralAppend"
|
|
7501
7670
|
);
|
|
7502
|
-
const keyedArrayStructuralAppendMapPipelineIdentifier =
|
|
7671
|
+
const keyedArrayStructuralAppendMapPipelineIdentifier = helperIdentifier(
|
|
7503
7672
|
"createCompilerKeyedArrayStructuralAppendMapPipeline"
|
|
7504
7673
|
);
|
|
7505
|
-
const keyedArrayMappedStructuralPrependIdentifier =
|
|
7674
|
+
const keyedArrayMappedStructuralPrependIdentifier = helperIdentifier(
|
|
7506
7675
|
"createCompilerKeyedArrayMappedStructuralPrepend"
|
|
7507
7676
|
);
|
|
7508
|
-
const keyedArrayStructuralPrependMapPipelineIdentifier =
|
|
7677
|
+
const keyedArrayStructuralPrependMapPipelineIdentifier = helperIdentifier(
|
|
7509
7678
|
"createCompilerKeyedArrayStructuralPrependMapPipeline"
|
|
7510
7679
|
);
|
|
7511
|
-
const keyedArrayQueuedMapPipelineIdentifier =
|
|
7680
|
+
const keyedArrayQueuedMapPipelineIdentifier = helperIdentifier(
|
|
7512
7681
|
"createCompilerKeyedArrayQueuedMapPipeline"
|
|
7513
7682
|
);
|
|
7514
|
-
const keyedArrayRollingWindowMapPipelineIdentifier =
|
|
7683
|
+
const keyedArrayRollingWindowMapPipelineIdentifier = helperIdentifier(
|
|
7515
7684
|
"createCompilerKeyedArrayRollingWindowMapPipeline"
|
|
7516
7685
|
);
|
|
7517
|
-
const keyedArrayMappedRollingWindowIdentifier =
|
|
7686
|
+
const keyedArrayMappedRollingWindowIdentifier = helperIdentifier(
|
|
7518
7687
|
"createCompilerKeyedArrayMappedRollingWindow"
|
|
7519
7688
|
);
|
|
7520
|
-
const keyedArrayMapReorderIdentifier =
|
|
7689
|
+
const keyedArrayMapReorderIdentifier = helperIdentifier(
|
|
7521
7690
|
"createCompilerKeyedArrayMapReorder"
|
|
7522
7691
|
);
|
|
7523
|
-
const keyedArrayMappedStructuralIdentifier =
|
|
7692
|
+
const keyedArrayMappedStructuralIdentifier = helperIdentifier(
|
|
7524
7693
|
"finalizeCompilerKeyedArrayMappedStructuralUpdate"
|
|
7525
7694
|
);
|
|
7526
|
-
const keyedArrayPrependIdentifier =
|
|
7527
|
-
|
|
7528
|
-
);
|
|
7529
|
-
const keyedArrayPositionIdentifier = programPath.scope.generateUidIdentifier(
|
|
7695
|
+
const keyedArrayPrependIdentifier = helperIdentifier("createCompilerKeyedArrayPrepend");
|
|
7696
|
+
const keyedArrayPositionIdentifier = helperIdentifier(
|
|
7530
7697
|
"createCompilerKeyedArrayPositionUpdate"
|
|
7531
7698
|
);
|
|
7532
|
-
const keyedArrayBatchInsertIdentifier =
|
|
7699
|
+
const keyedArrayBatchInsertIdentifier = helperIdentifier(
|
|
7533
7700
|
"createCompilerKeyedArrayBatchInsert"
|
|
7534
7701
|
);
|
|
7535
|
-
const keyedArrayWindowReplaceIdentifier =
|
|
7702
|
+
const keyedArrayWindowReplaceIdentifier = helperIdentifier(
|
|
7536
7703
|
"createCompilerKeyedArrayWindowReplace"
|
|
7537
7704
|
);
|
|
7538
|
-
const keyedArrayReorderIdentifier =
|
|
7539
|
-
|
|
7540
|
-
);
|
|
7541
|
-
const keyedArrayStructuralReorderIdentifier = programPath.scope.generateUidIdentifier(
|
|
7705
|
+
const keyedArrayReorderIdentifier = helperIdentifier("createCompilerKeyedArrayReorder");
|
|
7706
|
+
const keyedArrayStructuralReorderIdentifier = helperIdentifier(
|
|
7542
7707
|
"createCompilerKeyedArrayStructuralReorder"
|
|
7543
7708
|
);
|
|
7544
|
-
const keyedArraySortIdentifier =
|
|
7545
|
-
|
|
7546
|
-
);
|
|
7547
|
-
const keyedArrayStructuralSortIdentifier = programPath.scope.generateUidIdentifier(
|
|
7709
|
+
const keyedArraySortIdentifier = helperIdentifier("createCompilerKeyedArraySort");
|
|
7710
|
+
const keyedArrayStructuralSortIdentifier = helperIdentifier(
|
|
7548
7711
|
"createCompilerKeyedArrayStructuralSort"
|
|
7549
7712
|
);
|
|
7550
|
-
const keyedArrayRollingWindowIdentifier =
|
|
7713
|
+
const keyedArrayRollingWindowIdentifier = helperIdentifier(
|
|
7551
7714
|
"createCompilerKeyedArrayRollingWindow"
|
|
7552
7715
|
);
|
|
7553
|
-
const keyedArraySliceIdentifier =
|
|
7554
|
-
|
|
7555
|
-
);
|
|
7556
|
-
const keyedCollectionUpdateIdentifier = programPath.scope.generateUidIdentifier(
|
|
7716
|
+
const keyedArraySliceIdentifier = helperIdentifier("createCompilerKeyedArraySlice");
|
|
7717
|
+
const keyedCollectionUpdateIdentifier = helperIdentifier(
|
|
7557
7718
|
"createCompilerKeyedCollectionUpdate"
|
|
7558
7719
|
);
|
|
7559
|
-
const keyedCollectionMutationIdentifier =
|
|
7720
|
+
const keyedCollectionMutationIdentifier = helperIdentifier(
|
|
7560
7721
|
"applyCompilerKeyedCollectionMutation"
|
|
7561
7722
|
);
|
|
7562
|
-
const runtimeFeatureIdentifiers = new Map(
|
|
7563
|
-
Object.entries(COMPILER_RUNTIME_FEATURE_EXPORTS).map(([feature, exportName]) => [
|
|
7564
|
-
feature,
|
|
7565
|
-
programPath.scope.generateUidIdentifier(exportName)
|
|
7566
|
-
])
|
|
7567
|
-
);
|
|
7723
|
+
const runtimeFeatureIdentifiers = /* @__PURE__ */ new Map();
|
|
7568
7724
|
const usedRuntimeFeatures = /* @__PURE__ */ new Set();
|
|
7569
7725
|
for (const candidate of candidates) {
|
|
7570
|
-
const functionDirectives = new Set(
|
|
7571
|
-
types.isBlockStatement(candidate.path.node.body) ? directiveValues(candidate.path.node.body) : []
|
|
7572
|
-
);
|
|
7573
|
-
const explicitlySelected = moduleDirectives.has(options.directive) || functionDirectives.has(options.directive);
|
|
7574
|
-
if (functionDirectives.has("use no compiler")) continue;
|
|
7575
|
-
if (options.mode === "annotation" && !explicitlySelected) continue;
|
|
7576
7726
|
const reason = compileCandidate(
|
|
7577
7727
|
candidate,
|
|
7578
7728
|
createComponentIdentifier,
|
|
@@ -7615,7 +7765,7 @@ async function compileReactModule(code, id, options) {
|
|
|
7615
7765
|
diagnostics.push({
|
|
7616
7766
|
component: candidate.name,
|
|
7617
7767
|
reason,
|
|
7618
|
-
selected: explicitlySelected
|
|
7768
|
+
selected: candidate.explicitlySelected
|
|
7619
7769
|
});
|
|
7620
7770
|
} else {
|
|
7621
7771
|
compiled.push(candidate.name);
|
|
@@ -7628,83 +7778,103 @@ async function compileReactModule(code, id, options) {
|
|
|
7628
7778
|
const hasKeyedArrayStructuralPrependHints = optimizationCounts.keyedArrayPrependHints > 0 && (optimizationCounts.keyedArrayFilterHints > 0 || optimizationCounts.keyedArraySliceHints > 0);
|
|
7629
7779
|
const hasUnmappedKeyedArrayPrependHints = optimizationCounts.keyedArrayPrependHints > compilerUsage.keyedArrayMappedStructuralPrependHints;
|
|
7630
7780
|
if (compiled.length > 0) {
|
|
7781
|
+
programPath.unshiftContainer(
|
|
7782
|
+
"body",
|
|
7783
|
+
types.variableDeclaration("const", [
|
|
7784
|
+
types.variableDeclarator(
|
|
7785
|
+
types.cloneNode(createComponentIdentifier),
|
|
7786
|
+
types.conditionalExpression(
|
|
7787
|
+
types.memberExpression(
|
|
7788
|
+
types.metaProperty(types.identifier("import"), types.identifier("meta")),
|
|
7789
|
+
types.identifier("hot")
|
|
7790
|
+
),
|
|
7791
|
+
types.cloneNode(createRefreshComponentIdentifier),
|
|
7792
|
+
types.cloneNode(createProductionComponentIdentifier)
|
|
7793
|
+
)
|
|
7794
|
+
)
|
|
7795
|
+
])
|
|
7796
|
+
);
|
|
7631
7797
|
programPath.unshiftContainer(
|
|
7632
7798
|
"body",
|
|
7633
7799
|
types.importDeclaration(
|
|
7634
7800
|
[
|
|
7635
7801
|
types.importSpecifier(
|
|
7636
|
-
|
|
7802
|
+
createRefreshComponentIdentifier,
|
|
7637
7803
|
types.identifier("createCompiledComponentWithFeatures")
|
|
7638
7804
|
),
|
|
7805
|
+
types.importSpecifier(
|
|
7806
|
+
createProductionComponentIdentifier,
|
|
7807
|
+
types.identifier("createCompiledComponentWithoutRefresh")
|
|
7808
|
+
),
|
|
7639
7809
|
...optimizationCounts.keyedMapUpdateHints > compilerUsage.keyedArrayMapUpdateHints ? [
|
|
7640
7810
|
types.importSpecifier(
|
|
7641
|
-
keyedMapUpdateIdentifier,
|
|
7811
|
+
keyedMapUpdateIdentifier(),
|
|
7642
7812
|
types.identifier("createCompilerKeyedMapUpdate")
|
|
7643
7813
|
)
|
|
7644
7814
|
] : [],
|
|
7645
7815
|
...hasEagerKeyedArrayMapUpdateHints ? [
|
|
7646
7816
|
types.importSpecifier(
|
|
7647
|
-
keyedArrayMapPipelineIdentifier,
|
|
7817
|
+
keyedArrayMapPipelineIdentifier(),
|
|
7648
7818
|
types.identifier("createCompilerKeyedArrayMapPipeline")
|
|
7649
7819
|
)
|
|
7650
7820
|
] : [],
|
|
7651
7821
|
...compilerUsage.keyedArrayStructuralAppendMapHints > 0 ? [
|
|
7652
7822
|
types.importSpecifier(
|
|
7653
|
-
keyedArrayStructuralAppendMapPipelineIdentifier,
|
|
7823
|
+
keyedArrayStructuralAppendMapPipelineIdentifier(),
|
|
7654
7824
|
types.identifier("createCompilerKeyedArrayStructuralAppendMapPipeline")
|
|
7655
7825
|
)
|
|
7656
7826
|
] : [],
|
|
7657
7827
|
...compilerUsage.keyedArrayStructuralPrependMapHints > 0 ? [
|
|
7658
7828
|
types.importSpecifier(
|
|
7659
|
-
keyedArrayStructuralPrependMapPipelineIdentifier,
|
|
7829
|
+
keyedArrayStructuralPrependMapPipelineIdentifier(),
|
|
7660
7830
|
types.identifier("createCompilerKeyedArrayStructuralPrependMapPipeline")
|
|
7661
7831
|
)
|
|
7662
7832
|
] : [],
|
|
7663
7833
|
...hasKeyedArrayMapReorderHints ? [
|
|
7664
7834
|
types.importSpecifier(
|
|
7665
|
-
keyedArrayMapReorderIdentifier,
|
|
7835
|
+
keyedArrayMapReorderIdentifier(),
|
|
7666
7836
|
types.identifier("createCompilerKeyedArrayMapReorder")
|
|
7667
7837
|
)
|
|
7668
7838
|
] : [],
|
|
7669
7839
|
...compilerUsage.keyedArrayMappedStructuralHints > 0 ? [
|
|
7670
7840
|
types.importSpecifier(
|
|
7671
|
-
keyedArrayMappedStructuralIdentifier,
|
|
7841
|
+
keyedArrayMappedStructuralIdentifier(),
|
|
7672
7842
|
types.identifier("finalizeCompilerKeyedArrayMappedStructuralUpdate")
|
|
7673
7843
|
)
|
|
7674
7844
|
] : [],
|
|
7675
7845
|
...compilerUsage.keyedArrayMappedStructuralAppendHints > 0 || compilerUsage.keyedArrayMappedRollingWindowHints > compilerUsage.keyedArrayMappedRollingWindowChainHints ? [
|
|
7676
7846
|
types.importSpecifier(
|
|
7677
|
-
keyedArrayMappedStructuralAppendIdentifier,
|
|
7847
|
+
keyedArrayMappedStructuralAppendIdentifier(),
|
|
7678
7848
|
types.identifier("createCompilerKeyedArrayMappedStructuralAppend")
|
|
7679
7849
|
)
|
|
7680
7850
|
] : [],
|
|
7681
7851
|
...compilerUsage.keyedArrayMappedStructuralPrependHints > 0 ? [
|
|
7682
7852
|
types.importSpecifier(
|
|
7683
|
-
keyedArrayMappedStructuralPrependIdentifier,
|
|
7853
|
+
keyedArrayMappedStructuralPrependIdentifier(),
|
|
7684
7854
|
types.identifier("createCompilerKeyedArrayMappedStructuralPrepend")
|
|
7685
7855
|
)
|
|
7686
7856
|
] : [],
|
|
7687
7857
|
...compilerUsage.keyedArrayQueuedMapUpdateHints > 0 ? [
|
|
7688
7858
|
types.importSpecifier(
|
|
7689
|
-
keyedArrayQueuedMapPipelineIdentifier,
|
|
7859
|
+
keyedArrayQueuedMapPipelineIdentifier(),
|
|
7690
7860
|
types.identifier("createCompilerKeyedArrayQueuedMapPipeline")
|
|
7691
7861
|
)
|
|
7692
7862
|
] : [],
|
|
7693
7863
|
...compilerUsage.keyedArrayMappedRollingWindowChainHints > 0 ? [
|
|
7694
7864
|
types.importSpecifier(
|
|
7695
|
-
keyedArrayRollingWindowMapPipelineIdentifier,
|
|
7865
|
+
keyedArrayRollingWindowMapPipelineIdentifier(),
|
|
7696
7866
|
types.identifier("createCompilerKeyedArrayRollingWindowMapPipeline")
|
|
7697
7867
|
)
|
|
7698
7868
|
] : [],
|
|
7699
7869
|
...compilerUsage.keyedArrayMappedRollingWindowChainHints > 0 ? [
|
|
7700
7870
|
types.importSpecifier(
|
|
7701
|
-
keyedArrayMappedRollingWindowIdentifier,
|
|
7871
|
+
keyedArrayMappedRollingWindowIdentifier(),
|
|
7702
7872
|
types.identifier("createCompilerKeyedArrayMappedRollingWindow")
|
|
7703
7873
|
)
|
|
7704
7874
|
] : [],
|
|
7705
7875
|
...hasUnmappedKeyedArrayAppendHints || compilerUsage.keyedArrayStructuralRollingWindowHints > 0 ? [
|
|
7706
7876
|
types.importSpecifier(
|
|
7707
|
-
keyedArrayAppendIdentifier,
|
|
7877
|
+
keyedArrayAppendIdentifier(),
|
|
7708
7878
|
types.identifier(
|
|
7709
7879
|
hasKeyedArrayStructuralAppendHints ? "createCompilerKeyedArrayStructuralAppend" : "createCompilerKeyedArrayAppend"
|
|
7710
7880
|
)
|
|
@@ -7712,13 +7882,13 @@ async function compileReactModule(code, id, options) {
|
|
|
7712
7882
|
] : [],
|
|
7713
7883
|
...optimizationCounts.keyedArrayFilterHints > 0 ? [
|
|
7714
7884
|
types.importSpecifier(
|
|
7715
|
-
keyedArrayFilterIdentifier,
|
|
7885
|
+
keyedArrayFilterIdentifier(),
|
|
7716
7886
|
types.identifier("createCompilerKeyedArrayFilter")
|
|
7717
7887
|
)
|
|
7718
7888
|
] : [],
|
|
7719
7889
|
...hasUnmappedKeyedArrayPrependHints ? [
|
|
7720
7890
|
types.importSpecifier(
|
|
7721
|
-
keyedArrayPrependIdentifier,
|
|
7891
|
+
keyedArrayPrependIdentifier(),
|
|
7722
7892
|
types.identifier(
|
|
7723
7893
|
hasKeyedArrayStructuralPrependHints ? "createCompilerKeyedArrayStructuralPrepend" : "createCompilerKeyedArrayPrepend"
|
|
7724
7894
|
)
|
|
@@ -7726,65 +7896,65 @@ async function compileReactModule(code, id, options) {
|
|
|
7726
7896
|
] : [],
|
|
7727
7897
|
...optimizationCounts.keyedArrayPositionHints > compilerUsage.keyedArrayBatchInsertHints + compilerUsage.keyedArrayWindowReplaceHints ? [
|
|
7728
7898
|
types.importSpecifier(
|
|
7729
|
-
keyedArrayPositionIdentifier,
|
|
7899
|
+
keyedArrayPositionIdentifier(),
|
|
7730
7900
|
types.identifier("createCompilerKeyedArrayPositionUpdate")
|
|
7731
7901
|
)
|
|
7732
7902
|
] : [],
|
|
7733
7903
|
...compilerUsage.keyedArrayBatchInsertHints > 0 ? [
|
|
7734
7904
|
types.importSpecifier(
|
|
7735
|
-
keyedArrayBatchInsertIdentifier,
|
|
7905
|
+
keyedArrayBatchInsertIdentifier(),
|
|
7736
7906
|
types.identifier("createCompilerKeyedArrayBatchInsert")
|
|
7737
7907
|
)
|
|
7738
7908
|
] : [],
|
|
7739
7909
|
...compilerUsage.keyedArrayWindowReplaceHints > 0 ? [
|
|
7740
7910
|
types.importSpecifier(
|
|
7741
|
-
keyedArrayWindowReplaceIdentifier,
|
|
7911
|
+
keyedArrayWindowReplaceIdentifier(),
|
|
7742
7912
|
types.identifier("createCompilerKeyedArrayWindowReplace")
|
|
7743
7913
|
)
|
|
7744
7914
|
] : [],
|
|
7745
7915
|
...optimizationCounts.keyedArrayReorderHints > compilerUsage.keyedArrayStructuralReorderHints + compilerUsage.keyedArrayMapReorderHints ? [
|
|
7746
7916
|
types.importSpecifier(
|
|
7747
|
-
keyedArrayReorderIdentifier,
|
|
7917
|
+
keyedArrayReorderIdentifier(),
|
|
7748
7918
|
types.identifier("createCompilerKeyedArrayReorder")
|
|
7749
7919
|
)
|
|
7750
7920
|
] : [],
|
|
7751
7921
|
...compilerUsage.keyedArrayStructuralReorderHints > 0 ? [
|
|
7752
7922
|
types.importSpecifier(
|
|
7753
|
-
keyedArrayStructuralReorderIdentifier,
|
|
7923
|
+
keyedArrayStructuralReorderIdentifier(),
|
|
7754
7924
|
types.identifier("createCompilerKeyedArrayStructuralReorder")
|
|
7755
7925
|
)
|
|
7756
7926
|
] : [],
|
|
7757
7927
|
...optimizationCounts.keyedArraySortHints > compilerUsage.keyedArrayStructuralSortHints + compilerUsage.keyedArrayMapSortHints ? [
|
|
7758
7928
|
types.importSpecifier(
|
|
7759
|
-
keyedArraySortIdentifier,
|
|
7929
|
+
keyedArraySortIdentifier(),
|
|
7760
7930
|
types.identifier("createCompilerKeyedArraySort")
|
|
7761
7931
|
)
|
|
7762
7932
|
] : [],
|
|
7763
7933
|
...compilerUsage.keyedArrayStructuralSortHints > 0 ? [
|
|
7764
7934
|
types.importSpecifier(
|
|
7765
|
-
keyedArrayStructuralSortIdentifier,
|
|
7935
|
+
keyedArrayStructuralSortIdentifier(),
|
|
7766
7936
|
types.identifier("createCompilerKeyedArrayStructuralSort")
|
|
7767
7937
|
)
|
|
7768
7938
|
] : [],
|
|
7769
7939
|
...optimizationCounts.keyedArrayRollingWindowHints > compilerUsage.keyedArrayMappedRollingWindowHints + compilerUsage.keyedArrayStructuralRollingWindowHints ? [
|
|
7770
7940
|
types.importSpecifier(
|
|
7771
|
-
keyedArrayRollingWindowIdentifier,
|
|
7941
|
+
keyedArrayRollingWindowIdentifier(),
|
|
7772
7942
|
types.identifier("createCompilerKeyedArrayRollingWindow")
|
|
7773
7943
|
)
|
|
7774
7944
|
] : [],
|
|
7775
7945
|
...optimizationCounts.keyedArraySliceHints > 0 || optimizationCounts.keyedArrayRollingWindowHints > 0 ? [
|
|
7776
7946
|
types.importSpecifier(
|
|
7777
|
-
keyedArraySliceIdentifier,
|
|
7947
|
+
keyedArraySliceIdentifier(),
|
|
7778
7948
|
types.identifier("createCompilerKeyedArraySlice")
|
|
7779
7949
|
)
|
|
7780
7950
|
] : [],
|
|
7781
7951
|
...optimizationCounts.keyedCollectionUpdateHints > 0 ? [
|
|
7782
7952
|
types.importSpecifier(
|
|
7783
|
-
keyedCollectionUpdateIdentifier,
|
|
7953
|
+
keyedCollectionUpdateIdentifier(),
|
|
7784
7954
|
types.identifier("createCompilerKeyedCollectionUpdate")
|
|
7785
7955
|
),
|
|
7786
7956
|
types.importSpecifier(
|
|
7787
|
-
keyedCollectionMutationIdentifier,
|
|
7957
|
+
keyedCollectionMutationIdentifier(),
|
|
7788
7958
|
types.identifier("applyCompilerKeyedCollectionMutation")
|
|
7789
7959
|
)
|
|
7790
7960
|
] : [],
|