@farm.js/react 0.1.0-beta.35 → 0.1.0-beta.36
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 +16 -0
- package/dist/compiler-runtime.cjs +28 -17
- package/dist/compiler-runtime.cjs.map +1 -1
- package/dist/compiler-runtime.d.mts +8 -1
- package/dist/compiler-runtime.d.ts +8 -1
- package/dist/compiler-runtime.mjs +28 -18
- package/dist/compiler-runtime.mjs.map +1 -1
- package/dist/vite.cjs +37 -11
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +37 -11
- package/dist/vite.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -57,6 +57,11 @@ automatic and does not add a configuration option or asynchronous runtime loadin
|
|
|
57
57
|
`createCompiledComponent` export remains a complete compatibility entry for hand-authored
|
|
58
58
|
definitions, while generated code uses the tree-shakable feature entry.
|
|
59
59
|
|
|
60
|
+
Generated code also selects refresh support through `import.meta.hot`. Production bundles can
|
|
61
|
+
remove the development refresh registry and compatibility checks; development retains
|
|
62
|
+
state-preserving refresh. Both entries share the same component runtime, including SSR, hydration,
|
|
63
|
+
DOM ownership, and fallback behavior. Existing hand-authored runtime entries retain refresh support.
|
|
64
|
+
|
|
60
65
|
Plain keyed lists with filter hints and only identity-based selection also use the single-kind
|
|
61
66
|
target runtime. Filtering keeps its existing native-method checks and fallback; mixed Set/Map
|
|
62
67
|
targets, conditional rows, and nested host blocks keep their existing runtime capabilities.
|
|
@@ -128,6 +133,10 @@ refreshes only changed React-owned row-local branches. React still creates or hy
|
|
|
128
133
|
DOM. Anything outside those narrow contracts uses a small React-owned boundary or the complete
|
|
129
134
|
original component.
|
|
130
135
|
|
|
136
|
+
Compiler-owned structural updates stay disabled inside SVG and MathML, including shared
|
|
137
|
+
HTML/SVG tag names such as `a` and `title`. React retains namespace-sensitive element creation
|
|
138
|
+
when rows are appended or conditional branches change; ordinary HTML rows remain eligible.
|
|
139
|
+
|
|
131
140
|
For a common dedicated conditional, no new component or annotation is required:
|
|
132
141
|
|
|
133
142
|
```tsx
|
|
@@ -1189,6 +1198,13 @@ second component render and commit, while the compiled component remains at one
|
|
|
1189
1198
|
commit and updates its two bindings directly. This is a deterministic structural performance
|
|
1190
1199
|
assertion; it is not presented as a cross-machine timing benchmark.
|
|
1191
1200
|
|
|
1201
|
+
`pnpm --filter @farm.js/react test:runtime-size` checks both gzip and Brotli compiler premiums
|
|
1202
|
+
against `RUNTIME_SIZE_RESULTS.json`, including plain keyed lists and the isolated core runtime.
|
|
1203
|
+
Missing or non-finite budget inputs and fixtures without an explicit budget policy fail the check.
|
|
1204
|
+
When intentionally adding or changing a baseline, generate it with
|
|
1205
|
+
`pnpm --filter @farm.js/react benchmark:runtime-size` and review the byte changes before committing;
|
|
1206
|
+
do not regenerate baselines just to hide a regression. These checks do not change application output.
|
|
1207
|
+
|
|
1192
1208
|
Application and prototype calls, dynamic style objects, handlers outside JSX events, nested,
|
|
1193
1209
|
computed, and rest props patterns, async handlers, unkeyed or index-keyed lists, unsupported map
|
|
1194
1210
|
chains, unsupported conditional roots, effects, and more advanced hook support intentionally stay
|
|
@@ -1583,13 +1583,13 @@ function createCompilerKeyedCollectionUpdate(previous, value, kind) {
|
|
|
1583
1583
|
return value;
|
|
1584
1584
|
}
|
|
1585
1585
|
var delegatedRowChangePlaceholder = () => void 0;
|
|
1586
|
-
var COMPILER_HMR_REGISTRY = /* @__PURE__ */ Symbol.for("@farm.js/react/compiler-hmr-registry");
|
|
1587
1586
|
function getCompilerHmrRegistry() {
|
|
1587
|
+
const registryKey = /* @__PURE__ */ Symbol.for("@farm.js/react/compiler-hmr-registry");
|
|
1588
1588
|
const globalTarget = globalThis;
|
|
1589
|
-
const existing = globalTarget[
|
|
1589
|
+
const existing = globalTarget[registryKey];
|
|
1590
1590
|
if (existing instanceof Map) return existing;
|
|
1591
1591
|
const registry = /* @__PURE__ */ new Map();
|
|
1592
|
-
globalTarget[
|
|
1592
|
+
globalTarget[registryKey] = registry;
|
|
1593
1593
|
return registry;
|
|
1594
1594
|
}
|
|
1595
1595
|
function renderTextValue(value) {
|
|
@@ -8369,6 +8369,26 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8369
8369
|
current: definition
|
|
8370
8370
|
};
|
|
8371
8371
|
const refreshListeners = /* @__PURE__ */ new Set();
|
|
8372
|
+
const component = createCompiledComponentRuntime(
|
|
8373
|
+
definitionReference,
|
|
8374
|
+
runtimeFeatures,
|
|
8375
|
+
refreshListeners
|
|
8376
|
+
);
|
|
8377
|
+
if (definition.hmrId) {
|
|
8378
|
+
getCompilerHmrRegistry().set(definition.hmrId, {
|
|
8379
|
+
component,
|
|
8380
|
+
definition: definitionReference,
|
|
8381
|
+
refreshListeners,
|
|
8382
|
+
stateSignature,
|
|
8383
|
+
runtimeSignature
|
|
8384
|
+
});
|
|
8385
|
+
}
|
|
8386
|
+
return component;
|
|
8387
|
+
}
|
|
8388
|
+
function createCompiledComponentWithoutRefresh(definition, runtimeFeatures) {
|
|
8389
|
+
return createCompiledComponentRuntime({ current: definition }, runtimeFeatures);
|
|
8390
|
+
}
|
|
8391
|
+
function createCompiledComponentRuntime(definitionReference, runtimeFeatures, refreshListeners) {
|
|
8372
8392
|
class FarmCompiledComponent extends React__default.default.Component {
|
|
8373
8393
|
constructor(props) {
|
|
8374
8394
|
super(props);
|
|
@@ -8679,7 +8699,7 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8679
8699
|
}
|
|
8680
8700
|
componentDidMount() {
|
|
8681
8701
|
this.mounted = true;
|
|
8682
|
-
refreshListeners
|
|
8702
|
+
refreshListeners?.add(this.refreshDefinition);
|
|
8683
8703
|
this.componentDidUpdate();
|
|
8684
8704
|
}
|
|
8685
8705
|
getSnapshotBeforeUpdate() {
|
|
@@ -8735,7 +8755,7 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8735
8755
|
this.bindingValues.clear();
|
|
8736
8756
|
this.activeBinding = null;
|
|
8737
8757
|
this.activeDependencies = null;
|
|
8738
|
-
refreshListeners
|
|
8758
|
+
refreshListeners?.delete(this.refreshDefinition);
|
|
8739
8759
|
}
|
|
8740
8760
|
render() {
|
|
8741
8761
|
if (this.hasBindingError) throw this.bindingError;
|
|
@@ -8777,18 +8797,8 @@ function createCompiledComponentWithFeatures(definition, runtimeFeatures) {
|
|
|
8777
8797
|
return renderedElement;
|
|
8778
8798
|
}
|
|
8779
8799
|
}
|
|
8780
|
-
FarmCompiledComponent.displayName = `FarmCompiled(${
|
|
8781
|
-
|
|
8782
|
-
if (definition.hmrId) {
|
|
8783
|
-
getCompilerHmrRegistry().set(definition.hmrId, {
|
|
8784
|
-
component,
|
|
8785
|
-
definition: definitionReference,
|
|
8786
|
-
refreshListeners,
|
|
8787
|
-
stateSignature,
|
|
8788
|
-
runtimeSignature
|
|
8789
|
-
});
|
|
8790
|
-
}
|
|
8791
|
-
return component;
|
|
8800
|
+
FarmCompiledComponent.displayName = `FarmCompiled(${definitionReference.current.displayName})`;
|
|
8801
|
+
return FarmCompiledComponent;
|
|
8792
8802
|
}
|
|
8793
8803
|
var COMPLETE_RUNTIME_FEATURES = [
|
|
8794
8804
|
conditionalRuntimeFeature,
|
|
@@ -8810,6 +8820,7 @@ exports.conditionalRangesRuntimeFeature = conditionalRangesRuntimeFeature;
|
|
|
8810
8820
|
exports.conditionalRuntimeFeature = conditionalRuntimeFeature;
|
|
8811
8821
|
exports.createCompiledComponent = createCompiledComponent;
|
|
8812
8822
|
exports.createCompiledComponentWithFeatures = createCompiledComponentWithFeatures;
|
|
8823
|
+
exports.createCompiledComponentWithoutRefresh = createCompiledComponentWithoutRefresh;
|
|
8813
8824
|
exports.createCompilerKeyedArrayAppend = createCompilerKeyedArrayAppend;
|
|
8814
8825
|
exports.createCompilerKeyedArrayBatchInsert = createCompilerKeyedArrayBatchInsert;
|
|
8815
8826
|
exports.createCompilerKeyedArrayFilter = createCompilerKeyedArrayFilter;
|