@farm.js/react 0.1.0-beta.21 → 0.1.0-beta.22
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 +27 -12
- package/dist/compiler-runtime.cjs +285 -231
- package/dist/compiler-runtime.cjs.map +1 -1
- package/dist/compiler-runtime.d.mts +5 -0
- package/dist/compiler-runtime.d.ts +5 -0
- package/dist/compiler-runtime.mjs +285 -231
- package/dist/compiler-runtime.mjs.map +1 -1
- package/dist/index.cjs +25 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.mjs +25 -2
- package/dist/index.mjs.map +1 -1
- package/dist/list.cjs +6 -0
- package/dist/list.cjs.map +1 -1
- package/dist/list.mjs +6 -0
- package/dist/list.mjs.map +1 -1
- package/dist/vite.cjs +43 -8
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +43 -8
- package/dist/vite.mjs.map +1 -1
- package/package.json +3 -3
package/dist/vite.mjs
CHANGED
|
@@ -4785,6 +4785,19 @@ function keyedRowConditionalObject(conditional, parameters) {
|
|
|
4785
4785
|
}
|
|
4786
4786
|
return types.objectExpression(properties);
|
|
4787
4787
|
}
|
|
4788
|
+
var UNCLONEABLE_KEYED_ROW_TAGS = /* @__PURE__ */ new Set(["input", "option", "select", "textarea"]);
|
|
4789
|
+
function canCloneKeyedRows(plan) {
|
|
4790
|
+
if (plan.descriptorBlocks?.size || plan.conditionals.length > 0) return false;
|
|
4791
|
+
if (plan.bindings.some((binding) => binding.kind === "style")) return false;
|
|
4792
|
+
const cloneable = (element) => {
|
|
4793
|
+
const tag = element.openingElement.name;
|
|
4794
|
+
if (!types.isJSXIdentifier(tag) || tag.name.includes("-") || UNCLONEABLE_KEYED_ROW_TAGS.has(tag.name)) {
|
|
4795
|
+
return false;
|
|
4796
|
+
}
|
|
4797
|
+
return element.children.every((child) => !types.isJSXElement(child) || cloneable(child));
|
|
4798
|
+
};
|
|
4799
|
+
return cloneable(plan.row);
|
|
4800
|
+
}
|
|
4788
4801
|
function keyedRowsBoundary(blockRuntime, plan, keyedMapUpdateHints, keyedArrayFilterHintedStateIndices, keyedArrayPrependHintedStateIndices, keyedArrayPositionHintedStateIndices, keyedArrayReorderHintedStateIndices) {
|
|
4789
4802
|
const name = types.jsxMemberExpression(
|
|
4790
4803
|
types.jsxIdentifier(blockRuntime.name),
|
|
@@ -4921,6 +4934,12 @@ function keyedRowsBoundary(blockRuntime, plan, keyedMapUpdateHints, keyedArrayFi
|
|
|
4921
4934
|
types.jsxIdentifier("hostBlocks"),
|
|
4922
4935
|
types.jsxExpressionContainer(types.booleanLiteral(true))
|
|
4923
4936
|
)
|
|
4937
|
+
] : [],
|
|
4938
|
+
...canCloneKeyedRows(plan) ? [
|
|
4939
|
+
types.jsxAttribute(
|
|
4940
|
+
types.jsxIdentifier("cloneRows"),
|
|
4941
|
+
types.jsxExpressionContainer(types.booleanLiteral(true))
|
|
4942
|
+
)
|
|
4924
4943
|
] : []
|
|
4925
4944
|
],
|
|
4926
4945
|
true
|
|
@@ -7702,6 +7721,29 @@ async function compileReactModule(code, id, options) {
|
|
|
7702
7721
|
optimizations: optimizationCounts
|
|
7703
7722
|
};
|
|
7704
7723
|
}
|
|
7724
|
+
|
|
7725
|
+
// src/compiler-options.ts
|
|
7726
|
+
var warnedExperimentalCompiler = false;
|
|
7727
|
+
function resolveCompilerOption(options = {}, warnDeprecated = false) {
|
|
7728
|
+
const experimental = options.experimental;
|
|
7729
|
+
const legacy = experimental && typeof experimental === "object" ? experimental.compiler : void 0;
|
|
7730
|
+
if (legacy !== void 0 && options.compiler !== void 0) {
|
|
7731
|
+
throw new TypeError(
|
|
7732
|
+
"Configure the React compiler with `compiler` only; remove `experimental.compiler`."
|
|
7733
|
+
);
|
|
7734
|
+
}
|
|
7735
|
+
const compiler = legacy === void 0 ? options.compiler : legacy;
|
|
7736
|
+
if (compiler !== void 0 && typeof compiler !== "boolean" && (compiler === null || typeof compiler !== "object" || Array.isArray(compiler))) {
|
|
7737
|
+
throw new TypeError("React compiler must be a boolean or compiler options object.");
|
|
7738
|
+
}
|
|
7739
|
+
if (legacy !== void 0 && warnDeprecated && !warnedExperimentalCompiler) {
|
|
7740
|
+
warnedExperimentalCompiler = true;
|
|
7741
|
+
console.warn(
|
|
7742
|
+
"[farm] `react({ experimental: { compiler } })` is deprecated. Use `react({ compiler })`."
|
|
7743
|
+
);
|
|
7744
|
+
}
|
|
7745
|
+
return compiler;
|
|
7746
|
+
}
|
|
7705
7747
|
function projectRelativeId(projectRoot, id) {
|
|
7706
7748
|
return relative(projectRoot, id).replace(/\\/g, "/");
|
|
7707
7749
|
}
|
|
@@ -7871,16 +7913,9 @@ function normalizeReactCompilerOptions(value) {
|
|
|
7871
7913
|
|
|
7872
7914
|
// src/vite.ts
|
|
7873
7915
|
function readCompilerOptions(rendererOptions) {
|
|
7874
|
-
const
|
|
7875
|
-
if (!experimental || typeof experimental !== "object") return false;
|
|
7876
|
-
const compiler = experimental.compiler;
|
|
7916
|
+
const compiler = resolveCompilerOption(rendererOptions);
|
|
7877
7917
|
if (!compiler) return false;
|
|
7878
7918
|
if (compiler === true) return normalizeReactCompilerOptions(true);
|
|
7879
|
-
if (typeof compiler !== "object") {
|
|
7880
|
-
throw new TypeError(
|
|
7881
|
-
"React experimental.compiler must be a boolean or compiler options object."
|
|
7882
|
-
);
|
|
7883
|
-
}
|
|
7884
7919
|
const normalized = compiler;
|
|
7885
7920
|
if ((normalized.mode === "infer" || normalized.mode === "annotation") && typeof normalized.directive === "string" && (normalized.reactivity === "static" || normalized.reactivity === "hybrid") && (normalized.onUnsupported === "fallback" || normalized.onUnsupported === "warn" || normalized.onUnsupported === "error")) {
|
|
7886
7921
|
return normalized;
|