@farm.js/react 0.1.0-beta.36 → 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 +33 -0
- package/dist/client.d.mts +0 -1
- package/dist/client.d.ts +0 -1
- package/dist/compiler-runtime.cjs +52 -128
- 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 +53 -125
- 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 +38 -186
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +38 -186
- package/dist/vite.mjs.map +1 -1
- package/package.json +3 -3
package/dist/server.d.mts
CHANGED
package/dist/server.d.ts
CHANGED
package/dist/vite.cjs
CHANGED
|
@@ -76,12 +76,9 @@ var COMPILER_RUNTIME_FEATURE_EXPORTS = {
|
|
|
76
76
|
"keyed-rows-hinted": "keyedRowsHintedRuntimeFeature",
|
|
77
77
|
"keyed-rows-append-only": "keyedRowsAppendOnlyRuntimeFeature",
|
|
78
78
|
"keyed-rows-position-hinted": "keyedRowsPositionHintedRuntimeFeature",
|
|
79
|
-
"keyed-rows-plain-position-hinted": "keyedRowsPlainPositionHintedRuntimeFeature",
|
|
80
79
|
"keyed-rows-batch-position-hinted": "keyedRowsBatchPositionHintedRuntimeFeature",
|
|
81
80
|
"keyed-rows-window-position-hinted": "keyedRowsWindowPositionHintedRuntimeFeature",
|
|
82
81
|
"keyed-rows-reorder-hinted": "keyedRowsReorderHintedRuntimeFeature",
|
|
83
|
-
"keyed-rows-plain-reorder-hinted": "keyedRowsPlainReorderHintedRuntimeFeature",
|
|
84
|
-
"keyed-rows-plain-map-reorder-hinted": "keyedRowsPlainMapReorderHintedRuntimeFeature",
|
|
85
82
|
"keyed-rows-map-reorder-hinted": "keyedRowsMapReorderHintedRuntimeFeature",
|
|
86
83
|
"keyed-rows-all-hinted": "keyedRowsAllHintedRuntimeFeature",
|
|
87
84
|
"keyed-rows-mapped-rolling-window-hinted": "keyedRowsMappedRollingWindowHintedRuntimeFeature",
|
|
@@ -188,12 +185,6 @@ function runtimeFeaturesForPlans(plans, keyedUpdateHints, keyedArrayFilterHints,
|
|
|
188
185
|
features.add("keyed-rows-filter-only");
|
|
189
186
|
} else if (keyedRowsFeature === "keyed-rows" && hintSuffix === "-prepend-hinted" && keyedTargetKinds.size === 0 && !keyedMapOrAppendHints) {
|
|
190
187
|
features.add("keyed-rows-prepend-only");
|
|
191
|
-
} else if (keyedRowsFeature === "keyed-rows" && hintSuffix === "-position-hinted" && keyedTargetKinds.size === 0) {
|
|
192
|
-
features.add("keyed-rows-plain-position-hinted");
|
|
193
|
-
} else if (keyedRowsFeature === "keyed-rows" && hintSuffix === "-reorder-hinted" && keyedTargetKinds.size === 0) {
|
|
194
|
-
features.add("keyed-rows-plain-reorder-hinted");
|
|
195
|
-
} else if (keyedRowsFeature === "keyed-rows" && hintSuffix === "-map-reorder-hinted" && keyedTargetKinds.size === 0) {
|
|
196
|
-
features.add("keyed-rows-plain-map-reorder-hinted");
|
|
197
188
|
} else if (keyedRowsFeature === "keyed-rows" && hintSuffix === "-filter-hinted" && keyedTargetKinds.size === 1 && keyedTargetKinds.has("identity")) {
|
|
198
189
|
features.add(
|
|
199
190
|
keyedMapOrAppendHints ? "keyed-rows-identity-filter-hinted" : "keyed-rows-identity-filter-only"
|
|
@@ -251,14 +242,6 @@ function collectStateDependencies(expression, statesByValue) {
|
|
|
251
242
|
return [...dependencies].sort((left, right) => left - right);
|
|
252
243
|
}
|
|
253
244
|
function referencesIdentifier(expression, name) {
|
|
254
|
-
let possible = false;
|
|
255
|
-
core.types.traverseFast(expression, (node) => {
|
|
256
|
-
if ((core.types.isIdentifier(node) || core.types.isJSXIdentifier(node)) && node.name === name) {
|
|
257
|
-
possible = true;
|
|
258
|
-
return core.types.traverseFast.stop;
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
if (!possible) return false;
|
|
262
245
|
let referenced = false;
|
|
263
246
|
core.traverse(expressionFile(cloneExpression(expression)), {
|
|
264
247
|
ReferencedIdentifier(path) {
|
|
@@ -338,10 +321,12 @@ function isPotentialKeyedMembershipCall(expression, reactiveByValue) {
|
|
|
338
321
|
}
|
|
339
322
|
function containsPotentialKeyedMembershipCall(expression, reactiveByValue) {
|
|
340
323
|
let found = false;
|
|
341
|
-
core.
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
324
|
+
core.traverse(expressionFile(cloneExpression(expression)), {
|
|
325
|
+
CallExpression(path) {
|
|
326
|
+
if (!isPotentialKeyedMembershipCall(path.node, reactiveByValue)) return;
|
|
327
|
+
found = true;
|
|
328
|
+
path.stop();
|
|
329
|
+
}
|
|
345
330
|
});
|
|
346
331
|
return found;
|
|
347
332
|
}
|
|
@@ -354,10 +339,12 @@ function isPotentialKeyedMapLookupCall(expression, reactiveByValue) {
|
|
|
354
339
|
}
|
|
355
340
|
function containsPotentialKeyedMapLookupCall(expression, reactiveByValue) {
|
|
356
341
|
let found = false;
|
|
357
|
-
core.
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
342
|
+
core.traverse(expressionFile(cloneExpression(expression)), {
|
|
343
|
+
CallExpression(path) {
|
|
344
|
+
if (!isPotentialKeyedMapLookupCall(path.node, reactiveByValue)) return;
|
|
345
|
+
found = true;
|
|
346
|
+
path.stop();
|
|
347
|
+
}
|
|
361
348
|
});
|
|
362
349
|
return found;
|
|
363
350
|
}
|
|
@@ -434,15 +421,6 @@ function keyedMapLookupTarget(binding, keyCallback, renderCallback, reactiveByVa
|
|
|
434
421
|
return valid && target && calls > 0 ? { dependency: target.index, value: core.types.identifier(target.valueName) } : void 0;
|
|
435
422
|
}
|
|
436
423
|
function collectReferencedLocals(expression, names) {
|
|
437
|
-
if (names.size === 0) return [];
|
|
438
|
-
let possible = false;
|
|
439
|
-
core.types.traverseFast(expression, (node) => {
|
|
440
|
-
if ((core.types.isIdentifier(node) || core.types.isJSXIdentifier(node)) && names.has(node.name)) {
|
|
441
|
-
possible = true;
|
|
442
|
-
return core.types.traverseFast.stop;
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
|
-
if (!possible) return [];
|
|
446
424
|
const references = /* @__PURE__ */ new Set();
|
|
447
425
|
core.traverse(expressionFile(cloneExpression(expression)), {
|
|
448
426
|
ReferencedIdentifier(path) {
|
|
@@ -454,7 +432,6 @@ function collectReferencedLocals(expression, names) {
|
|
|
454
432
|
return [...references];
|
|
455
433
|
}
|
|
456
434
|
function rewriteDerivedAccess(expression, derivedByName) {
|
|
457
|
-
if (derivedByName.size === 0) return cloneExpression(expression);
|
|
458
435
|
const file = expressionFile(cloneExpression(expression));
|
|
459
436
|
core.traverse(file, {
|
|
460
437
|
ReferencedIdentifier(path) {
|
|
@@ -713,7 +690,7 @@ function keyedMapUpdatePipeline(expression, parameterName, safeGlobals) {
|
|
|
713
690
|
return outerCallbacks.reverse();
|
|
714
691
|
}
|
|
715
692
|
function rewriteKeyedMapUpdateHints(root, hintedStateIndices, statesBySetter, helperIdentifier, safeGlobals) {
|
|
716
|
-
if (hintedStateIndices.size === 0) return { root, count: 0 };
|
|
693
|
+
if (hintedStateIndices.size === 0) return { root: core.types.cloneNode(root, true), count: 0 };
|
|
717
694
|
const file = expressionFile(core.types.cloneNode(root, true));
|
|
718
695
|
let count = 0;
|
|
719
696
|
core.traverse(file, {
|
|
@@ -785,7 +762,7 @@ function rewriteKeyedMapUpdateHints(root, hintedStateIndices, statesBySetter, he
|
|
|
785
762
|
};
|
|
786
763
|
}
|
|
787
764
|
function rewriteKeyedArrayAppendHints(root, hintedStateIndices, statesBySetter, helperIdentifier, safeGlobals) {
|
|
788
|
-
if (hintedStateIndices.size === 0) return { root, count: 0 };
|
|
765
|
+
if (hintedStateIndices.size === 0) return { root: core.types.cloneNode(root, true), count: 0 };
|
|
789
766
|
const file = expressionFile(core.types.cloneNode(root, true));
|
|
790
767
|
let count = 0;
|
|
791
768
|
core.traverse(file, {
|
|
@@ -857,7 +834,7 @@ function rewriteKeyedArrayAppendHints(root, hintedStateIndices, statesBySetter,
|
|
|
857
834
|
}
|
|
858
835
|
function rewriteKeyedArrayPrependHints(root, hintedStateIndices, statesBySetter, helperIdentifier, safeGlobals) {
|
|
859
836
|
if (hintedStateIndices.size === 0) {
|
|
860
|
-
return { root, count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
837
|
+
return { root: core.types.cloneNode(root, true), count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
861
838
|
}
|
|
862
839
|
const file = expressionFile(core.types.cloneNode(root, true));
|
|
863
840
|
const stateIndices = /* @__PURE__ */ new Set();
|
|
@@ -935,7 +912,7 @@ function rewriteKeyedArrayPrependHints(root, hintedStateIndices, statesBySetter,
|
|
|
935
912
|
}
|
|
936
913
|
function rewriteKeyedArrayRollingWindowHints(root, hintedStateIndices, statesBySetter, sliceHelperIdentifier, rollingWindowHelperIdentifier, safeGlobals) {
|
|
937
914
|
if (hintedStateIndices.size === 0) {
|
|
938
|
-
return { root, count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
915
|
+
return { root: core.types.cloneNode(root, true), count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
939
916
|
}
|
|
940
917
|
const file = expressionFile(core.types.cloneNode(root, true));
|
|
941
918
|
const stateIndices = /* @__PURE__ */ new Set();
|
|
@@ -1054,7 +1031,7 @@ function validateKeyedArrayPositionExpression(expression, safeGlobals) {
|
|
|
1054
1031
|
function rewriteKeyedArrayPositionHints(root, hintedStateIndices, statesBySetter, helperIdentifier, batchInsertHelperIdentifier, windowReplaceHelperIdentifier, safeGlobals) {
|
|
1055
1032
|
if (hintedStateIndices.size === 0) {
|
|
1056
1033
|
return {
|
|
1057
|
-
root,
|
|
1034
|
+
root: core.types.cloneNode(root, true),
|
|
1058
1035
|
count: 0,
|
|
1059
1036
|
batchInsertCount: 0,
|
|
1060
1037
|
windowReplaceCount: 0,
|
|
@@ -1151,7 +1128,7 @@ function rewriteKeyedArrayPositionHints(root, hintedStateIndices, statesBySetter
|
|
|
1151
1128
|
}
|
|
1152
1129
|
function rewriteKeyedArrayReorderHints(root, hintedStateIndices, statesBySetter, helperIdentifier) {
|
|
1153
1130
|
if (hintedStateIndices.size === 0) {
|
|
1154
|
-
return { root, count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
1131
|
+
return { root: core.types.cloneNode(root, true), count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
1155
1132
|
}
|
|
1156
1133
|
const file = expressionFile(core.types.cloneNode(root, true));
|
|
1157
1134
|
const stateIndices = /* @__PURE__ */ new Set();
|
|
@@ -1292,7 +1269,7 @@ function keyedArrayReorderPipeline(expression, parameterName, safeGlobals) {
|
|
|
1292
1269
|
function rewriteKeyedArrayReorderPipelineHints(root, hintedStateIndices, statesBySetter, filterHelperIdentifier, mapHelperIdentifier, mapReorderHelperIdentifier, mappedStructuralHelperIdentifier, reorderHelperIdentifier, structuralReorderHelperIdentifier, sliceHelperIdentifier, sortHelperIdentifier, structuralSortHelperIdentifier, safeGlobals, allowMapPipelines) {
|
|
1293
1270
|
if (hintedStateIndices.size === 0) {
|
|
1294
1271
|
return {
|
|
1295
|
-
root,
|
|
1272
|
+
root: core.types.cloneNode(root, true),
|
|
1296
1273
|
filterCount: 0,
|
|
1297
1274
|
mapCount: 0,
|
|
1298
1275
|
mapReorderCount: 0,
|
|
@@ -1482,7 +1459,7 @@ function rewriteKeyedArrayReorderPipelineHints(root, hintedStateIndices, statesB
|
|
|
1482
1459
|
};
|
|
1483
1460
|
}
|
|
1484
1461
|
function rewriteQueuedKeyedArrayReorderMapHints(root, statesBySetter, mapUpdateIdentifier, queuedMapPipelineIdentifier, mapReorderIdentifier, reorderIdentifier, sortIdentifier, structuralReorderIdentifier, structuralSortIdentifier, allowed) {
|
|
1485
|
-
if (!allowed) return { root, mapCount: 0 };
|
|
1462
|
+
if (!allowed) return { root: core.types.cloneNode(root, true), mapCount: 0 };
|
|
1486
1463
|
const file = expressionFile(core.types.cloneNode(root, true));
|
|
1487
1464
|
let mapCount = 0;
|
|
1488
1465
|
const containsHelperCall = (updater, helperNames) => {
|
|
@@ -1578,7 +1555,7 @@ function countKeyedArrayMapPipeline(updater, mapUpdateIdentifier) {
|
|
|
1578
1555
|
function rewriteQueuedKeyedArrayMappedStructuralHints(root, statesBySetter, mapUpdateIdentifier, queuedMapPipelineIdentifier, mappedStructuralIdentifier, filterIdentifier, sliceIdentifier, allowed) {
|
|
1579
1556
|
if (!allowed) {
|
|
1580
1557
|
return {
|
|
1581
|
-
root,
|
|
1558
|
+
root: core.types.cloneNode(root, true),
|
|
1582
1559
|
mapCount: 0,
|
|
1583
1560
|
structuralCount: 0,
|
|
1584
1561
|
stateIndices: /* @__PURE__ */ new Set()
|
|
@@ -1675,7 +1652,7 @@ function rewriteQueuedKeyedArrayMappedStructuralHints(root, statesBySetter, mapU
|
|
|
1675
1652
|
function rewriteQueuedKeyedArrayStructuralMapHints(root, statesBySetter, mapUpdateIdentifier, mapPipelineIdentifier, appendIdentifier, mappedStructuralAppendIdentifier, structuralAppendMapPipelineIdentifier, filterIdentifier, sliceIdentifier, mappedStructuralIdentifier, allowed) {
|
|
1676
1653
|
if (!allowed) {
|
|
1677
1654
|
return {
|
|
1678
|
-
root,
|
|
1655
|
+
root: core.types.cloneNode(root, true),
|
|
1679
1656
|
mapCount: 0,
|
|
1680
1657
|
mappedStructuralAppendCount: 0,
|
|
1681
1658
|
structuralAppendMapCount: 0,
|
|
@@ -1799,7 +1776,7 @@ function rewriteQueuedKeyedArrayStructuralMapHints(root, statesBySetter, mapUpda
|
|
|
1799
1776
|
function rewriteQueuedKeyedArrayStructuralPrependMapHints(root, statesBySetter, mapUpdateIdentifier, mapPipelineIdentifier, prependIdentifier, mappedStructuralPrependIdentifier, structuralPrependMapPipelineIdentifier, filterIdentifier, sliceIdentifier, mappedStructuralIdentifier, allowed) {
|
|
1800
1777
|
if (!allowed) {
|
|
1801
1778
|
return {
|
|
1802
|
-
root,
|
|
1779
|
+
root: core.types.cloneNode(root, true),
|
|
1803
1780
|
mapCount: 0,
|
|
1804
1781
|
mappedStructuralPrependCount: 0,
|
|
1805
1782
|
structuralPrependMapCount: 0,
|
|
@@ -1925,7 +1902,7 @@ function rewriteQueuedKeyedArrayRollingWindowMapHints(root, statesBySetter, mapU
|
|
|
1925
1902
|
return {
|
|
1926
1903
|
chainedMapCount: 0,
|
|
1927
1904
|
chainedRollingWindowCount: 0,
|
|
1928
|
-
root,
|
|
1905
|
+
root: core.types.cloneNode(root, true),
|
|
1929
1906
|
leadingMapCount: 0,
|
|
1930
1907
|
mappedRollingWindowCount: 0,
|
|
1931
1908
|
rollingWindowCount: 0,
|
|
@@ -2083,7 +2060,7 @@ function rewriteQueuedKeyedArrayRollingWindowMapHints(root, statesBySetter, mapU
|
|
|
2083
2060
|
function rewriteQueuedKeyedArrayStructuralReorderHints(root, statesBySetter, filterIdentifier, sliceIdentifier, mapPipelineIdentifier, queuedMapPipelineIdentifier, mappedStructuralIdentifier, mapReorderIdentifier, reorderIdentifier, sortIdentifier, structuralReorderIdentifier, structuralSortIdentifier, allowed) {
|
|
2084
2061
|
if (!allowed) {
|
|
2085
2062
|
return {
|
|
2086
|
-
root,
|
|
2063
|
+
root: core.types.cloneNode(root, true),
|
|
2087
2064
|
reorderCount: 0,
|
|
2088
2065
|
sortCount: 0,
|
|
2089
2066
|
replacedMapReorderCount: 0,
|
|
@@ -2213,7 +2190,7 @@ function rewriteQueuedKeyedArrayStructuralReorderHints(root, statesBySetter, fil
|
|
|
2213
2190
|
function rewriteQueuedKeyedArrayMapReorderHints(root, statesBySetter, mapUpdateIdentifier, queuedMapPipelineIdentifier, mapReorderIdentifier, reorderIdentifier, sortIdentifier, structuralReorderIdentifier, structuralSortIdentifier, allowed) {
|
|
2214
2191
|
if (!allowed) {
|
|
2215
2192
|
return {
|
|
2216
|
-
root,
|
|
2193
|
+
root: core.types.cloneNode(root, true),
|
|
2217
2194
|
mapCount: 0,
|
|
2218
2195
|
mapReorderCount: 0,
|
|
2219
2196
|
mapSortCount: 0
|
|
@@ -2326,7 +2303,7 @@ function rewriteQueuedKeyedArrayMapReorderHints(root, statesBySetter, mapUpdateI
|
|
|
2326
2303
|
}
|
|
2327
2304
|
function rewriteKeyedArraySortHints(root, hintedStateIndices, statesBySetter, helperIdentifier, safeGlobals) {
|
|
2328
2305
|
if (hintedStateIndices.size === 0) {
|
|
2329
|
-
return { root, count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
2306
|
+
return { root: core.types.cloneNode(root, true), count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
2330
2307
|
}
|
|
2331
2308
|
const file = expressionFile(core.types.cloneNode(root, true));
|
|
2332
2309
|
const stateIndices = /* @__PURE__ */ new Set();
|
|
@@ -2386,7 +2363,7 @@ function rewriteKeyedArraySortHints(root, hintedStateIndices, statesBySetter, he
|
|
|
2386
2363
|
}
|
|
2387
2364
|
function rewriteKeyedArraySliceHints(root, hintedStateIndices, statesBySetter, helperIdentifier, safeGlobals) {
|
|
2388
2365
|
if (hintedStateIndices.size === 0) {
|
|
2389
|
-
return { root, count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
2366
|
+
return { root: core.types.cloneNode(root, true), count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
2390
2367
|
}
|
|
2391
2368
|
const file = expressionFile(core.types.cloneNode(root, true));
|
|
2392
2369
|
const stateIndices = /* @__PURE__ */ new Set();
|
|
@@ -2448,7 +2425,7 @@ function rewriteKeyedArraySliceHints(root, hintedStateIndices, statesBySetter, h
|
|
|
2448
2425
|
}
|
|
2449
2426
|
function rewriteKeyedArrayFilterHints(root, hintedStateIndices, statesBySetter, helperIdentifier, safeGlobals) {
|
|
2450
2427
|
if (hintedStateIndices.size === 0) {
|
|
2451
|
-
return { root, count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
2428
|
+
return { root: core.types.cloneNode(root, true), count: 0, stateIndices: /* @__PURE__ */ new Set() };
|
|
2452
2429
|
}
|
|
2453
2430
|
const file = expressionFile(core.types.cloneNode(root, true));
|
|
2454
2431
|
const stateIndices = /* @__PURE__ */ new Set();
|
|
@@ -2753,7 +2730,7 @@ function prepareKeyedCollectionUpdater(updater, kind, updateHelper, mutationHelp
|
|
|
2753
2730
|
return core.types.isArrowFunctionExpression(prepared) || core.types.isFunctionExpression(prepared) ? { updater: prepared, mutations } : void 0;
|
|
2754
2731
|
}
|
|
2755
2732
|
function rewriteKeyedCollectionUpdateHints(root, targetKinds, states, statesBySetter, updateHelper, mutationHelper, globalCollections) {
|
|
2756
|
-
if (targetKinds.size === 0) return { root, count: 0 };
|
|
2733
|
+
if (targetKinds.size === 0) return { root: core.types.cloneNode(root, true), count: 0 };
|
|
2757
2734
|
const file = expressionFile(core.types.cloneNode(root, true));
|
|
2758
2735
|
let count = 0;
|
|
2759
2736
|
for (const [stateIndex, kind] of targetKinds) {
|
|
@@ -3288,45 +3265,6 @@ function stabilizeDeferredEventCurrentTargets(root, compilerSetters) {
|
|
|
3288
3265
|
const expression = file.program.body[0].expression;
|
|
3289
3266
|
return core.types.isJSXElement(expression) ? expression : core.types.cloneNode(root, true);
|
|
3290
3267
|
}
|
|
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 (core.types.isJSXIdentifier(name) && (name.name === "svg" || name.name === "math")) depth++;
|
|
3314
|
-
},
|
|
3315
|
-
exit(path) {
|
|
3316
|
-
const name = path.node.openingElement.name;
|
|
3317
|
-
if (core.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 || core.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") && !core.types.isStringLiteral(attribute.value);
|
|
3329
|
-
}
|
|
3330
3268
|
function analyzeKeyedRowTree(row, renderCallback, safeGlobals, compilerSetters, keyedTargetReactiveByValue) {
|
|
3331
3269
|
if (renderCallback.async || renderCallback.generator || renderCallback.params.length < 1 || renderCallback.params.length > 2 || !core.types.isIdentifier(renderCallback.params[0]) || renderCallback.params[1] !== void 0 && !core.types.isIdentifier(renderCallback.params[1])) {
|
|
3332
3270
|
return {
|
|
@@ -3346,7 +3284,7 @@ function analyzeKeyedRowTree(row, renderCallback, safeGlobals, compilerSetters,
|
|
|
3346
3284
|
if (!core.types.isJSXIdentifier(tag) || !/^[a-z]/.test(tag.name)) {
|
|
3347
3285
|
return "compiled keyed rows support host elements only";
|
|
3348
3286
|
}
|
|
3349
|
-
if (
|
|
3287
|
+
if (tag.name === "svg") return "compiled keyed rows do not support SVG yet";
|
|
3350
3288
|
const attributeNames = new Set(
|
|
3351
3289
|
element.openingElement.attributes.filter((attribute) => core.types.isJSXAttribute(attribute)).map(jsxAttributeName).filter((name) => name !== void 0)
|
|
3352
3290
|
);
|
|
@@ -3376,7 +3314,7 @@ function analyzeKeyedRowTree(row, renderCallback, safeGlobals, compilerSetters,
|
|
|
3376
3314
|
}
|
|
3377
3315
|
const name = jsxAttributeName(attribute);
|
|
3378
3316
|
if (!name) return "compiled keyed rows do not support namespaced JSX attributes";
|
|
3379
|
-
if (name === "ref" || name === "dangerouslySetInnerHTML"
|
|
3317
|
+
if (name === "ref" || name === "dangerouslySetInnerHTML") {
|
|
3380
3318
|
return `compiled keyed row ${name} requires React ownership`;
|
|
3381
3319
|
}
|
|
3382
3320
|
if (name === "key") continue;
|
|
@@ -3744,7 +3682,7 @@ function analyzeHostConditionalTree(branch, safeGlobals, allowStaticEvents = fal
|
|
|
3744
3682
|
if (!core.types.isJSXIdentifier(tag) || !/^[a-z]/.test(tag.name)) {
|
|
3745
3683
|
return "compiler-owned conditionals support host elements only";
|
|
3746
3684
|
}
|
|
3747
|
-
if (
|
|
3685
|
+
if (tag.name === "svg") return "compiler-owned conditionals do not support SVG yet";
|
|
3748
3686
|
for (const attribute of element.openingElement.attributes) {
|
|
3749
3687
|
if (core.types.isJSXSpreadAttribute(attribute)) {
|
|
3750
3688
|
if (statefulOnly && !needsStaticBinding(attribute.argument)) continue;
|
|
@@ -3752,9 +3690,6 @@ function analyzeHostConditionalTree(branch, safeGlobals, allowStaticEvents = fal
|
|
|
3752
3690
|
}
|
|
3753
3691
|
const name = jsxAttributeName(attribute);
|
|
3754
3692
|
if (!name) return "compiler-owned conditionals do not support namespaced JSX attributes";
|
|
3755
|
-
if (reactOwnedAttribute(name, attribute)) {
|
|
3756
|
-
return `compiler-owned conditional ${name} requires React ownership`;
|
|
3757
|
-
}
|
|
3758
3693
|
if (name === "ref" || name === "dangerouslySetInnerHTML" || name === "key") {
|
|
3759
3694
|
if (statefulOnly && (!core.types.isJSXExpressionContainer(attribute.value) || core.types.isJSXEmptyExpression(attribute.value.expression) || !needsStaticBinding(attribute.value.expression))) {
|
|
3760
3695
|
continue;
|
|
@@ -3867,18 +3802,13 @@ function analyzeRecursiveHostTree(branch, statesByValue, safeGlobals, listNames,
|
|
|
3867
3802
|
if (!core.types.isJSXIdentifier(tag) || !/^[a-z]/.test(tag.name)) {
|
|
3868
3803
|
return "recursive compiler-owned blocks support host elements only";
|
|
3869
3804
|
}
|
|
3870
|
-
if (
|
|
3871
|
-
return "recursive compiler-owned blocks do not support SVG yet";
|
|
3872
|
-
}
|
|
3805
|
+
if (tag.name === "svg") return "recursive compiler-owned blocks do not support SVG yet";
|
|
3873
3806
|
for (const attribute of element.openingElement.attributes) {
|
|
3874
3807
|
if (core.types.isJSXSpreadAttribute(attribute)) {
|
|
3875
3808
|
return "recursive compiler-owned blocks do not support JSX attribute spreads";
|
|
3876
3809
|
}
|
|
3877
3810
|
const name = jsxAttributeName(attribute);
|
|
3878
3811
|
if (!name) return "recursive compiler-owned blocks do not support namespaced attributes";
|
|
3879
|
-
if (reactOwnedAttribute(name, attribute)) {
|
|
3880
|
-
return `recursive compiler-owned block ${name} requires React ownership`;
|
|
3881
|
-
}
|
|
3882
3812
|
if (name === "ref" || name === "dangerouslySetInnerHTML" || name === "key") {
|
|
3883
3813
|
return `recursive compiler-owned block ${name} requires React ownership`;
|
|
3884
3814
|
}
|
|
@@ -4239,7 +4169,7 @@ function analyzeCompilerOwnedKeyedRowHostBlocks(shape, statesByValue, safeGlobal
|
|
|
4239
4169
|
}
|
|
4240
4170
|
function analyzeHostConditionalContainer(container, statesByValue, safeGlobals, listNames, parent, allocateId) {
|
|
4241
4171
|
const containerName = container.openingElement.name;
|
|
4242
|
-
if (!core.types.isJSXIdentifier(containerName) || !/^[a-z]/.test(containerName.name) ||
|
|
4172
|
+
if (!core.types.isJSXIdentifier(containerName) || !/^[a-z]/.test(containerName.name) || containerName.name === "svg") {
|
|
4243
4173
|
return void 0;
|
|
4244
4174
|
}
|
|
4245
4175
|
if (container.openingElement.attributes.some(
|
|
@@ -4304,7 +4234,7 @@ function analyzeHostConditionalContainer(container, statesByValue, safeGlobals,
|
|
|
4304
4234
|
}
|
|
4305
4235
|
function analyzeConditionalRangesContainer(container, statesByValue, safeGlobals, allowSingleRange, listNames, parent, allocateId) {
|
|
4306
4236
|
const containerName = container.openingElement.name;
|
|
4307
|
-
if (!core.types.isJSXIdentifier(containerName) || !/^[a-z]/.test(containerName.name) ||
|
|
4237
|
+
if (!core.types.isJSXIdentifier(containerName) || !/^[a-z]/.test(containerName.name) || containerName.name === "svg" || container.openingElement.attributes.some(
|
|
4308
4238
|
(attribute) => core.types.isJSXSpreadAttribute(attribute) || core.types.isJSXAttribute(attribute) && core.types.isJSXIdentifier(attribute.name) && (attribute.name.name === "ref" || attribute.name.name === "dangerouslySetInnerHTML")
|
|
4309
4239
|
)) {
|
|
4310
4240
|
return void 0;
|
|
@@ -4400,7 +4330,7 @@ function analyzeConditionalRangesContainer(container, statesByValue, safeGlobals
|
|
|
4400
4330
|
}
|
|
4401
4331
|
function analyzeMixedRangesContainer(container, statesByValue, safeGlobals, listNames, parent, allocateId) {
|
|
4402
4332
|
const containerName = container.openingElement.name;
|
|
4403
|
-
if (!core.types.isJSXIdentifier(containerName) || !/^[a-z]/.test(containerName.name) ||
|
|
4333
|
+
if (!core.types.isJSXIdentifier(containerName) || !/^[a-z]/.test(containerName.name) || containerName.name === "svg" || container.openingElement.attributes.some(
|
|
4404
4334
|
(attribute) => core.types.isJSXSpreadAttribute(attribute) || core.types.isJSXAttribute(attribute) && core.types.isJSXIdentifier(attribute.name) && (attribute.name.name === "ref" || attribute.name.name === "dangerouslySetInnerHTML")
|
|
4405
4335
|
)) {
|
|
4406
4336
|
return void 0;
|
|
@@ -4952,57 +4882,6 @@ function canCloneKeyedRows(plan) {
|
|
|
4952
4882
|
};
|
|
4953
4883
|
return cloneable(plan.row);
|
|
4954
4884
|
}
|
|
4955
|
-
function keyedRowBindingTargets(plan) {
|
|
4956
|
-
if (!canCloneKeyedRows(plan)) return void 0;
|
|
4957
|
-
const root = core.types.identifier("row");
|
|
4958
|
-
const targets = /* @__PURE__ */ new Map([["", root]]);
|
|
4959
|
-
const statements = [];
|
|
4960
|
-
let independentReads = 0;
|
|
4961
|
-
for (const binding of plan.bindings) {
|
|
4962
|
-
const path = [];
|
|
4963
|
-
for (const index of binding.path) {
|
|
4964
|
-
independentReads += index + 1;
|
|
4965
|
-
for (let sibling = 0; sibling <= index; sibling += 1) {
|
|
4966
|
-
const key = [...path, sibling].join(".");
|
|
4967
|
-
if (targets.has(key)) continue;
|
|
4968
|
-
if (statements.length === 32) return void 0;
|
|
4969
|
-
const parent = targets.get(
|
|
4970
|
-
sibling === 0 ? path.join(".") : [...path, sibling - 1].join(".")
|
|
4971
|
-
);
|
|
4972
|
-
const target = core.types.identifier(`target${statements.length}`);
|
|
4973
|
-
statements.push(
|
|
4974
|
-
core.types.variableDeclaration("const", [
|
|
4975
|
-
core.types.variableDeclarator(
|
|
4976
|
-
target,
|
|
4977
|
-
core.types.optionalMemberExpression(
|
|
4978
|
-
parent,
|
|
4979
|
-
core.types.identifier(sibling === 0 ? "firstElementChild" : "nextElementSibling"),
|
|
4980
|
-
false,
|
|
4981
|
-
true
|
|
4982
|
-
)
|
|
4983
|
-
)
|
|
4984
|
-
])
|
|
4985
|
-
);
|
|
4986
|
-
targets.set(key, target);
|
|
4987
|
-
}
|
|
4988
|
-
path.push(index);
|
|
4989
|
-
}
|
|
4990
|
-
}
|
|
4991
|
-
if (statements.length >= independentReads) return void 0;
|
|
4992
|
-
return core.types.arrowFunctionExpression(
|
|
4993
|
-
[root],
|
|
4994
|
-
core.types.blockStatement([
|
|
4995
|
-
...statements,
|
|
4996
|
-
core.types.returnStatement(
|
|
4997
|
-
core.types.arrayExpression(
|
|
4998
|
-
plan.bindings.map(
|
|
4999
|
-
(binding) => core.types.logicalExpression("??", targets.get(binding.path.join(".")), core.types.nullLiteral())
|
|
5000
|
-
)
|
|
5001
|
-
)
|
|
5002
|
-
)
|
|
5003
|
-
])
|
|
5004
|
-
);
|
|
5005
|
-
}
|
|
5006
4885
|
function keyedRowsBoundary(blockRuntime, plan, keyedMapUpdateHints, keyedArrayFilterHintedStateIndices, keyedArrayPrependHintedStateIndices, keyedArrayPositionHintedStateIndices, keyedArrayReorderHintedStateIndices) {
|
|
5007
4886
|
const name = core.types.jsxMemberExpression(
|
|
5008
4887
|
core.types.jsxIdentifier(blockRuntime.name),
|
|
@@ -5020,7 +4899,6 @@ function keyedRowsBoundary(blockRuntime, plan, keyedMapUpdateHints, keyedArrayFi
|
|
|
5020
4899
|
...plan.conditionals.map((conditional) => conditional.test)
|
|
5021
4900
|
]);
|
|
5022
4901
|
const delegatedEvents = canDelegateKeyedRowEvents(plan);
|
|
5023
|
-
const bindingTargets = keyedRowBindingTargets(plan);
|
|
5024
4902
|
const renderSource = keyedRowsRenderSource(plan, eventFactory, conditionalFactory);
|
|
5025
4903
|
const renderFactoryParameters = plan.conditionals.length > 0 ? [core.types.cloneNode(eventFactory), core.types.cloneNode(conditionalFactory)] : plan.events.length > 0 ? [core.types.cloneNode(eventFactory)] : [];
|
|
5026
4904
|
return core.types.jsxElement(
|
|
@@ -5141,7 +5019,6 @@ function keyedRowsBoundary(blockRuntime, plan, keyedMapUpdateHints, keyedArrayFi
|
|
|
5141
5019
|
core.types.jsxExpressionContainer(core.types.booleanLiteral(true))
|
|
5142
5020
|
)
|
|
5143
5021
|
] : [],
|
|
5144
|
-
...bindingTargets ? [core.types.jsxAttribute(core.types.jsxIdentifier("targets"), core.types.jsxExpressionContainer(bindingTargets))] : [],
|
|
5145
5022
|
...canCloneKeyedRows(plan) ? [
|
|
5146
5023
|
core.types.jsxAttribute(
|
|
5147
5024
|
core.types.jsxIdentifier("cloneRows"),
|
|
@@ -7585,7 +7462,6 @@ async function compileReactModule(code, id, options) {
|
|
|
7585
7462
|
visitor: {
|
|
7586
7463
|
Program(programPath) {
|
|
7587
7464
|
const moduleDirectives = new Set(directiveValues(programPath.node));
|
|
7588
|
-
markForeignContent(programPath);
|
|
7589
7465
|
const useStateNames = /* @__PURE__ */ new Set();
|
|
7590
7466
|
const reactNames = /* @__PURE__ */ new Set();
|
|
7591
7467
|
const listNames = /* @__PURE__ */ new Set();
|
|
@@ -7610,10 +7486,6 @@ async function compileReactModule(code, id, options) {
|
|
|
7610
7486
|
}
|
|
7611
7487
|
const candidates = collectCandidates(programPath);
|
|
7612
7488
|
const createComponentIdentifier = programPath.scope.generateUidIdentifier("createCompiledComponent");
|
|
7613
|
-
const createRefreshComponentIdentifier = programPath.scope.generateUidIdentifier("createRefreshComponent");
|
|
7614
|
-
const createProductionComponentIdentifier = programPath.scope.generateUidIdentifier(
|
|
7615
|
-
"createProductionComponent"
|
|
7616
|
-
);
|
|
7617
7489
|
const keyedMapUpdateIdentifier = programPath.scope.generateUidIdentifier(
|
|
7618
7490
|
"createCompilerKeyedMapUpdate"
|
|
7619
7491
|
);
|
|
@@ -7758,34 +7630,14 @@ async function compileReactModule(code, id, options) {
|
|
|
7758
7630
|
const hasKeyedArrayStructuralPrependHints = optimizationCounts.keyedArrayPrependHints > 0 && (optimizationCounts.keyedArrayFilterHints > 0 || optimizationCounts.keyedArraySliceHints > 0);
|
|
7759
7631
|
const hasUnmappedKeyedArrayPrependHints = optimizationCounts.keyedArrayPrependHints > compilerUsage.keyedArrayMappedStructuralPrependHints;
|
|
7760
7632
|
if (compiled.length > 0) {
|
|
7761
|
-
programPath.unshiftContainer(
|
|
7762
|
-
"body",
|
|
7763
|
-
core.types.variableDeclaration("const", [
|
|
7764
|
-
core.types.variableDeclarator(
|
|
7765
|
-
core.types.cloneNode(createComponentIdentifier),
|
|
7766
|
-
core.types.conditionalExpression(
|
|
7767
|
-
core.types.memberExpression(
|
|
7768
|
-
core.types.metaProperty(core.types.identifier("import"), core.types.identifier("meta")),
|
|
7769
|
-
core.types.identifier("hot")
|
|
7770
|
-
),
|
|
7771
|
-
core.types.cloneNode(createRefreshComponentIdentifier),
|
|
7772
|
-
core.types.cloneNode(createProductionComponentIdentifier)
|
|
7773
|
-
)
|
|
7774
|
-
)
|
|
7775
|
-
])
|
|
7776
|
-
);
|
|
7777
7633
|
programPath.unshiftContainer(
|
|
7778
7634
|
"body",
|
|
7779
7635
|
core.types.importDeclaration(
|
|
7780
7636
|
[
|
|
7781
7637
|
core.types.importSpecifier(
|
|
7782
|
-
|
|
7638
|
+
createComponentIdentifier,
|
|
7783
7639
|
core.types.identifier("createCompiledComponentWithFeatures")
|
|
7784
7640
|
),
|
|
7785
|
-
core.types.importSpecifier(
|
|
7786
|
-
createProductionComponentIdentifier,
|
|
7787
|
-
core.types.identifier("createCompiledComponentWithoutRefresh")
|
|
7788
|
-
),
|
|
7789
7641
|
...optimizationCounts.keyedMapUpdateHints > compilerUsage.keyedArrayMapUpdateHints ? [
|
|
7790
7642
|
core.types.importSpecifier(
|
|
7791
7643
|
keyedMapUpdateIdentifier,
|