@barefootjs/cli 0.33.4 → 0.33.6
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/advanced/error-codes.md +34 -1
- package/dist/index.js +2591 -2314
- package/package.json +5 -5
|
@@ -58,7 +58,7 @@ export function Counter() { ... }
|
|
|
58
58
|
|
|
59
59
|
---
|
|
60
60
|
|
|
61
|
-
## Signal Errors (BF011)
|
|
61
|
+
## Signal Errors (BF011–BF013)
|
|
62
62
|
|
|
63
63
|
<a id="bf011"></a>
|
|
64
64
|
|
|
@@ -104,6 +104,38 @@ export function Counter() {
|
|
|
104
104
|
|
|
105
105
|
---
|
|
106
106
|
|
|
107
|
+
<a id="bf013"></a>
|
|
108
|
+
|
|
109
|
+
### BF013 — Reactive Primitive Called Through a Namespace Import
|
|
110
|
+
|
|
111
|
+
**Trigger:** A reactive primitive (`createSignal`, `createMemo`, `createEffect`, `onMount`, `onCleanup`, `createSearchParams`) invoked through a namespace import of `@barefootjs/client` (`import * as ns from '@barefootjs/client'`) that the analyzer could not resolve. Without a shared `ts.Program` (`CompileOptions.program`), the analyzer's fast path only recognizes a bare identifier callee — `ns.createSignal(...)` is dropped from the compiled output, and every reference to it throws `ReferenceError` at hydrate.
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
'use client'
|
|
115
|
+
// ❌ BF013 — namespace-qualified call is not recognized
|
|
116
|
+
import * as bf from '@barefootjs/client'
|
|
117
|
+
export function Counter() {
|
|
118
|
+
const [count, setCount] = bf.createSignal(0)
|
|
119
|
+
return <button onClick={() => setCount(count() + 1)}>{count()}</button>
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Fix:** Import the primitive by name instead of through the namespace.
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
'use client'
|
|
127
|
+
import { createSignal } from '@barefootjs/client'
|
|
128
|
+
|
|
129
|
+
export function Counter() {
|
|
130
|
+
const [count, setCount] = createSignal(0)
|
|
131
|
+
return <button onClick={() => setCount(count() + 1)}>{count()}</button>
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
A shared `ts.Program` passed via `CompileOptions.program` (as `@barefootjs/vite` always supplies) lets the analyzer resolve the namespace-qualified form through the TypeScript `TypeChecker` — this diagnostic only fires when no such program is available.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
107
139
|
## JSX Errors (BF021–BF023)
|
|
108
140
|
|
|
109
141
|
<a id="bf021"></a>
|
|
@@ -451,6 +483,7 @@ function Component({ checked }: Props) {
|
|
|
451
483
|
| BF001 | Error | Missing `"use client"` directive |
|
|
452
484
|
| BF003 | Error | Client component importing server component |
|
|
453
485
|
| BF011 | Error | Module-level reactive declaration without `/* @client */` |
|
|
486
|
+
| BF013 | Error | Reactive primitive called through an unresolved namespace import |
|
|
454
487
|
| BF021 | Error | Unsupported JSX pattern for SSR |
|
|
455
488
|
| BF023 | Error | Missing key in list |
|
|
456
489
|
| BF043 | Warning | Props destructuring breaks reactivity |
|