@barefootjs/cli 0.26.2 → 0.26.3

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.
@@ -108,11 +108,11 @@ Some JavaScript expressions cannot be translated into marked template syntax. Wh
108
108
  | `.reduce()`, `.forEach()`, `.flatMap()` | works | **BF101** |
109
109
  | Nested `.filter()` / `.map()` in a filter predicate (`x => x.tags.filter(...).length > 0`) | works | works |
110
110
  | Nested `.some()` / `.find()` / `.reduce()` in a filter predicate | works | **BF101** |
111
- | Sort comparator that's a multi-statement block body or `localeCompare(b, locale, opts)` | **BF021** (all adapters) | **BF021** |
112
- | Sort comparator that's a function reference to an imported/prop identifier, or an alias chain (`const c2 = c1`) | **BF021** (all adapters) | **BF021** |
113
- | `typeof` in a filter predicate | **BF021** (all adapters) | **BF021** |
111
+ | Sort comparator that's a multi-statement block body or `localeCompare(b, locale, opts)` | works (runs as JS) | **BF021** |
112
+ | Sort comparator that's a function reference to an imported/prop identifier, or an alias chain (`const c2 = c1`) | works (runs as JS) | **BF021** |
113
+ | `typeof` in a filter predicate | works (runs as JS) | **BF021** |
114
114
 
115
- `BF021` is raised at the IR layer and applies to every adapter. `BF101` is raised by adapters that can't lower the expression to their template language. Either way, add [`/* @client */`](./client-directive.md) to opt into client-only evaluation and suppress the error.
115
+ An off-subset `filter` predicate or `sort` comparator (`typeof`, an imperative block body, an imported/aliased comparator reference, …) is raised as `BF021` only on non-JS template adapters — a JS-runtime adapter (Hono, CSR) executes the callback body verbatim at SSR, so it compiles there. `BF101` is raised by adapters that can't lower the expression to their template language. Either way, add [`/* @client */`](./client-directive.md) on a DSL backend to defer the shape to client-only evaluation and suppress the error.
116
116
 
117
117
  ### Patterns that error on Go / Mojo
118
118
 
@@ -165,9 +165,9 @@ A nested `.some()` / `.find()` / `.reduce()` still has no faithful Go/Mojo lower
165
165
  {items().filter(x => x.done)}
166
166
  ```
167
167
 
168
- ### Patterns that error on all adapters
168
+ ### Sort comparators that error on Go / Mojo
169
169
 
170
- **Unsupported sort comparators** (imperative block bodies, unresolved function references):
170
+ **Unsupported sort comparators** (imperative block bodies, unresolved function references) — a JS-runtime adapter (Hono, CSR) runs any of these verbatim; only non-JS template backends refuse them:
171
171
 
172
172
  A value-producing block body normalizes to an expression — pure `const`
173
173
  bindings inline (let-inline) and a value-producing `if` / early `return`
@@ -181,10 +181,10 @@ becomes a ternary — so it lowers on all adapters just like the expression form
181
181
  ```
182
182
 
183
183
  Only a genuinely imperative comparator — one that re-assigns a local, loops, or
184
- `break`s — has no value-position lowering and errors:
184
+ `break`s — has no value-position lowering and errors on Go / Mojo:
185
185
 
186
186
  ```tsx
187
- // ❌ BF021 (all adapters)
187
+ // ❌ BF021 on Go/Mojo — a JS-runtime target (Hono, CSR) runs the comparator
188
188
  {items().sort((a, b) => { let r = 0; r = a.name > b.name ? 1 : -1; return r }).map(item => (
189
189
  <Item key={item.id} item={item} />
190
190
  ))}
@@ -201,7 +201,7 @@ compiles (see the "Sort comparators" section above); an **imported** or
201
201
  only one binding, so it can't see through a re-export or `const c2 = c1`:
202
202
 
203
203
  ```tsx
204
- // ❌ BF021 — `byPrice` is imported, not declared in this file
204
+ // ❌ BF021 on Go/Mojo — `byPrice` is imported, not declared in this file
205
205
  import { byPrice } from './comparators'
206
206
  function SortedList({ items }: { items: Item[] }) {
207
207
  return <ul>{items.sort(byPrice).map((item) => <li key={item.id}>{item.name}</li>)}</ul>