@barefootjs/cli 0.16.0 → 0.17.1
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/dist/docs/core/rendering/jsx-compatibility.md +17 -3
- package/dist/index.js +7170 -6346
- package/package.json +4 -4
|
@@ -156,16 +156,30 @@ Some JavaScript expressions cannot be translated into marked template syntax. Wh
|
|
|
156
156
|
|
|
157
157
|
### Patterns that error on all adapters
|
|
158
158
|
|
|
159
|
-
**Unsupported sort comparators** (
|
|
159
|
+
**Unsupported sort comparators** (imperative block bodies, function references):
|
|
160
|
+
|
|
161
|
+
A value-producing block body normalizes to an expression — pure `const`
|
|
162
|
+
bindings inline (let-inline) and a value-producing `if` / early `return`
|
|
163
|
+
becomes a ternary — so it lowers on all adapters just like the expression form:
|
|
160
164
|
|
|
161
165
|
```tsx
|
|
162
|
-
//
|
|
166
|
+
// ✅ Value-producing block bodies normalize (let-inline) and lower everywhere
|
|
163
167
|
{items().sort((a, b) => { const an = a.name; return an > b.name ? 1 : -1 }).map(item => (
|
|
164
168
|
<Item key={item.id} item={item} />
|
|
165
169
|
))}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Only a genuinely imperative comparator — one that re-assigns a local, loops, or
|
|
173
|
+
`break`s — has no value-position lowering and errors:
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
// ❌ BF021 (all adapters)
|
|
177
|
+
{items().sort((a, b) => { let r = 0; r = a.name > b.name ? 1 : -1; return r }).map(item => (
|
|
178
|
+
<Item key={item.id} item={item} />
|
|
179
|
+
))}
|
|
166
180
|
|
|
167
181
|
// ✅ Use /* @client */
|
|
168
|
-
{/* @client */ items().sort((a, b) => {
|
|
182
|
+
{/* @client */ items().sort((a, b) => { let r = 0; r = a.name > b.name ? 1 : -1; return r }).map(item => (
|
|
169
183
|
<Item key={item.id} item={item} />
|
|
170
184
|
))}
|
|
171
185
|
```
|