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