brumate 0.3.0 → 0.4.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/README.md +2 -2
- package/check.d.ts +49 -0
- package/dist/{boot-C25Sa6vq.d.ts → boot-SCWYwuUd.d.ts} +8 -10
- package/dist/cli.js +275 -15
- package/dist/cli.js.map +1 -1
- package/dist/client-BBtVTOIt.js +3506 -0
- package/dist/client-BBtVTOIt.js.map +1 -0
- package/dist/{client-D0CqSxoO.d.ts → client-Cs3o4key.d.ts} +390 -181
- package/dist/{client-routes-JTbGtukf.js → client-routes-BtGpYCef.js} +60 -30
- package/dist/client-routes-BtGpYCef.js.map +1 -0
- package/dist/{cookies-BzllthiF.js → cookies-Cnbf4w-S.js} +14 -7
- package/dist/cookies-Cnbf4w-S.js.map +1 -0
- package/dist/{defer-BbD7JQhj.js → defer-BLJjxqVc.js} +4 -4
- package/dist/defer-BLJjxqVc.js.map +1 -0
- package/dist/{devtools-CQgD7NPB.js → devtools-DTpsVFbn.js} +56 -82
- package/dist/devtools-DTpsVFbn.js.map +1 -0
- package/dist/{devtools-panel-BVB-W5q4.js → devtools-panel-C1Dfv6nq.js} +397 -333
- package/dist/devtools-panel-C1Dfv6nq.js.map +1 -0
- package/dist/{events-CSs7OwIC.js → events-LgLdp1R7.js} +34 -5
- package/dist/events-LgLdp1R7.js.map +1 -0
- package/dist/features-CHY5Ekku.js +30 -0
- package/dist/features-CHY5Ekku.js.map +1 -0
- package/dist/files-DZIiMDnS.js +506 -0
- package/dist/files-DZIiMDnS.js.map +1 -0
- package/dist/{forms-Cl21hkHt.d.ts → forms-j1xPAR14.d.ts} +3 -3
- package/dist/{forms-Bg-CwGqX.js → forms-nXK7-Lv_.js} +78 -44
- package/dist/forms-nXK7-Lv_.js.map +1 -0
- package/dist/highlight.js +31 -22
- package/dist/highlight.js.map +1 -1
- package/dist/{html-mNTKzaDD.js → html-DS9B1H-M.js} +92 -22
- package/dist/html-DS9B1H-M.js.map +1 -0
- package/dist/{html-Bq1rFxX_.d.ts → html-Gggepsf-.d.ts} +22 -5
- package/dist/index.d.ts +98 -10
- package/dist/index.js +639 -104
- package/dist/index.js.map +1 -1
- package/dist/{inspect-BHpOw1LF.js → inspect-DomFHy5O.js} +3832 -695
- package/dist/inspect-DomFHy5O.js.map +1 -0
- package/dist/{loader-Dos_3NP0.js → loader-D62komKu.js} +20 -14
- package/dist/loader-D62komKu.js.map +1 -0
- package/dist/logo-DQ_OYhBi.js +10 -0
- package/dist/logo-DQ_OYhBi.js.map +1 -0
- package/dist/{navigate-O78d_zGN.js → navigate-CfOr-TRF.js} +94 -31
- package/dist/navigate-CfOr-TRF.js.map +1 -0
- package/dist/nesting-DA5vJw9X.js +265 -0
- package/dist/nesting-DA5vJw9X.js.map +1 -0
- package/dist/{produce-Doc91GkX.js → produce-BNIpmZq2.js} +138 -9
- package/dist/produce-BNIpmZq2.js.map +1 -0
- package/dist/{produce-D0V0ICkz.d.ts → produce-CRfouraC.d.ts} +44 -5
- package/dist/{rpc-ygMRPmN4.js → rpc-BTMb8jap.js} +11 -6
- package/dist/rpc-BTMb8jap.js.map +1 -0
- package/dist/runtime/batch.js +9 -7
- package/dist/runtime/batch.js.map +1 -1
- package/dist/runtime/client.d.ts +4 -4
- package/dist/runtime/client.js +4 -4
- package/dist/runtime/devtools.d.ts +11 -29
- package/dist/runtime/devtools.js +3 -1
- package/dist/runtime/env.js +14 -2
- package/dist/runtime/env.js.map +1 -1
- package/dist/runtime/events.d.ts +23 -1
- package/dist/runtime/events.js +1 -1
- package/dist/runtime/forms.d.ts +2 -2
- package/dist/runtime/forms.js +1 -1
- package/dist/runtime/hot.d.ts +1 -1
- package/dist/runtime/hot.js +5 -2
- package/dist/runtime/hot.js.map +1 -1
- package/dist/runtime/html.d.ts +2 -2
- package/dist/runtime/html.js +1 -1
- package/dist/runtime/loader.d.ts +2 -2
- package/dist/runtime/loader.js +2 -2
- package/dist/runtime/routes.js +4 -1
- package/dist/runtime/routes.js.map +1 -1
- package/dist/runtime/server.d.ts +5 -5
- package/dist/runtime/server.js +5 -5
- package/dist/runtime/signals.d.ts +38 -1
- package/dist/runtime/signals.js +33 -1
- package/dist/runtime/signals.js.map +1 -1
- package/dist/runtime/static-loader.d.ts +2 -2
- package/dist/runtime/static-loader.js +1 -1
- package/dist/runtime/testing.d.ts +18 -3
- package/dist/runtime/testing.js +150 -33
- package/dist/runtime/testing.js.map +1 -1
- package/dist/{server-CxVDYE_V.js → server-BTtsQFFw.js} +633 -163
- package/dist/server-BTtsQFFw.js.map +1 -0
- package/dist/{server-DuFYRXrd.d.ts → server-CYw15Dsg.d.ts} +103 -22
- package/dist/{static-loader-nZssh66R.js → static-loader-C_GYIFtt.js} +79 -99
- package/dist/static-loader-C_GYIFtt.js.map +1 -0
- package/dist/{static-loader-Drpr0AzI.d.ts → static-loader-DVuLmXeu.d.ts} +2 -2
- package/dist/{stream-DCYZO4IF.js → stream-r4V5zBKm.js} +102 -16
- package/dist/stream-r4V5zBKm.js.map +1 -0
- package/dist/vite.d.ts +13 -20
- package/dist/vite.js +1956 -554
- package/dist/vite.js.map +1 -1
- package/elements.d.ts +951 -0
- package/forms/forms.brm.ts +3 -3
- package/package.json +12 -3
- package/skills/brumate/SKILL.md +58 -0
- package/skills/brumate/references/errors.md +2078 -0
- package/skills/brumate/references/events.md +117 -0
- package/skills/brumate/references/signals.md +61 -0
- package/skills/brumate/references/state.md +235 -0
- package/skills/brumate/references/syntax.md +250 -0
- package/types.d.ts +4 -4
- package/dist/client-BD6XT-s5.js +0 -1968
- package/dist/client-BD6XT-s5.js.map +0 -1
- package/dist/client-routes-JTbGtukf.js.map +0 -1
- package/dist/cookies-BzllthiF.js.map +0 -1
- package/dist/defer-BbD7JQhj.js.map +0 -1
- package/dist/devtools-CQgD7NPB.js.map +0 -1
- package/dist/devtools-panel-BVB-W5q4.js.map +0 -1
- package/dist/events-CSs7OwIC.js.map +0 -1
- package/dist/files-BXSSrQgc.js +0 -205
- package/dist/files-BXSSrQgc.js.map +0 -1
- package/dist/forms-Bg-CwGqX.js.map +0 -1
- package/dist/html-mNTKzaDD.js.map +0 -1
- package/dist/inspect-BHpOw1LF.js.map +0 -1
- package/dist/loader-Dos_3NP0.js.map +0 -1
- package/dist/navigate-O78d_zGN.js.map +0 -1
- package/dist/produce-Doc91GkX.js.map +0 -1
- package/dist/rpc-ygMRPmN4.js.map +0 -1
- package/dist/server-CxVDYE_V.js.map +0 -1
- package/dist/static-loader-nZssh66R.js.map +0 -1
- package/dist/stream-DCYZO4IF.js.map +0 -1
|
@@ -0,0 +1,2078 @@
|
|
|
1
|
+
# Errors
|
|
2
|
+
|
|
3
|
+
The compiler reports each error with the place in the file, as `message (File.brm:line:column)`. This page lists every message, with its cause and the form to write instead. A `{name}` is a part that varies.
|
|
4
|
+
|
|
5
|
+
It is generated from `src/error-catalog.ts`. Do not edit it by hand.
|
|
6
|
+
|
|
7
|
+
## BRM001: Unterminated comment
|
|
8
|
+
|
|
9
|
+
A comment starts and never ends.
|
|
10
|
+
|
|
11
|
+
https://brumate-docs.vercel.app/docs/errors#brm001
|
|
12
|
+
|
|
13
|
+
```brm fragment
|
|
14
|
+
<!-- A comment ends with -->
|
|
15
|
+
<script>
|
|
16
|
+
/* and so does this one */
|
|
17
|
+
</script>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## BRM002: Unterminated string
|
|
21
|
+
|
|
22
|
+
A string in code starts and never ends.
|
|
23
|
+
|
|
24
|
+
https://brumate-docs.vercel.app/docs/errors#brm002
|
|
25
|
+
|
|
26
|
+
```brm fragment
|
|
27
|
+
const name = 'Ada';
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## BRM003: Unterminated template literal
|
|
31
|
+
|
|
32
|
+
A template string starts and never ends.
|
|
33
|
+
|
|
34
|
+
https://brumate-docs.vercel.app/docs/errors#brm003
|
|
35
|
+
|
|
36
|
+
```brm fragment
|
|
37
|
+
const label = `Hello ${name}`;
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## BRM004: Unterminated regular expression
|
|
41
|
+
|
|
42
|
+
A regular expression starts and never ends.
|
|
43
|
+
|
|
44
|
+
https://brumate-docs.vercel.app/docs/errors#brm004
|
|
45
|
+
|
|
46
|
+
```brm fragment
|
|
47
|
+
const digits = /\d+/;
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## BRM005: Unexpected "{char}"
|
|
51
|
+
|
|
52
|
+
Code has a bracket that closes nothing.
|
|
53
|
+
|
|
54
|
+
https://brumate-docs.vercel.app/docs/errors#brm005
|
|
55
|
+
|
|
56
|
+
```brm fragment
|
|
57
|
+
const list = [1, 2];
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## BRM006: Expected "{char}"
|
|
61
|
+
|
|
62
|
+
Code opens a bracket and never closes it. The message names the closing one.
|
|
63
|
+
|
|
64
|
+
https://brumate-docs.vercel.app/docs/errors#brm006
|
|
65
|
+
|
|
66
|
+
```brm fragment
|
|
67
|
+
const list = [1, 2];
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## BRM007: Expected "}" to close the block
|
|
71
|
+
|
|
72
|
+
A `#` block opens with `{` and the file ends before its `}`.
|
|
73
|
+
|
|
74
|
+
https://brumate-docs.vercel.app/docs/errors#brm007
|
|
75
|
+
|
|
76
|
+
```brm fragment
|
|
77
|
+
#if (open) {
|
|
78
|
+
<p>Open</p>
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## BRM008: Unexpected end of file, expected a closing tag
|
|
83
|
+
|
|
84
|
+
An element is never closed.
|
|
85
|
+
|
|
86
|
+
https://brumate-docs.vercel.app/docs/errors#brm008
|
|
87
|
+
|
|
88
|
+
```brm fragment
|
|
89
|
+
<div>
|
|
90
|
+
<p>Text</p>
|
|
91
|
+
</div>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## BRM009: Unexpected closing tag
|
|
95
|
+
|
|
96
|
+
A closing tag has no opening tag.
|
|
97
|
+
|
|
98
|
+
https://brumate-docs.vercel.app/docs/errors#brm009
|
|
99
|
+
|
|
100
|
+
```brm fragment
|
|
101
|
+
<p>Text</p>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## BRM010: <script> must be at the top level or at the start of a block
|
|
105
|
+
|
|
106
|
+
A `<script>` is inside an element, or after other markup in a block.
|
|
107
|
+
|
|
108
|
+
https://brumate-docs.vercel.app/docs/errors#brm010
|
|
109
|
+
|
|
110
|
+
```brm fragment
|
|
111
|
+
#for (item of items) {
|
|
112
|
+
<script>
|
|
113
|
+
let open = $signal(false);
|
|
114
|
+
</script>
|
|
115
|
+
<p>{item}</p>
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## BRM011: <style> must be at the top level
|
|
120
|
+
|
|
121
|
+
A `<style>` is inside an element or a block.
|
|
122
|
+
|
|
123
|
+
https://brumate-docs.vercel.app/docs/errors#brm011
|
|
124
|
+
|
|
125
|
+
```brm fragment
|
|
126
|
+
<style>
|
|
127
|
+
p {
|
|
128
|
+
color: red;
|
|
129
|
+
}
|
|
130
|
+
</style>
|
|
131
|
+
<p>Text</p>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## BRM012: #template must be at the top level or at the start of a block
|
|
135
|
+
|
|
136
|
+
A `#template` is inside an element, or after other markup in a block.
|
|
137
|
+
|
|
138
|
+
https://brumate-docs.vercel.app/docs/errors#brm012
|
|
139
|
+
|
|
140
|
+
```brm fragment
|
|
141
|
+
#template price(amount: number) {
|
|
142
|
+
<b>{amount}</b>
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## BRM013: #{branch} must follow its block
|
|
147
|
+
|
|
148
|
+
A branch such as `#else` or `#catch` comes without the block that it belongs to.
|
|
149
|
+
|
|
150
|
+
https://brumate-docs.vercel.app/docs/errors#brm013
|
|
151
|
+
|
|
152
|
+
```brm fragment
|
|
153
|
+
#if (open) {
|
|
154
|
+
<p>Open</p>
|
|
155
|
+
} #else {
|
|
156
|
+
<p>Closed</p>
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## BRM014: Expected a tag name
|
|
161
|
+
|
|
162
|
+
A `<` starts a tag with no name.
|
|
163
|
+
|
|
164
|
+
https://brumate-docs.vercel.app/docs/errors#brm014
|
|
165
|
+
|
|
166
|
+
```brm fragment
|
|
167
|
+
<p>1 < 2</p>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## BRM015: <{name}> must end with "/>"
|
|
171
|
+
|
|
172
|
+
`<window>` and `<document>` take no children, so they close with `/>`.
|
|
173
|
+
|
|
174
|
+
https://brumate-docs.vercel.app/docs/errors#brm015
|
|
175
|
+
|
|
176
|
+
```brm fragment
|
|
177
|
+
<window onKeyDown=(handler) />
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## BRM016: Expected </{name}>
|
|
181
|
+
|
|
182
|
+
A closing tag is not complete.
|
|
183
|
+
|
|
184
|
+
https://brumate-docs.vercel.app/docs/errors#brm016
|
|
185
|
+
|
|
186
|
+
```brm fragment
|
|
187
|
+
<p>Text</p>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## BRM017: Unexpected end of file, expected ">"
|
|
191
|
+
|
|
192
|
+
A tag starts and the file ends before its `>`.
|
|
193
|
+
|
|
194
|
+
https://brumate-docs.vercel.app/docs/errors#brm017
|
|
195
|
+
|
|
196
|
+
```brm fragment
|
|
197
|
+
<input value=name>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## BRM018: Expected whitespace between attributes
|
|
201
|
+
|
|
202
|
+
Two attributes touch each other.
|
|
203
|
+
|
|
204
|
+
https://brumate-docs.vercel.app/docs/errors#brm018
|
|
205
|
+
|
|
206
|
+
```brm fragment
|
|
207
|
+
<input id=name type="text">
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## BRM019: Only event handlers are allowed here
|
|
211
|
+
|
|
212
|
+
`<window>` and `<document>` take event handlers and nothing else.
|
|
213
|
+
|
|
214
|
+
https://brumate-docs.vercel.app/docs/errors#brm019
|
|
215
|
+
|
|
216
|
+
```brm fragment
|
|
217
|
+
<document onKeyDown=(handler) />
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## BRM020: Expected a spread or a shorthand attribute
|
|
221
|
+
|
|
222
|
+
A `{` in a tag holds something other than `...rest` or a name.
|
|
223
|
+
|
|
224
|
+
https://brumate-docs.vercel.app/docs/errors#brm020
|
|
225
|
+
|
|
226
|
+
```brm fragment
|
|
227
|
+
<a {href} {...rest}>Open</a>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## BRM021: Expected an attribute name
|
|
231
|
+
|
|
232
|
+
A tag has a character where an attribute name belongs.
|
|
233
|
+
|
|
234
|
+
https://brumate-docs.vercel.app/docs/errors#brm021
|
|
235
|
+
|
|
236
|
+
```brm fragment
|
|
237
|
+
<input disabled>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## BRM022: Unknown event modifier ":{modifier}"
|
|
241
|
+
|
|
242
|
+
The modifier after an event name is not one of the known ones.
|
|
243
|
+
|
|
244
|
+
https://brumate-docs.vercel.app/docs/errors#brm022
|
|
245
|
+
|
|
246
|
+
```brm fragment
|
|
247
|
+
<form onSubmit=(prevent(send))></form>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## BRM180: "{name}" is not an event name. Write "{camel}"
|
|
251
|
+
|
|
252
|
+
An event of more than one word is written in camel case. The lower-case form is an error.
|
|
253
|
+
|
|
254
|
+
https://brumate-docs.vercel.app/docs/errors#brm180
|
|
255
|
+
|
|
256
|
+
```brm fragment
|
|
257
|
+
<input onKeyDown=(handle) onFocusOut=(handle) />
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## BRM181: #loading does not take a header yet. Write #loading { … }, since the header would be dropped
|
|
261
|
+
|
|
262
|
+
A `#loading` block has a header in parentheses. The compiler reads no meaning from it.
|
|
263
|
+
|
|
264
|
+
https://brumate-docs.vercel.app/docs/errors#brm181
|
|
265
|
+
|
|
266
|
+
```brm fragment
|
|
267
|
+
#loading (data) {
|
|
268
|
+
<p>{data.name}</p>
|
|
269
|
+
} #else {
|
|
270
|
+
<p>Loading</p>
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## BRM182: The handler reads "{name}", a memo that can lack a value. Wait for it with await $resolve({name}), or check $isPending({name}) first
|
|
275
|
+
|
|
276
|
+
A handler, a handler prop or a `$client` callback reads an async memo that may still be loading, with no `$isPending` check or `await $resolve` before the read.
|
|
277
|
+
|
|
278
|
+
https://brumate-docs.vercel.app/docs/errors#brm182
|
|
279
|
+
|
|
280
|
+
```brm fragment
|
|
281
|
+
<script>
|
|
282
|
+
const user = $memo(getUser(id));
|
|
283
|
+
async function save() {
|
|
284
|
+
await $resolve(user);
|
|
285
|
+
send(user.name);
|
|
286
|
+
}
|
|
287
|
+
</script>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## BRM183: $resolve needs a $memo and, as an option, a timeout or a signal
|
|
291
|
+
|
|
292
|
+
`$resolve` takes the name of a memo, and one object of options at most.
|
|
293
|
+
|
|
294
|
+
https://brumate-docs.vercel.app/docs/errors#brm183
|
|
295
|
+
|
|
296
|
+
```brm fragment
|
|
297
|
+
async function save() {
|
|
298
|
+
const profile = await $resolve(user, { timeout: 5000 });
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## BRM184: $resolve cannot run where a memo computes or markup renders. Call it in a handler, an effect or a $client callback
|
|
303
|
+
|
|
304
|
+
`$resolve` waits, so it is called where an event starts the code, not where a memo computes or markup renders.
|
|
305
|
+
|
|
306
|
+
https://brumate-docs.vercel.app/docs/errors#brm184
|
|
307
|
+
|
|
308
|
+
```brm fragment
|
|
309
|
+
async function save() {
|
|
310
|
+
await $resolve(user);
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## BRM185: <{tag}> cannot be inside <{parent}>: the HTML parser closes or moves it before the page runs. Move it out of the <{parent}>, or use a <span> or as="span"
|
|
315
|
+
|
|
316
|
+
The HTML parser does not keep this nesting. A `<p>` ends at a block element such as `<div>`, an `<a>` or a `<form>` inside the same tag starts again, and a table keeps only table parts. The browser builds a page that differs from the markup, and the start and end markers of a block can land in different parents.
|
|
317
|
+
|
|
318
|
+
https://brumate-docs.vercel.app/docs/errors#brm185
|
|
319
|
+
|
|
320
|
+
```brm fragment
|
|
321
|
+
<p>Total: <span>{total}</span></p>
|
|
322
|
+
<div>
|
|
323
|
+
<p>Total</p>
|
|
324
|
+
</div>
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## BRM023: Modifiers apply to elements. Put ":{modifier}" on the element that the component renders
|
|
328
|
+
|
|
329
|
+
An event modifier is on a component, which only passes the handler on.
|
|
330
|
+
|
|
331
|
+
https://brumate-docs.vercel.app/docs/errors#brm023
|
|
332
|
+
|
|
333
|
+
```brm fragment
|
|
334
|
+
<form onSubmit=(prevent(send))></form>
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
## BRM024: Expected an event handler
|
|
338
|
+
|
|
339
|
+
An event attribute has no `=` and no value.
|
|
340
|
+
|
|
341
|
+
https://brumate-docs.vercel.app/docs/errors#brm024
|
|
342
|
+
|
|
343
|
+
```brm fragment
|
|
344
|
+
<button onClick=(() => count++)>Add</button>
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## BRM025: An event handler must be an expression, not a string
|
|
348
|
+
|
|
349
|
+
The value of an event attribute is a quoted string.
|
|
350
|
+
|
|
351
|
+
https://brumate-docs.vercel.app/docs/errors#brm025
|
|
352
|
+
|
|
353
|
+
```brm fragment
|
|
354
|
+
<button onClick=(() => count++)>Add</button>
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
## BRM026: An attribute name can have one ":" namespace
|
|
358
|
+
|
|
359
|
+
An attribute name has two or more `:`.
|
|
360
|
+
|
|
361
|
+
https://brumate-docs.vercel.app/docs/errors#brm026
|
|
362
|
+
|
|
363
|
+
```brm fragment
|
|
364
|
+
<svg xlink:href="#icon"></svg>
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
## BRM027: ref takes $bind, as in ref=$bind(name)
|
|
368
|
+
|
|
369
|
+
`ref` has a value that is not `$bind(name)`.
|
|
370
|
+
|
|
371
|
+
https://brumate-docs.vercel.app/docs/errors#brm027
|
|
372
|
+
|
|
373
|
+
```brm fragment
|
|
374
|
+
<input ref=$bind(input)>
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
## BRM028: prefetch is removed. The code of the page loads when it starts
|
|
378
|
+
|
|
379
|
+
The `prefetch` attribute no longer exists.
|
|
380
|
+
|
|
381
|
+
https://brumate-docs.vercel.app/docs/errors#brm028
|
|
382
|
+
|
|
383
|
+
```brm fragment
|
|
384
|
+
<a href="/about">About</a>
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
## BRM029: Markup is not allowed in attribute values. Use a #template.
|
|
388
|
+
|
|
389
|
+
An attribute value holds an element.
|
|
390
|
+
|
|
391
|
+
https://brumate-docs.vercel.app/docs/errors#brm029
|
|
392
|
+
|
|
393
|
+
```brm fragment
|
|
394
|
+
<List item=row />
|
|
395
|
+
|
|
396
|
+
#template row(name: string) {
|
|
397
|
+
<b>{name}</b>
|
|
398
|
+
}
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
## BRM030: Expected an attribute value
|
|
402
|
+
|
|
403
|
+
An attribute has `=` and nothing after it.
|
|
404
|
+
|
|
405
|
+
https://brumate-docs.vercel.app/docs/errors#brm030
|
|
406
|
+
|
|
407
|
+
```brm fragment
|
|
408
|
+
<input value=name>
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
## BRM031: Wrap this attribute value in parentheses
|
|
412
|
+
|
|
413
|
+
An attribute value without quotes has an operator or a space in it.
|
|
414
|
+
|
|
415
|
+
https://brumate-docs.vercel.app/docs/errors#brm031
|
|
416
|
+
|
|
417
|
+
```brm fragment
|
|
418
|
+
<button disabled=(count > 3)>Add</button>
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
## BRM032: Expected ">" to end <{name}>
|
|
422
|
+
|
|
423
|
+
A tag has text where its `>` belongs.
|
|
424
|
+
|
|
425
|
+
https://brumate-docs.vercel.app/docs/errors#brm032
|
|
426
|
+
|
|
427
|
+
```brm fragment
|
|
428
|
+
<input value=name>
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
## BRM033: Expected a quoted value
|
|
432
|
+
|
|
433
|
+
A `<script>` or `<style>` attribute has `=` without a quoted value.
|
|
434
|
+
|
|
435
|
+
https://brumate-docs.vercel.app/docs/errors#brm033
|
|
436
|
+
|
|
437
|
+
```brm fragment
|
|
438
|
+
<script generics="T"></script>
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
## BRM034: Expected {close}
|
|
442
|
+
|
|
443
|
+
A `<script>` or `<style>` is not closed.
|
|
444
|
+
|
|
445
|
+
https://brumate-docs.vercel.app/docs/errors#brm034
|
|
446
|
+
|
|
447
|
+
```brm fragment
|
|
448
|
+
<script>
|
|
449
|
+
let a = 1;
|
|
450
|
+
</script>
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
## BRM035: Unknown <script> attribute "{name}"
|
|
454
|
+
|
|
455
|
+
A `<script>` has an attribute other than `module` and `generics`.
|
|
456
|
+
|
|
457
|
+
https://brumate-docs.vercel.app/docs/errors#brm035
|
|
458
|
+
|
|
459
|
+
```brm fragment
|
|
460
|
+
<script module>
|
|
461
|
+
export const MAX = 10;
|
|
462
|
+
</script>
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
## BRM036: A file can have one <script module>
|
|
466
|
+
|
|
467
|
+
A file has two module scripts.
|
|
468
|
+
|
|
469
|
+
https://brumate-docs.vercel.app/docs/errors#brm036
|
|
470
|
+
|
|
471
|
+
```brm fragment
|
|
472
|
+
<script module>
|
|
473
|
+
export const MAX = 10;
|
|
474
|
+
export const MIN = 1;
|
|
475
|
+
</script>
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
## BRM037: A file can have one <script>
|
|
479
|
+
|
|
480
|
+
A file has two instance scripts.
|
|
481
|
+
|
|
482
|
+
https://brumate-docs.vercel.app/docs/errors#brm037
|
|
483
|
+
|
|
484
|
+
```brm fragment
|
|
485
|
+
<script>
|
|
486
|
+
let a = $signal(1);
|
|
487
|
+
let b = $signal(2);
|
|
488
|
+
</script>
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
## BRM038: lang must be "css", "scss" or "less"
|
|
492
|
+
|
|
493
|
+
A `<style>` names another language.
|
|
494
|
+
|
|
495
|
+
https://brumate-docs.vercel.app/docs/errors#brm038
|
|
496
|
+
|
|
497
|
+
```brm fragment
|
|
498
|
+
<style lang="scss">
|
|
499
|
+
p {
|
|
500
|
+
a {
|
|
501
|
+
color: red;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
</style>
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
## BRM039: #reveal takes an order, 'sequential', 'backwards', 'together' or 'natural', and collapsed, such as #reveal ('sequential', collapsed)
|
|
508
|
+
|
|
509
|
+
`#reveal` has an option that it does not know.
|
|
510
|
+
|
|
511
|
+
https://brumate-docs.vercel.app/docs/errors#brm039
|
|
512
|
+
|
|
513
|
+
```brm fragment
|
|
514
|
+
#reveal ('sequential', collapsed) {
|
|
515
|
+
…
|
|
516
|
+
}
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
## BRM040: collapsed shows the fallback of the next body to show, so it needs the order 'sequential', not '{order}'
|
|
520
|
+
|
|
521
|
+
`collapsed` goes with `sequential` only.
|
|
522
|
+
|
|
523
|
+
https://brumate-docs.vercel.app/docs/errors#brm040
|
|
524
|
+
|
|
525
|
+
```brm fragment
|
|
526
|
+
#reveal ('sequential', collapsed) {
|
|
527
|
+
…
|
|
528
|
+
}
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
## BRM041: #reveal has no script of its own
|
|
532
|
+
|
|
533
|
+
A `#reveal` body starts with a `<script>`.
|
|
534
|
+
|
|
535
|
+
https://brumate-docs.vercel.app/docs/errors#brm041
|
|
536
|
+
|
|
537
|
+
```brm fragment
|
|
538
|
+
<script>
|
|
539
|
+
let open = $signal(false);
|
|
540
|
+
</script>
|
|
541
|
+
#reveal {
|
|
542
|
+
…
|
|
543
|
+
}
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
## BRM042: Expected "(" after #{keyword}
|
|
547
|
+
|
|
548
|
+
A block that takes a condition or a list has no `(`.
|
|
549
|
+
|
|
550
|
+
https://brumate-docs.vercel.app/docs/errors#brm042
|
|
551
|
+
|
|
552
|
+
```brm fragment
|
|
553
|
+
#if (open) {
|
|
554
|
+
<p>Open</p>
|
|
555
|
+
}
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
## BRM043: Expected an expression after #{keyword}
|
|
559
|
+
|
|
560
|
+
The parentheses of a block are empty.
|
|
561
|
+
|
|
562
|
+
https://brumate-docs.vercel.app/docs/errors#brm043
|
|
563
|
+
|
|
564
|
+
```brm fragment
|
|
565
|
+
#if (open) {
|
|
566
|
+
<p>Open</p>
|
|
567
|
+
}
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
## BRM044: Expected "{" after #{keyword}
|
|
571
|
+
|
|
572
|
+
The header of a block is not followed by `{`.
|
|
573
|
+
|
|
574
|
+
https://brumate-docs.vercel.app/docs/errors#brm044
|
|
575
|
+
|
|
576
|
+
```brm fragment
|
|
577
|
+
#if (open) {
|
|
578
|
+
<p>Open</p>
|
|
579
|
+
}
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
## BRM045: Expected "{" after #switch
|
|
583
|
+
|
|
584
|
+
`#switch` has no `{` after it.
|
|
585
|
+
|
|
586
|
+
https://brumate-docs.vercel.app/docs/errors#brm045
|
|
587
|
+
|
|
588
|
+
```brm fragment
|
|
589
|
+
#switch {
|
|
590
|
+
#case (tab === 1) {
|
|
591
|
+
<p>One</p>
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
## BRM046: The script of a block takes no attributes
|
|
597
|
+
|
|
598
|
+
A `<script>` at the start of a block has attributes such as `module`.
|
|
599
|
+
|
|
600
|
+
https://brumate-docs.vercel.app/docs/errors#brm046
|
|
601
|
+
|
|
602
|
+
```brm fragment
|
|
603
|
+
#for (item of items) {
|
|
604
|
+
<script>
|
|
605
|
+
let open = $signal(false);
|
|
606
|
+
</script>
|
|
607
|
+
<p>{item}</p>
|
|
608
|
+
}
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
## BRM047: #try needs a #catch block
|
|
612
|
+
|
|
613
|
+
A `#try` body is not followed by `#catch`.
|
|
614
|
+
|
|
615
|
+
https://brumate-docs.vercel.app/docs/errors#brm047
|
|
616
|
+
|
|
617
|
+
```brm fragment
|
|
618
|
+
#try {
|
|
619
|
+
<p>{load()}</p>
|
|
620
|
+
} #catch (error, reset) {
|
|
621
|
+
<p>Failed</p>
|
|
622
|
+
}
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
## BRM048: Expected "(error, reset)" after #catch
|
|
626
|
+
|
|
627
|
+
The header of `#catch` names something other than a plain error name and a plain reset name.
|
|
628
|
+
|
|
629
|
+
https://brumate-docs.vercel.app/docs/errors#brm048
|
|
630
|
+
|
|
631
|
+
```brm fragment
|
|
632
|
+
#catch (error, reset) {
|
|
633
|
+
<p>{String(error)}</p>
|
|
634
|
+
}
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
## BRM049: The trigger of #{keyword} must be "visible", "idle" or "load"
|
|
638
|
+
|
|
639
|
+
A `#client` block names another trigger.
|
|
640
|
+
|
|
641
|
+
https://brumate-docs.vercel.app/docs/errors#brm049
|
|
642
|
+
|
|
643
|
+
```brm fragment
|
|
644
|
+
#client ('idle') {
|
|
645
|
+
<p>In the browser</p>
|
|
646
|
+
}
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
## BRM050: Unknown block #{keyword}
|
|
650
|
+
|
|
651
|
+
A `#` starts a block that does not exist.
|
|
652
|
+
|
|
653
|
+
https://brumate-docs.vercel.app/docs/errors#brm050
|
|
654
|
+
|
|
655
|
+
```brm fragment
|
|
656
|
+
#if (open) {
|
|
657
|
+
<p>Open</p>
|
|
658
|
+
}
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
## BRM051: Expected "index of count" after #repeat
|
|
662
|
+
|
|
663
|
+
The header of `#repeat` is not `index of count`.
|
|
664
|
+
|
|
665
|
+
https://brumate-docs.vercel.app/docs/errors#brm051
|
|
666
|
+
|
|
667
|
+
```brm fragment
|
|
668
|
+
#repeat (star of 5) {
|
|
669
|
+
<i>{star}</i>
|
|
670
|
+
}
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
## BRM052: Expected "item of list" or "item, index of list" after #for
|
|
674
|
+
|
|
675
|
+
The header of `#for` has no `of`.
|
|
676
|
+
|
|
677
|
+
https://brumate-docs.vercel.app/docs/errors#brm052
|
|
678
|
+
|
|
679
|
+
```brm fragment
|
|
680
|
+
#for (item, index of items by item.id) {
|
|
681
|
+
<li>{item.name}</li>
|
|
682
|
+
}
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
## BRM053: Expected the height of an item in window(height)
|
|
686
|
+
|
|
687
|
+
`window` after a `#for` header has no height.
|
|
688
|
+
|
|
689
|
+
https://brumate-docs.vercel.app/docs/errors#brm053
|
|
690
|
+
|
|
691
|
+
```brm fragment
|
|
692
|
+
#for (row of rows by row.id) window(32) {
|
|
693
|
+
<tr><td>{row.name}</td></tr>
|
|
694
|
+
}
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
## BRM054: Only #case and #default are allowed in #switch
|
|
698
|
+
|
|
699
|
+
A `#switch` holds markup other than its cases.
|
|
700
|
+
|
|
701
|
+
https://brumate-docs.vercel.app/docs/errors#brm054
|
|
702
|
+
|
|
703
|
+
```brm fragment
|
|
704
|
+
#switch {
|
|
705
|
+
#case (tab === 1) {
|
|
706
|
+
<p>One</p>
|
|
707
|
+
}
|
|
708
|
+
#default {
|
|
709
|
+
<p>Other</p>
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
## BRM055: #default must be the last branch of #switch
|
|
715
|
+
|
|
716
|
+
A `#case` comes after the `#default`.
|
|
717
|
+
|
|
718
|
+
https://brumate-docs.vercel.app/docs/errors#brm055
|
|
719
|
+
|
|
720
|
+
```brm fragment
|
|
721
|
+
#switch {
|
|
722
|
+
#case (tab === 1) {
|
|
723
|
+
<p>One</p>
|
|
724
|
+
}
|
|
725
|
+
#default {
|
|
726
|
+
<p>Other</p>
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
## BRM056: Expected "(" after the name of the template
|
|
732
|
+
|
|
733
|
+
A `#template` has no parameter list.
|
|
734
|
+
|
|
735
|
+
https://brumate-docs.vercel.app/docs/errors#brm056
|
|
736
|
+
|
|
737
|
+
```brm fragment
|
|
738
|
+
#template price(amount: number) {
|
|
739
|
+
<b>{amount}</b>
|
|
740
|
+
}
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
## BRM057: Expected an expression
|
|
744
|
+
|
|
745
|
+
An attribute or a block has code that is not an expression.
|
|
746
|
+
|
|
747
|
+
https://brumate-docs.vercel.app/docs/errors#brm057
|
|
748
|
+
|
|
749
|
+
```brm fragment
|
|
750
|
+
<p>{count + 1}</p>
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
## BRM058: Expected a binding pattern
|
|
754
|
+
|
|
755
|
+
The name of a `#for` or `#catch` is not a name or a pattern.
|
|
756
|
+
|
|
757
|
+
https://brumate-docs.vercel.app/docs/errors#brm058
|
|
758
|
+
|
|
759
|
+
```brm fragment
|
|
760
|
+
#for ({ id, name } of people by id) {
|
|
761
|
+
<li>{name}</li>
|
|
762
|
+
}
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
## BRM059: Expected parameters
|
|
766
|
+
|
|
767
|
+
The parameters of a `#template` are not a parameter list.
|
|
768
|
+
|
|
769
|
+
https://brumate-docs.vercel.app/docs/errors#brm059
|
|
770
|
+
|
|
771
|
+
```brm fragment
|
|
772
|
+
#template price(amount: number) {
|
|
773
|
+
<b>{amount}</b>
|
|
774
|
+
}
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
## BRM060: "{name}" is already declared
|
|
778
|
+
|
|
779
|
+
Two declarations of one scope have the same name.
|
|
780
|
+
|
|
781
|
+
https://brumate-docs.vercel.app/docs/errors#brm060
|
|
782
|
+
|
|
783
|
+
```brm fragment
|
|
784
|
+
let count = $signal(0);
|
|
785
|
+
let total = $signal(0);
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
## BRM061: {name} takes a handler
|
|
789
|
+
|
|
790
|
+
`prevent`, `stop`, `once`, `capture` or `transition` has no handler, or `stop`, `once` or `capture` has keys.
|
|
791
|
+
|
|
792
|
+
https://brumate-docs.vercel.app/docs/errors#brm061
|
|
793
|
+
|
|
794
|
+
```brm fragment
|
|
795
|
+
<form onSubmit=(prevent(send))></form>
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
## BRM062: Only prevent of a keyboard event takes keys, such as onKeyDown
|
|
799
|
+
|
|
800
|
+
Keys are given to `prevent` of an event that is not `onKeyDown`, `onKeyUp` or `onKeyPress`.
|
|
801
|
+
|
|
802
|
+
https://brumate-docs.vercel.app/docs/errors#brm062
|
|
803
|
+
|
|
804
|
+
```brm fragment
|
|
805
|
+
<ul onKeyDown=(prevent(move, 'ArrowDown'))></ul>
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
## BRM063: Name each key of prevent as a string of its event.key, such as 'ArrowDown', 'Space' or 'a', with a modifier to hold if it needs one, such as 'Mod+ArrowDown'
|
|
809
|
+
|
|
810
|
+
A key of `prevent` is not a string literal of an `event.key`.
|
|
811
|
+
|
|
812
|
+
https://brumate-docs.vercel.app/docs/errors#brm063
|
|
813
|
+
|
|
814
|
+
```brm fragment
|
|
815
|
+
<ul onKeyDown=(prevent(move, 'ArrowDown', 'Mod+ArrowUp'))></ul>
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
## BRM064: Name each key of prevent as a string, such as 'Enter'
|
|
819
|
+
|
|
820
|
+
A key of `prevent` is not a string literal.
|
|
821
|
+
|
|
822
|
+
https://brumate-docs.vercel.app/docs/errors#brm064
|
|
823
|
+
|
|
824
|
+
```brm fragment
|
|
825
|
+
<input onKeyDown=(prevent(submit, 'Enter'))>
|
|
826
|
+
```
|
|
827
|
+
|
|
828
|
+
## BRM065: Server function "{name}" must be async
|
|
829
|
+
|
|
830
|
+
A function with `'use server'` is not `async`.
|
|
831
|
+
|
|
832
|
+
https://brumate-docs.vercel.app/docs/errors#brm065
|
|
833
|
+
|
|
834
|
+
```brm fragment
|
|
835
|
+
async function save(list: string[]) {
|
|
836
|
+
'use server';
|
|
837
|
+
await db.save(list);
|
|
838
|
+
}
|
|
839
|
+
```
|
|
840
|
+
|
|
841
|
+
## BRM066: The module script cannot have a default export
|
|
842
|
+
|
|
843
|
+
`<script module>` has `export default`.
|
|
844
|
+
|
|
845
|
+
https://brumate-docs.vercel.app/docs/errors#brm066
|
|
846
|
+
|
|
847
|
+
```brm fragment
|
|
848
|
+
<script module>
|
|
849
|
+
export const MAX = 10;
|
|
850
|
+
</script>
|
|
851
|
+
```
|
|
852
|
+
|
|
853
|
+
## BRM067: A script cannot export values. Use <script module>
|
|
854
|
+
|
|
855
|
+
The instance script has an `export`.
|
|
856
|
+
|
|
857
|
+
https://brumate-docs.vercel.app/docs/errors#brm067
|
|
858
|
+
|
|
859
|
+
```brm fragment
|
|
860
|
+
<script module>
|
|
861
|
+
export const MAX = 10;
|
|
862
|
+
</script>
|
|
863
|
+
```
|
|
864
|
+
|
|
865
|
+
## BRM068: $title takes one argument, the title
|
|
866
|
+
|
|
867
|
+
`$title` has no argument or more than one.
|
|
868
|
+
|
|
869
|
+
https://brumate-docs.vercel.app/docs/errors#brm068
|
|
870
|
+
|
|
871
|
+
```brm fragment
|
|
872
|
+
$title('Todos');
|
|
873
|
+
```
|
|
874
|
+
|
|
875
|
+
## BRM069: await works with $memo, not {name}
|
|
876
|
+
|
|
877
|
+
A declaration awaits a compile-time function other than `$memo`.
|
|
878
|
+
|
|
879
|
+
https://brumate-docs.vercel.app/docs/errors#brm069
|
|
880
|
+
|
|
881
|
+
```brm fragment
|
|
882
|
+
const user = $memo(await load(id));
|
|
883
|
+
```
|
|
884
|
+
|
|
885
|
+
## BRM070: $props() can only be called in the component script
|
|
886
|
+
|
|
887
|
+
`$props()` is in a module script or a function.
|
|
888
|
+
|
|
889
|
+
https://brumate-docs.vercel.app/docs/errors#brm070
|
|
890
|
+
|
|
891
|
+
```brm fragment
|
|
892
|
+
const { name } = $props<{ name: string }>();
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
## BRM071: Assign $props() to a const or a let
|
|
896
|
+
|
|
897
|
+
The result of `$props()` is not assigned with `const` or `let`.
|
|
898
|
+
|
|
899
|
+
https://brumate-docs.vercel.app/docs/errors#brm071
|
|
900
|
+
|
|
901
|
+
```brm fragment
|
|
902
|
+
const { name } = $props<{ name: string }>();
|
|
903
|
+
```
|
|
904
|
+
|
|
905
|
+
## BRM072: $props() takes no arguments
|
|
906
|
+
|
|
907
|
+
`$props()` has an argument.
|
|
908
|
+
|
|
909
|
+
https://brumate-docs.vercel.app/docs/errors#brm072
|
|
910
|
+
|
|
911
|
+
```brm fragment
|
|
912
|
+
const { name } = $props<{ name: string }>();
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
## BRM073: Assign $props() to a name or an object pattern
|
|
916
|
+
|
|
917
|
+
`$props()` is assigned to an array pattern.
|
|
918
|
+
|
|
919
|
+
https://brumate-docs.vercel.app/docs/errors#brm073
|
|
920
|
+
|
|
921
|
+
```brm fragment
|
|
922
|
+
const { name } = $props<{ name: string }>();
|
|
923
|
+
```
|
|
924
|
+
|
|
925
|
+
## BRM074: Create an ID with "const name = $id()"
|
|
926
|
+
|
|
927
|
+
`$id()` is not the value of a `const`.
|
|
928
|
+
|
|
929
|
+
https://brumate-docs.vercel.app/docs/errors#brm074
|
|
930
|
+
|
|
931
|
+
```brm fragment
|
|
932
|
+
const field = $id();
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
## BRM075: $id takes no arguments
|
|
936
|
+
|
|
937
|
+
`$id` has an argument.
|
|
938
|
+
|
|
939
|
+
https://brumate-docs.vercel.app/docs/errors#brm075
|
|
940
|
+
|
|
941
|
+
```brm fragment
|
|
942
|
+
const field = $id();
|
|
943
|
+
```
|
|
944
|
+
|
|
945
|
+
## BRM076: $isPassed takes a prop that the component destructures, such as $isPassed(value)
|
|
946
|
+
|
|
947
|
+
The argument of `$isPassed` is not a prop of the component.
|
|
948
|
+
|
|
949
|
+
https://brumate-docs.vercel.app/docs/errors#brm076
|
|
950
|
+
|
|
951
|
+
```brm fragment
|
|
952
|
+
let { value } = $props<{ value?: Bindable<string> }>();
|
|
953
|
+
const passed = $isPassed(value);
|
|
954
|
+
```
|
|
955
|
+
|
|
956
|
+
## BRM077: $navigation takes no arguments
|
|
957
|
+
|
|
958
|
+
`$navigation` has an argument.
|
|
959
|
+
|
|
960
|
+
https://brumate-docs.vercel.app/docs/errors#brm077
|
|
961
|
+
|
|
962
|
+
```brm fragment
|
|
963
|
+
const navigation = $navigation();
|
|
964
|
+
```
|
|
965
|
+
|
|
966
|
+
## BRM078: $route takes at most one argument, the path of the route
|
|
967
|
+
|
|
968
|
+
`$route` has more than one argument.
|
|
969
|
+
|
|
970
|
+
https://brumate-docs.vercel.app/docs/errors#brm078
|
|
971
|
+
|
|
972
|
+
```brm fragment
|
|
973
|
+
const route = $route('/posts/[id]');
|
|
974
|
+
```
|
|
975
|
+
|
|
976
|
+
## BRM079: Read a context with "const name = $getContext(Context)"
|
|
977
|
+
|
|
978
|
+
`$getContext` is not the value of a `const`.
|
|
979
|
+
|
|
980
|
+
https://brumate-docs.vercel.app/docs/errors#brm079
|
|
981
|
+
|
|
982
|
+
```brm fragment
|
|
983
|
+
const theme = $getContext(ThemeContext);
|
|
984
|
+
```
|
|
985
|
+
|
|
986
|
+
## BRM080: $getContext takes one argument, the context
|
|
987
|
+
|
|
988
|
+
`$getContext` has no argument or more than one.
|
|
989
|
+
|
|
990
|
+
https://brumate-docs.vercel.app/docs/errors#brm080
|
|
991
|
+
|
|
992
|
+
```brm fragment
|
|
993
|
+
const theme = $getContext(ThemeContext);
|
|
994
|
+
```
|
|
995
|
+
|
|
996
|
+
## BRM081: $setContext takes two arguments, the context and the value
|
|
997
|
+
|
|
998
|
+
`$setContext` has fewer or more than two arguments.
|
|
999
|
+
|
|
1000
|
+
https://brumate-docs.vercel.app/docs/errors#brm081
|
|
1001
|
+
|
|
1002
|
+
```brm fragment
|
|
1003
|
+
$setContext(ThemeContext, theme);
|
|
1004
|
+
```
|
|
1005
|
+
|
|
1006
|
+
## BRM082: Declare the result of a form with "const name = $action(serverFunction)"
|
|
1007
|
+
|
|
1008
|
+
`$action` is not the value of a `const`.
|
|
1009
|
+
|
|
1010
|
+
https://brumate-docs.vercel.app/docs/errors#brm082
|
|
1011
|
+
|
|
1012
|
+
```brm fragment
|
|
1013
|
+
const result = $action(save);
|
|
1014
|
+
```
|
|
1015
|
+
|
|
1016
|
+
## BRM083: $action needs a server function of this file as its only argument
|
|
1017
|
+
|
|
1018
|
+
`$action` has no argument, or more than one.
|
|
1019
|
+
|
|
1020
|
+
https://brumate-docs.vercel.app/docs/errors#brm083
|
|
1021
|
+
|
|
1022
|
+
```brm fragment
|
|
1023
|
+
const result = $action(save);
|
|
1024
|
+
```
|
|
1025
|
+
|
|
1026
|
+
## BRM084: $action needs a server function of this file, and {name} is not one
|
|
1027
|
+
|
|
1028
|
+
The argument of `$action` is not a function with `'use server'` in this file.
|
|
1029
|
+
|
|
1030
|
+
https://brumate-docs.vercel.app/docs/errors#brm084
|
|
1031
|
+
|
|
1032
|
+
```brm fragment
|
|
1033
|
+
async function save(data: FormData) {
|
|
1034
|
+
'use server';
|
|
1035
|
+
}
|
|
1036
|
+
const result = $action(save);
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
## BRM085: Declare {name} with const
|
|
1040
|
+
|
|
1041
|
+
`$debounced` or `$throttled` is declared with `let`.
|
|
1042
|
+
|
|
1043
|
+
https://brumate-docs.vercel.app/docs/errors#brm085
|
|
1044
|
+
|
|
1045
|
+
```brm fragment
|
|
1046
|
+
const query = $debounced(text, 300);
|
|
1047
|
+
```
|
|
1048
|
+
|
|
1049
|
+
## BRM086: {name} cannot be destructured
|
|
1050
|
+
|
|
1051
|
+
A signal, a memo or another value of a compile-time function is declared with a pattern.
|
|
1052
|
+
|
|
1053
|
+
https://brumate-docs.vercel.app/docs/errors#brm086
|
|
1054
|
+
|
|
1055
|
+
```brm fragment
|
|
1056
|
+
let count = $signal(0);
|
|
1057
|
+
```
|
|
1058
|
+
|
|
1059
|
+
## BRM087: {name} takes a value and a wait in milliseconds
|
|
1060
|
+
|
|
1061
|
+
`$debounced` or `$throttled` does not have both arguments.
|
|
1062
|
+
|
|
1063
|
+
https://brumate-docs.vercel.app/docs/errors#brm087
|
|
1064
|
+
|
|
1065
|
+
```brm fragment
|
|
1066
|
+
const query = $debounced(text, 300);
|
|
1067
|
+
```
|
|
1068
|
+
|
|
1069
|
+
## BRM088: The wait of {name} must be a number of milliseconds, such as 300
|
|
1070
|
+
|
|
1071
|
+
The wait of `$debounced` or `$throttled` is not a number literal.
|
|
1072
|
+
|
|
1073
|
+
https://brumate-docs.vercel.app/docs/errors#brm088
|
|
1074
|
+
|
|
1075
|
+
```brm fragment
|
|
1076
|
+
const query = $debounced(text, 300);
|
|
1077
|
+
```
|
|
1078
|
+
|
|
1079
|
+
## BRM089: Declare {name} with {expected}
|
|
1080
|
+
|
|
1081
|
+
`$signal` and `$optimistic` need `let`, and `$memo` needs `const`.
|
|
1082
|
+
|
|
1083
|
+
https://brumate-docs.vercel.app/docs/errors#brm089
|
|
1084
|
+
|
|
1085
|
+
```brm fragment
|
|
1086
|
+
let count = $signal(0);
|
|
1087
|
+
const double = $memo(count * 2);
|
|
1088
|
+
```
|
|
1089
|
+
|
|
1090
|
+
## BRM090: {name} takes one argument
|
|
1091
|
+
|
|
1092
|
+
`$signal`, `$memo` or `$optimistic` has more than one argument.
|
|
1093
|
+
|
|
1094
|
+
https://brumate-docs.vercel.app/docs/errors#brm090
|
|
1095
|
+
|
|
1096
|
+
```brm fragment
|
|
1097
|
+
let count = $signal(0);
|
|
1098
|
+
```
|
|
1099
|
+
|
|
1100
|
+
## BRM091: {name} needs a value
|
|
1101
|
+
|
|
1102
|
+
`$memo` or `$optimistic` has no argument.
|
|
1103
|
+
|
|
1104
|
+
https://brumate-docs.vercel.app/docs/errors#brm091
|
|
1105
|
+
|
|
1106
|
+
```brm fragment
|
|
1107
|
+
const double = $memo(count * 2);
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
## BRM092: $optimistic needs the name of a value, such as a memo
|
|
1111
|
+
|
|
1112
|
+
The argument of `$optimistic` is not a name.
|
|
1113
|
+
|
|
1114
|
+
https://brumate-docs.vercel.app/docs/errors#brm092
|
|
1115
|
+
|
|
1116
|
+
```brm fragment
|
|
1117
|
+
let shown = $optimistic(items);
|
|
1118
|
+
```
|
|
1119
|
+
|
|
1120
|
+
## BRM093: {name} does not return a value
|
|
1121
|
+
|
|
1122
|
+
`$effect` or `$client` is assigned to a name.
|
|
1123
|
+
|
|
1124
|
+
https://brumate-docs.vercel.app/docs/errors#brm093
|
|
1125
|
+
|
|
1126
|
+
```brm fragment
|
|
1127
|
+
$effect(() => {
|
|
1128
|
+
document.title = title;
|
|
1129
|
+
});
|
|
1130
|
+
```
|
|
1131
|
+
|
|
1132
|
+
## BRM094: {name} needs a function
|
|
1133
|
+
|
|
1134
|
+
`$effect` or `$client` has no function as its callback.
|
|
1135
|
+
|
|
1136
|
+
https://brumate-docs.vercel.app/docs/errors#brm094
|
|
1137
|
+
|
|
1138
|
+
```brm fragment
|
|
1139
|
+
$effect(() => {
|
|
1140
|
+
document.title = title;
|
|
1141
|
+
});
|
|
1142
|
+
```
|
|
1143
|
+
|
|
1144
|
+
## BRM095: The callback of {name} takes no parameters
|
|
1145
|
+
|
|
1146
|
+
The callback of `$effect` or `$client` has parameters.
|
|
1147
|
+
|
|
1148
|
+
https://brumate-docs.vercel.app/docs/errors#brm095
|
|
1149
|
+
|
|
1150
|
+
```brm fragment
|
|
1151
|
+
$effect(() => {
|
|
1152
|
+
document.title = title;
|
|
1153
|
+
});
|
|
1154
|
+
```
|
|
1155
|
+
|
|
1156
|
+
## BRM096: The callback of {name} cannot be async
|
|
1157
|
+
|
|
1158
|
+
The callback of `$effect` or `$client` is `async`.
|
|
1159
|
+
|
|
1160
|
+
https://brumate-docs.vercel.app/docs/errors#brm096
|
|
1161
|
+
|
|
1162
|
+
```brm fragment
|
|
1163
|
+
$effect(() => {
|
|
1164
|
+
load(id).then((value) => (data = value));
|
|
1165
|
+
});
|
|
1166
|
+
```
|
|
1167
|
+
|
|
1168
|
+
## BRM097: $effect takes one argument
|
|
1169
|
+
|
|
1170
|
+
`$effect` has more than one argument.
|
|
1171
|
+
|
|
1172
|
+
https://brumate-docs.vercel.app/docs/errors#brm097
|
|
1173
|
+
|
|
1174
|
+
```brm fragment
|
|
1175
|
+
$effect(() => {
|
|
1176
|
+
document.title = title;
|
|
1177
|
+
});
|
|
1178
|
+
```
|
|
1179
|
+
|
|
1180
|
+
## BRM098: The trigger of $client must be "visible", "idle" or "load"
|
|
1181
|
+
|
|
1182
|
+
The second argument of `$client` is another string.
|
|
1183
|
+
|
|
1184
|
+
https://brumate-docs.vercel.app/docs/errors#brm098
|
|
1185
|
+
|
|
1186
|
+
```brm fragment
|
|
1187
|
+
$client(() => {
|
|
1188
|
+
measure();
|
|
1189
|
+
}, 'idle');
|
|
1190
|
+
```
|
|
1191
|
+
|
|
1192
|
+
## BRM099: $handler needs a function as its first argument: a function expression, a function of the script, or one of them in a wrapper of brumate/events
|
|
1193
|
+
|
|
1194
|
+
The first argument of `$handler` is not a function.
|
|
1195
|
+
|
|
1196
|
+
https://brumate-docs.vercel.app/docs/errors#brm099
|
|
1197
|
+
|
|
1198
|
+
```brm fragment
|
|
1199
|
+
onClick: $handler(prevent(removeAt), index),
|
|
1200
|
+
```
|
|
1201
|
+
|
|
1202
|
+
## BRM100: The handler reads "{name}", a value of the function around $handler, which the browser does not have. Pass it as an argument: $handler(fn, {name})
|
|
1203
|
+
|
|
1204
|
+
A handler reads a local value of the function that calls `$handler`.
|
|
1205
|
+
|
|
1206
|
+
https://brumate-docs.vercel.app/docs/errors#brm100
|
|
1207
|
+
|
|
1208
|
+
```brm fragment
|
|
1209
|
+
onClick: $handler(removeAt, index),
|
|
1210
|
+
```
|
|
1211
|
+
|
|
1212
|
+
## BRM101: The arguments of $handler cannot be spread
|
|
1213
|
+
|
|
1214
|
+
`$handler` has a spread argument.
|
|
1215
|
+
|
|
1216
|
+
https://brumate-docs.vercel.app/docs/errors#brm101
|
|
1217
|
+
|
|
1218
|
+
```brm fragment
|
|
1219
|
+
onClick: $handler(removeAt, index, kind),
|
|
1220
|
+
```
|
|
1221
|
+
|
|
1222
|
+
## BRM102: The second argument of $bind is a function that takes the new value: a function expression, or a function of the script
|
|
1223
|
+
|
|
1224
|
+
The setter of `$bind` is not a function.
|
|
1225
|
+
|
|
1226
|
+
https://brumate-docs.vercel.app/docs/errors#brm102
|
|
1227
|
+
|
|
1228
|
+
```brm fragment
|
|
1229
|
+
<Toggle on=$bind(open, (next) => (open = next)) />
|
|
1230
|
+
```
|
|
1231
|
+
|
|
1232
|
+
## BRM103: The setter reads "{name}", a value of the function around $bind, which the browser does not have
|
|
1233
|
+
|
|
1234
|
+
The setter of `$bind` reads a local value that is not a value of the component.
|
|
1235
|
+
|
|
1236
|
+
https://brumate-docs.vercel.app/docs/errors#brm103
|
|
1237
|
+
|
|
1238
|
+
```brm fragment
|
|
1239
|
+
<Toggle on=$bind(open, (next) => (open = next)) />
|
|
1240
|
+
```
|
|
1241
|
+
|
|
1242
|
+
## BRM104: Pass $bind(name) as the value of a prop of a component, or of value or checked of an input, a select or a textarea
|
|
1243
|
+
|
|
1244
|
+
`$bind` is somewhere else, such as on a `class` or a `<div>`.
|
|
1245
|
+
|
|
1246
|
+
https://brumate-docs.vercel.app/docs/errors#brm104
|
|
1247
|
+
|
|
1248
|
+
```brm fragment
|
|
1249
|
+
<input value=$bind(draft)>
|
|
1250
|
+
```
|
|
1251
|
+
|
|
1252
|
+
## BRM105: $bind takes the name of a signal, and a function that writes it, such as $bind(open) or $bind(open, (next) => (open = next))
|
|
1253
|
+
|
|
1254
|
+
`$bind` has no argument, or an argument that is not a name.
|
|
1255
|
+
|
|
1256
|
+
https://brumate-docs.vercel.app/docs/errors#brm105
|
|
1257
|
+
|
|
1258
|
+
```brm fragment
|
|
1259
|
+
<Toggle on=$bind(open) />
|
|
1260
|
+
```
|
|
1261
|
+
|
|
1262
|
+
## BRM106: $bind takes a signal, or a prop that the component destructures with let, and "{name}" is not one
|
|
1263
|
+
|
|
1264
|
+
The name in `$bind` is a memo, a const prop or another value.
|
|
1265
|
+
|
|
1266
|
+
https://brumate-docs.vercel.app/docs/errors#brm106
|
|
1267
|
+
|
|
1268
|
+
```brm fragment
|
|
1269
|
+
let open = $signal(false);
|
|
1270
|
+
<Toggle on=$bind(open) />
|
|
1271
|
+
```
|
|
1272
|
+
|
|
1273
|
+
## BRM107: $isBound takes a prop that the component destructures with let, such as $isBound(open)
|
|
1274
|
+
|
|
1275
|
+
The argument of `$isBound` is not a `let` prop.
|
|
1276
|
+
|
|
1277
|
+
https://brumate-docs.vercel.app/docs/errors#brm107
|
|
1278
|
+
|
|
1279
|
+
```brm fragment
|
|
1280
|
+
let { open } = $props<{ open?: Bindable<boolean> }>();
|
|
1281
|
+
const bound = () => $isBound(open);
|
|
1282
|
+
```
|
|
1283
|
+
|
|
1284
|
+
## BRM108: $isPending needs an async $memo as its only argument
|
|
1285
|
+
|
|
1286
|
+
The argument of `$isPending` is not a memo that holds a promise.
|
|
1287
|
+
|
|
1288
|
+
https://brumate-docs.vercel.app/docs/errors#brm108
|
|
1289
|
+
|
|
1290
|
+
```brm fragment
|
|
1291
|
+
const results = $memo(search(query));
|
|
1292
|
+
#if ($isPending(results)) {
|
|
1293
|
+
<p>Searching…</p>
|
|
1294
|
+
}
|
|
1295
|
+
```
|
|
1296
|
+
|
|
1297
|
+
## BRM109: $produce needs a signal as its first argument
|
|
1298
|
+
|
|
1299
|
+
The first argument of `$produce` is not a signal.
|
|
1300
|
+
|
|
1301
|
+
https://brumate-docs.vercel.app/docs/errors#brm109
|
|
1302
|
+
|
|
1303
|
+
```brm fragment
|
|
1304
|
+
$produce(todos, (draft) => {
|
|
1305
|
+
draft.push(todo);
|
|
1306
|
+
});
|
|
1307
|
+
```
|
|
1308
|
+
|
|
1309
|
+
## BRM110: $produce needs a recipe function as its second argument
|
|
1310
|
+
|
|
1311
|
+
The second argument of `$produce` is not a function.
|
|
1312
|
+
|
|
1313
|
+
https://brumate-docs.vercel.app/docs/errors#brm110
|
|
1314
|
+
|
|
1315
|
+
```brm fragment
|
|
1316
|
+
$produce(todos, (draft) => {
|
|
1317
|
+
draft.push(todo);
|
|
1318
|
+
});
|
|
1319
|
+
```
|
|
1320
|
+
|
|
1321
|
+
## BRM111: "{name}" is reserved. Brumate writes the attributes that start with "b-"
|
|
1322
|
+
|
|
1323
|
+
An attribute starts with `b-`.
|
|
1324
|
+
|
|
1325
|
+
https://brumate-docs.vercel.app/docs/errors#brm111
|
|
1326
|
+
|
|
1327
|
+
```brm fragment
|
|
1328
|
+
<div data-id=id></div>
|
|
1329
|
+
```
|
|
1330
|
+
|
|
1331
|
+
## BRM112: "{name}" is not declared
|
|
1332
|
+
|
|
1333
|
+
The name in `ref=$bind(name)` is not a value of the component.
|
|
1334
|
+
|
|
1335
|
+
https://brumate-docs.vercel.app/docs/errors#brm112
|
|
1336
|
+
|
|
1337
|
+
```brm fragment
|
|
1338
|
+
let input = $signal<HTMLInputElement>();
|
|
1339
|
+
<input ref=$bind(input)>
|
|
1340
|
+
```
|
|
1341
|
+
|
|
1342
|
+
## BRM113: ref takes a $signal, or a prop that the component destructures with let, but "{name}" is {kind}
|
|
1343
|
+
|
|
1344
|
+
The name in `ref=$bind(name)` is a memo, a const prop or another value.
|
|
1345
|
+
|
|
1346
|
+
https://brumate-docs.vercel.app/docs/errors#brm113
|
|
1347
|
+
|
|
1348
|
+
```brm fragment
|
|
1349
|
+
let input = $signal<HTMLInputElement>();
|
|
1350
|
+
<input ref=$bind(input)>
|
|
1351
|
+
```
|
|
1352
|
+
|
|
1353
|
+
## BRM114: The prop "{name}" is not Bindable. Type it as Bindable<HTMLElement>, so a parent can bind it
|
|
1354
|
+
|
|
1355
|
+
A `let` prop is used as a `ref` and its type is not `Bindable`.
|
|
1356
|
+
|
|
1357
|
+
https://brumate-docs.vercel.app/docs/errors#brm114
|
|
1358
|
+
|
|
1359
|
+
```brm fragment
|
|
1360
|
+
let { ref } = $props<{ ref?: Bindable<HTMLButtonElement> }>();
|
|
1361
|
+
```
|
|
1362
|
+
|
|
1363
|
+
## BRM115: "{name}" is the props object, so read one key at a time, destructure it, or spread it in markup
|
|
1364
|
+
|
|
1365
|
+
The props object or the rest of `$props()` is used as a whole outside a markup spread: spread in code, passed to a function, `$memo`, `$setContext`, a signal or a variable, or given as a value in markup, such as `title=rest` or `<Badge {rest} />`. The copy loses the `ref` and the live props.
|
|
1366
|
+
|
|
1367
|
+
https://brumate-docs.vercel.app/docs/errors#brm115
|
|
1368
|
+
|
|
1369
|
+
```brm fragment
|
|
1370
|
+
const { class: className, ...rest } = $props();
|
|
1371
|
+
<button {...rest} class=className>
|
|
1372
|
+
```
|
|
1373
|
+
|
|
1374
|
+
## BRM116: "{name}" is the props object, and props are read-only. Copy the key to a $signal or a $memo to change it
|
|
1375
|
+
|
|
1376
|
+
Code assigns to, updates or deletes a key of the props object or of the rest of `$props()`.
|
|
1377
|
+
|
|
1378
|
+
https://brumate-docs.vercel.app/docs/errors#brm116
|
|
1379
|
+
|
|
1380
|
+
```brm fragment
|
|
1381
|
+
let title = $signal('');
|
|
1382
|
+
title = 'New';
|
|
1383
|
+
```
|
|
1384
|
+
|
|
1385
|
+
## BRM117: Cannot assign to {kind} "{name}"
|
|
1386
|
+
|
|
1387
|
+
Code writes a memo, a const prop or another value that cannot change.
|
|
1388
|
+
|
|
1389
|
+
https://brumate-docs.vercel.app/docs/errors#brm117
|
|
1390
|
+
|
|
1391
|
+
```brm fragment
|
|
1392
|
+
let count = $signal(0);
|
|
1393
|
+
count = 5;
|
|
1394
|
+
```
|
|
1395
|
+
|
|
1396
|
+
## BRM118: Signal "{name}" can only be written in event handlers, effects, $client callbacks and functions
|
|
1397
|
+
|
|
1398
|
+
Setup code, which runs on the server, writes a signal.
|
|
1399
|
+
|
|
1400
|
+
https://brumate-docs.vercel.app/docs/errors#brm118
|
|
1401
|
+
|
|
1402
|
+
```brm fragment
|
|
1403
|
+
let count = $signal(5);
|
|
1404
|
+
```
|
|
1405
|
+
|
|
1406
|
+
## BRM119: Server function "{name}" captures "{variable}". Pass it as an argument
|
|
1407
|
+
|
|
1408
|
+
A server function reads a variable of the instance script.
|
|
1409
|
+
|
|
1410
|
+
https://brumate-docs.vercel.app/docs/errors#brm119
|
|
1411
|
+
|
|
1412
|
+
```brm fragment
|
|
1413
|
+
async function save(user: string) {
|
|
1414
|
+
'use server';
|
|
1415
|
+
}
|
|
1416
|
+
```
|
|
1417
|
+
|
|
1418
|
+
## BRM120: $optimistic follows a memo, an action or a prop, not a signal
|
|
1419
|
+
|
|
1420
|
+
The source of `$optimistic` is a signal.
|
|
1421
|
+
|
|
1422
|
+
https://brumate-docs.vercel.app/docs/errors#brm120
|
|
1423
|
+
|
|
1424
|
+
```brm fragment
|
|
1425
|
+
let shown = $optimistic(items);
|
|
1426
|
+
```
|
|
1427
|
+
|
|
1428
|
+
## BRM121: Declare server functions at the top level of a script
|
|
1429
|
+
|
|
1430
|
+
A function with `'use server'` is inside another function or a block.
|
|
1431
|
+
|
|
1432
|
+
https://brumate-docs.vercel.app/docs/errors#brm121
|
|
1433
|
+
|
|
1434
|
+
```brm fragment
|
|
1435
|
+
async function save() {
|
|
1436
|
+
'use server';
|
|
1437
|
+
}
|
|
1438
|
+
```
|
|
1439
|
+
|
|
1440
|
+
## BRM122: {name} cannot be used here
|
|
1441
|
+
|
|
1442
|
+
A compile-time function is used where it is not allowed.
|
|
1443
|
+
|
|
1444
|
+
https://brumate-docs.vercel.app/docs/errors#brm122
|
|
1445
|
+
|
|
1446
|
+
```brm fragment
|
|
1447
|
+
let count = $signal(0);
|
|
1448
|
+
```
|
|
1449
|
+
|
|
1450
|
+
## BRM123: Call $setContext at the top level of a script
|
|
1451
|
+
|
|
1452
|
+
`$setContext` is inside a function or a block of code.
|
|
1453
|
+
|
|
1454
|
+
https://brumate-docs.vercel.app/docs/errors#brm123
|
|
1455
|
+
|
|
1456
|
+
```brm fragment
|
|
1457
|
+
$setContext(ThemeContext, theme);
|
|
1458
|
+
```
|
|
1459
|
+
|
|
1460
|
+
## BRM124: Call $title at the top level of a script
|
|
1461
|
+
|
|
1462
|
+
`$title` is inside a function or a block of code.
|
|
1463
|
+
|
|
1464
|
+
https://brumate-docs.vercel.app/docs/errors#brm124
|
|
1465
|
+
|
|
1466
|
+
```brm fragment
|
|
1467
|
+
$title('Todos');
|
|
1468
|
+
```
|
|
1469
|
+
|
|
1470
|
+
## BRM125: Create an ID with "const name = $id()" at the top level of a script
|
|
1471
|
+
|
|
1472
|
+
`$id` is inside a function or a block of code.
|
|
1473
|
+
|
|
1474
|
+
https://brumate-docs.vercel.app/docs/errors#brm125
|
|
1475
|
+
|
|
1476
|
+
```brm fragment
|
|
1477
|
+
const field = $id();
|
|
1478
|
+
```
|
|
1479
|
+
|
|
1480
|
+
## BRM126: Check a prop with "const name = $isPassed(prop)" at the top level of the component script
|
|
1481
|
+
|
|
1482
|
+
`$isPassed` is inside a function or a block of code.
|
|
1483
|
+
|
|
1484
|
+
https://brumate-docs.vercel.app/docs/errors#brm126
|
|
1485
|
+
|
|
1486
|
+
```brm fragment
|
|
1487
|
+
const passed = $isPassed(value);
|
|
1488
|
+
```
|
|
1489
|
+
|
|
1490
|
+
## BRM127: Read a context with "const name = $getContext(Context)" at the top level of a script
|
|
1491
|
+
|
|
1492
|
+
`$getContext` is inside a function or a block of code.
|
|
1493
|
+
|
|
1494
|
+
https://brumate-docs.vercel.app/docs/errors#brm127
|
|
1495
|
+
|
|
1496
|
+
```brm fragment
|
|
1497
|
+
const theme = $getContext(ThemeContext);
|
|
1498
|
+
```
|
|
1499
|
+
|
|
1500
|
+
## BRM128: Read the route with "const name = $route()" at the top level of a script
|
|
1501
|
+
|
|
1502
|
+
`$route` is inside a function or a block of code.
|
|
1503
|
+
|
|
1504
|
+
https://brumate-docs.vercel.app/docs/errors#brm128
|
|
1505
|
+
|
|
1506
|
+
```brm fragment
|
|
1507
|
+
const route = $route();
|
|
1508
|
+
```
|
|
1509
|
+
|
|
1510
|
+
## BRM129: Read the navigation with "const name = $navigation()" at the top level of a script
|
|
1511
|
+
|
|
1512
|
+
`$navigation` is inside a function or a block of code.
|
|
1513
|
+
|
|
1514
|
+
https://brumate-docs.vercel.app/docs/errors#brm129
|
|
1515
|
+
|
|
1516
|
+
```brm fragment
|
|
1517
|
+
const navigation = $navigation();
|
|
1518
|
+
```
|
|
1519
|
+
|
|
1520
|
+
## BRM130: Call $props() as the value of a const in the component script
|
|
1521
|
+
|
|
1522
|
+
`$props` is used in another place than `const { … } = $props()`.
|
|
1523
|
+
|
|
1524
|
+
https://brumate-docs.vercel.app/docs/errors#brm130
|
|
1525
|
+
|
|
1526
|
+
```brm fragment
|
|
1527
|
+
const { name } = $props<{ name: string }>();
|
|
1528
|
+
```
|
|
1529
|
+
|
|
1530
|
+
## BRM131: Declare a signal with "let name = $signal(value)" at the top level of a script
|
|
1531
|
+
|
|
1532
|
+
`$signal` is inside a function or a block of code.
|
|
1533
|
+
|
|
1534
|
+
https://brumate-docs.vercel.app/docs/errors#brm131
|
|
1535
|
+
|
|
1536
|
+
```brm fragment
|
|
1537
|
+
let count = $signal(0);
|
|
1538
|
+
```
|
|
1539
|
+
|
|
1540
|
+
## BRM132: Declare a memo with "const name = $memo(value)" at the top level of a script
|
|
1541
|
+
|
|
1542
|
+
`$memo` is inside a function or a block of code.
|
|
1543
|
+
|
|
1544
|
+
https://brumate-docs.vercel.app/docs/errors#brm132
|
|
1545
|
+
|
|
1546
|
+
```brm fragment
|
|
1547
|
+
const double = $memo(count * 2);
|
|
1548
|
+
```
|
|
1549
|
+
|
|
1550
|
+
## BRM133: Declare a debounced value with "const name = $debounced(value, ms)" at the top level of a script
|
|
1551
|
+
|
|
1552
|
+
`$debounced` is inside a function or a block of code.
|
|
1553
|
+
|
|
1554
|
+
https://brumate-docs.vercel.app/docs/errors#brm133
|
|
1555
|
+
|
|
1556
|
+
```brm fragment
|
|
1557
|
+
const query = $debounced(text, 300);
|
|
1558
|
+
```
|
|
1559
|
+
|
|
1560
|
+
## BRM134: Declare a throttled value with "const name = $throttled(value, ms)" at the top level of a script
|
|
1561
|
+
|
|
1562
|
+
`$throttled` is inside a function or a block of code.
|
|
1563
|
+
|
|
1564
|
+
https://brumate-docs.vercel.app/docs/errors#brm134
|
|
1565
|
+
|
|
1566
|
+
```brm fragment
|
|
1567
|
+
const position = $throttled(pointer, 100);
|
|
1568
|
+
```
|
|
1569
|
+
|
|
1570
|
+
## BRM135: Declare an optimistic value with "let name = $optimistic(source)" at the top level of a script
|
|
1571
|
+
|
|
1572
|
+
`$optimistic` is inside a function or a block of code.
|
|
1573
|
+
|
|
1574
|
+
https://brumate-docs.vercel.app/docs/errors#brm135
|
|
1575
|
+
|
|
1576
|
+
```brm fragment
|
|
1577
|
+
let shown = $optimistic(items);
|
|
1578
|
+
```
|
|
1579
|
+
|
|
1580
|
+
## BRM136: Declare the result of a form with "const name = $action(serverFunction)" at the top level of a script
|
|
1581
|
+
|
|
1582
|
+
`$action` is inside a function or a block of code.
|
|
1583
|
+
|
|
1584
|
+
https://brumate-docs.vercel.app/docs/errors#brm136
|
|
1585
|
+
|
|
1586
|
+
```brm fragment
|
|
1587
|
+
const result = $action(save);
|
|
1588
|
+
```
|
|
1589
|
+
|
|
1590
|
+
## BRM137: Call $effect at the top level of a script
|
|
1591
|
+
|
|
1592
|
+
`$effect` is inside a function or a block of code.
|
|
1593
|
+
|
|
1594
|
+
https://brumate-docs.vercel.app/docs/errors#brm137
|
|
1595
|
+
|
|
1596
|
+
```brm fragment
|
|
1597
|
+
$effect(() => {
|
|
1598
|
+
document.title = title;
|
|
1599
|
+
});
|
|
1600
|
+
```
|
|
1601
|
+
|
|
1602
|
+
## BRM138: Call $client at the top level of a script
|
|
1603
|
+
|
|
1604
|
+
`$client` is inside a function or a block of code.
|
|
1605
|
+
|
|
1606
|
+
https://brumate-docs.vercel.app/docs/errors#brm138
|
|
1607
|
+
|
|
1608
|
+
```brm fragment
|
|
1609
|
+
$client(() => {
|
|
1610
|
+
measure();
|
|
1611
|
+
}, 'idle');
|
|
1612
|
+
```
|
|
1613
|
+
|
|
1614
|
+
## BRM139: $ref is not supported. Use a $signal with ref=$bind(name)
|
|
1615
|
+
|
|
1616
|
+
`$ref` was removed.
|
|
1617
|
+
|
|
1618
|
+
https://brumate-docs.vercel.app/docs/errors#brm139
|
|
1619
|
+
|
|
1620
|
+
```brm fragment
|
|
1621
|
+
let input = $signal<HTMLInputElement>();
|
|
1622
|
+
<input ref=$bind(input)>
|
|
1623
|
+
```
|
|
1624
|
+
|
|
1625
|
+
## BRM140: $watch is not supported. Use $effect
|
|
1626
|
+
|
|
1627
|
+
`$watch` was removed.
|
|
1628
|
+
|
|
1629
|
+
https://brumate-docs.vercel.app/docs/errors#brm140
|
|
1630
|
+
|
|
1631
|
+
```brm fragment
|
|
1632
|
+
$effect(() => {
|
|
1633
|
+
save(value);
|
|
1634
|
+
});
|
|
1635
|
+
```
|
|
1636
|
+
|
|
1637
|
+
## BRM141: $settled is not supported. Use $client
|
|
1638
|
+
|
|
1639
|
+
`$settled` was removed.
|
|
1640
|
+
|
|
1641
|
+
https://brumate-docs.vercel.app/docs/errors#brm141
|
|
1642
|
+
|
|
1643
|
+
```brm fragment
|
|
1644
|
+
$client(() => {
|
|
1645
|
+
measure();
|
|
1646
|
+
});
|
|
1647
|
+
```
|
|
1648
|
+
|
|
1649
|
+
## BRM142: $cleanup is not supported. Return a cleanup function from $effect or $client
|
|
1650
|
+
|
|
1651
|
+
`$cleanup` was removed.
|
|
1652
|
+
|
|
1653
|
+
https://brumate-docs.vercel.app/docs/errors#brm142
|
|
1654
|
+
|
|
1655
|
+
```brm fragment
|
|
1656
|
+
$effect(() => {
|
|
1657
|
+
const timer = setInterval(tick, 1000);
|
|
1658
|
+
return () => clearInterval(timer);
|
|
1659
|
+
});
|
|
1660
|
+
```
|
|
1661
|
+
|
|
1662
|
+
## BRM143: $store is not supported yet
|
|
1663
|
+
|
|
1664
|
+
`$store` does not exist.
|
|
1665
|
+
|
|
1666
|
+
https://brumate-docs.vercel.app/docs/errors#brm143
|
|
1667
|
+
|
|
1668
|
+
```brm fragment
|
|
1669
|
+
let todos = $signal([]);
|
|
1670
|
+
```
|
|
1671
|
+
|
|
1672
|
+
## BRM144: $get is not supported. Signals cannot leave the file
|
|
1673
|
+
|
|
1674
|
+
`$get` was removed. A signal never leaves its file.
|
|
1675
|
+
|
|
1676
|
+
https://brumate-docs.vercel.app/docs/errors#brm144
|
|
1677
|
+
|
|
1678
|
+
```brm fragment
|
|
1679
|
+
// Pass the value, or a function that writes it.
|
|
1680
|
+
onChange=((next) => (count = next))
|
|
1681
|
+
```
|
|
1682
|
+
|
|
1683
|
+
## BRM145: $set is not supported. Signals cannot leave the file
|
|
1684
|
+
|
|
1685
|
+
`$set` was removed. A signal never leaves its file.
|
|
1686
|
+
|
|
1687
|
+
https://brumate-docs.vercel.app/docs/errors#brm145
|
|
1688
|
+
|
|
1689
|
+
```brm fragment
|
|
1690
|
+
// Pass the value, or a function that writes it.
|
|
1691
|
+
onChange=((next) => (count = next))
|
|
1692
|
+
```
|
|
1693
|
+
|
|
1694
|
+
## BRM146: {name} was renamed to {renamed}. Import {renamed} from '{module}'
|
|
1695
|
+
|
|
1696
|
+
The file imports a name that the compiler knew before it was renamed.
|
|
1697
|
+
|
|
1698
|
+
https://brumate-docs.vercel.app/docs/errors#brm146
|
|
1699
|
+
|
|
1700
|
+
```brm fragment
|
|
1701
|
+
import { $signal } from 'brumate/signals';
|
|
1702
|
+
```
|
|
1703
|
+
|
|
1704
|
+
## BRM147: Import {name} from '{module}'
|
|
1705
|
+
|
|
1706
|
+
The file calls a compile-time function that it does not import.
|
|
1707
|
+
|
|
1708
|
+
https://brumate-docs.vercel.app/docs/errors#brm147
|
|
1709
|
+
|
|
1710
|
+
```brm fragment
|
|
1711
|
+
import { $signal } from 'brumate/signals';
|
|
1712
|
+
```
|
|
1713
|
+
|
|
1714
|
+
## BRM148: "{name}" holds a new {kind}, which cannot be sent to the browser, and code that runs in the browser reads it{reader}. Use it in a server function, or create it in the browser, such as in $client
|
|
1715
|
+
|
|
1716
|
+
A value that cannot be sent to the browser, such as a database client, is read by code that runs there.
|
|
1717
|
+
|
|
1718
|
+
https://brumate-docs.vercel.app/docs/errors#brm148
|
|
1719
|
+
|
|
1720
|
+
```brm fragment
|
|
1721
|
+
async function list() {
|
|
1722
|
+
'use server';
|
|
1723
|
+
return db.all();
|
|
1724
|
+
}
|
|
1725
|
+
```
|
|
1726
|
+
|
|
1727
|
+
## BRM149: {what} is read by code that runs in the browser ({site}). Read it in a server function
|
|
1728
|
+
|
|
1729
|
+
Code that runs in the browser reads an environment variable of the server.
|
|
1730
|
+
|
|
1731
|
+
https://brumate-docs.vercel.app/docs/errors#brm149
|
|
1732
|
+
|
|
1733
|
+
```brm fragment
|
|
1734
|
+
async function key() {
|
|
1735
|
+
'use server';
|
|
1736
|
+
return env.API_KEY;
|
|
1737
|
+
}
|
|
1738
|
+
```
|
|
1739
|
+
|
|
1740
|
+
## BRM150: "{name}" holds {what} and code that runs in the browser reads it. Keep server variables out of values that the browser reads
|
|
1741
|
+
|
|
1742
|
+
A value holds an environment variable of the server, and the browser reads the value.
|
|
1743
|
+
|
|
1744
|
+
https://brumate-docs.vercel.app/docs/errors#brm150
|
|
1745
|
+
|
|
1746
|
+
```brm fragment
|
|
1747
|
+
async function key() {
|
|
1748
|
+
'use server';
|
|
1749
|
+
return env.API_KEY;
|
|
1750
|
+
}
|
|
1751
|
+
```
|
|
1752
|
+
|
|
1753
|
+
## BRM151: #defer cannot be inside a #client body
|
|
1754
|
+
|
|
1755
|
+
A `#defer` is in markup that only the browser renders.
|
|
1756
|
+
|
|
1757
|
+
https://brumate-docs.vercel.app/docs/errors#brm151
|
|
1758
|
+
|
|
1759
|
+
```brm fragment
|
|
1760
|
+
#defer {
|
|
1761
|
+
<Comments />
|
|
1762
|
+
}
|
|
1763
|
+
```
|
|
1764
|
+
|
|
1765
|
+
## BRM152: #defer cannot be in markup that the browser renders
|
|
1766
|
+
|
|
1767
|
+
A `#defer` is in a body that the browser adds later, such as the body of a changing `#if`.
|
|
1768
|
+
|
|
1769
|
+
https://brumate-docs.vercel.app/docs/errors#brm152
|
|
1770
|
+
|
|
1771
|
+
```brm fragment
|
|
1772
|
+
#defer {
|
|
1773
|
+
<Comments />
|
|
1774
|
+
}
|
|
1775
|
+
```
|
|
1776
|
+
|
|
1777
|
+
## BRM153: A value that changes in <{tag}> must be its whole content, such as <{tag}>{`Count ${count}`}</{tag}>
|
|
1778
|
+
|
|
1779
|
+
A `<title>`, `<textarea>`, `<style>` or `<script>` holds a changing value next to other content.
|
|
1780
|
+
|
|
1781
|
+
https://brumate-docs.vercel.app/docs/errors#brm153
|
|
1782
|
+
|
|
1783
|
+
```brm fragment
|
|
1784
|
+
<textarea>{`Count ${count}`}</textarea>
|
|
1785
|
+
```
|
|
1786
|
+
|
|
1787
|
+
## BRM154: Put <title> in #head, as <meta> and <link>, such as #head { <title>{`${count} left`}</title> }
|
|
1788
|
+
|
|
1789
|
+
A `<title>` is outside `#head`.
|
|
1790
|
+
|
|
1791
|
+
https://brumate-docs.vercel.app/docs/errors#brm154
|
|
1792
|
+
|
|
1793
|
+
```brm fragment
|
|
1794
|
+
#head {
|
|
1795
|
+
<title>{`${count} left`}</title>
|
|
1796
|
+
}
|
|
1797
|
+
```
|
|
1798
|
+
|
|
1799
|
+
## BRM155: A dynamic tag that changes on the client is not supported yet
|
|
1800
|
+
|
|
1801
|
+
No `.brm` file reaches it today: the parser keys every dynamic tag, and a `<{tag}>` whose tag a handler changes compiles. It is kept for a tag that the compiler could not update.
|
|
1802
|
+
|
|
1803
|
+
https://brumate-docs.vercel.app/docs/errors#brm155
|
|
1804
|
+
|
|
1805
|
+
```brm fragment
|
|
1806
|
+
<{tag} class="title">Title</>
|
|
1807
|
+
```
|
|
1808
|
+
|
|
1809
|
+
## BRM156: Code that the browser updates can await only a memo. Load the promise in a memo instead
|
|
1810
|
+
|
|
1811
|
+
Code that runs again in the browser awaits something other than a memo.
|
|
1812
|
+
|
|
1813
|
+
https://brumate-docs.vercel.app/docs/errors#brm156
|
|
1814
|
+
|
|
1815
|
+
```brm fragment
|
|
1816
|
+
const user = $memo(await load(id));
|
|
1817
|
+
```
|
|
1818
|
+
|
|
1819
|
+
## BRM157: Markup that the browser renders can await only a memo. Load the promise in a memo instead
|
|
1820
|
+
|
|
1821
|
+
Markup that the browser renders awaits something other than a memo.
|
|
1822
|
+
|
|
1823
|
+
https://brumate-docs.vercel.app/docs/errors#brm157
|
|
1824
|
+
|
|
1825
|
+
```brm fragment
|
|
1826
|
+
const user = $memo(await load(id));
|
|
1827
|
+
```
|
|
1828
|
+
|
|
1829
|
+
## BRM158: This attribute cannot change on the client yet
|
|
1830
|
+
|
|
1831
|
+
The name or the value of an attribute with a computed name, as in `[name]=value`, changes in the browser.
|
|
1832
|
+
|
|
1833
|
+
https://brumate-docs.vercel.app/docs/errors#brm158
|
|
1834
|
+
|
|
1835
|
+
```brm fragment
|
|
1836
|
+
<div class=(open ? "open" : "closed")></div>
|
|
1837
|
+
```
|
|
1838
|
+
|
|
1839
|
+
## BRM159: This computed attribute has a name or value with no code in the browser, so it cannot stay when the attributes of the element update
|
|
1840
|
+
|
|
1841
|
+
An element has a computed attribute, as in `[name]=(value)`, and a spread or another computed attribute that can change. The name or the value is a constant, or a signal that nothing writes, so the browser has no code for it, and an update of the element would remove the attribute. Make both a signal that the page writes, or write the attribute without brackets.
|
|
1842
|
+
|
|
1843
|
+
https://brumate-docs.vercel.app/docs/errors#brm159
|
|
1844
|
+
|
|
1845
|
+
```brm fragment
|
|
1846
|
+
let name = $signal('data-x');
|
|
1847
|
+
let value = $signal('on');
|
|
1848
|
+
|
|
1849
|
+
<button onClick=(() => ((name = 'data-y'), (value = 'off')))>Change</button>
|
|
1850
|
+
<p {...props} [name]=(value)></p>
|
|
1851
|
+
<p {...props} data-x="on"></p>
|
|
1852
|
+
```
|
|
1853
|
+
|
|
1854
|
+
## BRM160: Destructuring assignment to a signal is not supported in client code yet
|
|
1855
|
+
|
|
1856
|
+
Code that runs in the browser writes a signal in a destructuring assignment.
|
|
1857
|
+
|
|
1858
|
+
https://brumate-docs.vercel.app/docs/errors#brm160
|
|
1859
|
+
|
|
1860
|
+
```brm fragment
|
|
1861
|
+
[first, second] = pair;
|
|
1862
|
+
// Write each signal on its own:
|
|
1863
|
+
first = pair[0];
|
|
1864
|
+
second = pair[1];
|
|
1865
|
+
```
|
|
1866
|
+
|
|
1867
|
+
## BRM161: Assign to "{name}" with = instead of {op}
|
|
1868
|
+
|
|
1869
|
+
An optimistic value is changed with `++` or `--`.
|
|
1870
|
+
|
|
1871
|
+
https://brumate-docs.vercel.app/docs/errors#brm161
|
|
1872
|
+
|
|
1873
|
+
```brm fragment
|
|
1874
|
+
shown = shown + 1;
|
|
1875
|
+
```
|
|
1876
|
+
|
|
1877
|
+
## BRM162: Invalid CSS: {message}
|
|
1878
|
+
|
|
1879
|
+
A `<style>` has CSS that does not parse.
|
|
1880
|
+
|
|
1881
|
+
https://brumate-docs.vercel.app/docs/errors#brm162
|
|
1882
|
+
|
|
1883
|
+
```brm fragment
|
|
1884
|
+
<style>
|
|
1885
|
+
p {
|
|
1886
|
+
color: red;
|
|
1887
|
+
}
|
|
1888
|
+
</style>
|
|
1889
|
+
```
|
|
1890
|
+
|
|
1891
|
+
## BRM163: Module functions call each other too deeply. A module function cannot call itself
|
|
1892
|
+
|
|
1893
|
+
A function of a module of reactive logic calls itself, or a loop of functions call each other.
|
|
1894
|
+
|
|
1895
|
+
https://brumate-docs.vercel.app/docs/errors#brm163
|
|
1896
|
+
|
|
1897
|
+
```brm fragment
|
|
1898
|
+
function counter(start: number) {
|
|
1899
|
+
let count = $signal(start);
|
|
1900
|
+
return { count };
|
|
1901
|
+
}
|
|
1902
|
+
```
|
|
1903
|
+
|
|
1904
|
+
## BRM164: Destructure what {name} returns, as in const { value } = {name}(…)
|
|
1905
|
+
|
|
1906
|
+
The result of a module function is kept as one object.
|
|
1907
|
+
|
|
1908
|
+
https://brumate-docs.vercel.app/docs/errors#brm164
|
|
1909
|
+
|
|
1910
|
+
```brm fragment
|
|
1911
|
+
const { count, increment } = counter(0);
|
|
1912
|
+
```
|
|
1913
|
+
|
|
1914
|
+
## BRM165: Declare what {name} returns with const
|
|
1915
|
+
|
|
1916
|
+
The result of a module function is declared with `let`.
|
|
1917
|
+
|
|
1918
|
+
https://brumate-docs.vercel.app/docs/errors#brm165
|
|
1919
|
+
|
|
1920
|
+
```brm fragment
|
|
1921
|
+
const { count, increment } = counter(0);
|
|
1922
|
+
```
|
|
1923
|
+
|
|
1924
|
+
## BRM166: Call {name} at the top level of a script, as in const { value } = {name}(…). Its signals become values of the component, so it cannot run in a function, a condition or a loop
|
|
1925
|
+
|
|
1926
|
+
A module function is called inside a function, a condition or a loop.
|
|
1927
|
+
|
|
1928
|
+
https://brumate-docs.vercel.app/docs/errors#brm166
|
|
1929
|
+
|
|
1930
|
+
```brm fragment
|
|
1931
|
+
const { count, increment } = counter(0);
|
|
1932
|
+
```
|
|
1933
|
+
|
|
1934
|
+
## BRM167: Cannot read {specifier}
|
|
1935
|
+
|
|
1936
|
+
The module that the component imports is not on disk.
|
|
1937
|
+
|
|
1938
|
+
https://brumate-docs.vercel.app/docs/errors#brm167
|
|
1939
|
+
|
|
1940
|
+
```brm fragment
|
|
1941
|
+
import { counter } from './counter.brm.ts';
|
|
1942
|
+
```
|
|
1943
|
+
|
|
1944
|
+
## BRM168: {specifier} does not export a function named {name}
|
|
1945
|
+
|
|
1946
|
+
The import names a function that the module does not export.
|
|
1947
|
+
|
|
1948
|
+
https://brumate-docs.vercel.app/docs/errors#brm168
|
|
1949
|
+
|
|
1950
|
+
```brm fragment
|
|
1951
|
+
export function counter(start: number) {
|
|
1952
|
+
let count = $signal(start);
|
|
1953
|
+
return { count };
|
|
1954
|
+
}
|
|
1955
|
+
```
|
|
1956
|
+
|
|
1957
|
+
## BRM169: {name} needs a body that ends with return { … }
|
|
1958
|
+
|
|
1959
|
+
A module function is an arrow function with an expression body.
|
|
1960
|
+
|
|
1961
|
+
https://brumate-docs.vercel.app/docs/errors#brm169
|
|
1962
|
+
|
|
1963
|
+
```brm fragment
|
|
1964
|
+
export function counter(start: number) {
|
|
1965
|
+
let count = $signal(start);
|
|
1966
|
+
return { count };
|
|
1967
|
+
}
|
|
1968
|
+
```
|
|
1969
|
+
|
|
1970
|
+
## BRM170: {name} must end with return { … }, an object of what it gives
|
|
1971
|
+
|
|
1972
|
+
A module function does not end with `return { … }`.
|
|
1973
|
+
|
|
1974
|
+
https://brumate-docs.vercel.app/docs/errors#brm170
|
|
1975
|
+
|
|
1976
|
+
```brm fragment
|
|
1977
|
+
export function counter(start: number) {
|
|
1978
|
+
let count = $signal(start);
|
|
1979
|
+
return { count };
|
|
1980
|
+
}
|
|
1981
|
+
```
|
|
1982
|
+
|
|
1983
|
+
## BRM171: {name} can return only at its end
|
|
1984
|
+
|
|
1985
|
+
A module function returns in the middle of its body.
|
|
1986
|
+
|
|
1987
|
+
https://brumate-docs.vercel.app/docs/errors#brm171
|
|
1988
|
+
|
|
1989
|
+
```brm fragment
|
|
1990
|
+
export function counter(start: number) {
|
|
1991
|
+
let count = $signal(start);
|
|
1992
|
+
return { count };
|
|
1993
|
+
}
|
|
1994
|
+
```
|
|
1995
|
+
|
|
1996
|
+
## BRM172: Destructure {name} with plain names, as in const { value, other: renamed } = {name}(…)
|
|
1997
|
+
|
|
1998
|
+
The result of a module function is destructured with a default, a nested pattern or a rest.
|
|
1999
|
+
|
|
2000
|
+
https://brumate-docs.vercel.app/docs/errors#brm172
|
|
2001
|
+
|
|
2002
|
+
```brm fragment
|
|
2003
|
+
const { count, increment: add } = counter(0);
|
|
2004
|
+
```
|
|
2005
|
+
|
|
2006
|
+
## BRM173: {name} must return an object with plain keys
|
|
2007
|
+
|
|
2008
|
+
The returned object has a computed key, a spread or a method.
|
|
2009
|
+
|
|
2010
|
+
https://brumate-docs.vercel.app/docs/errors#brm173
|
|
2011
|
+
|
|
2012
|
+
```brm fragment
|
|
2013
|
+
return { count, increment };
|
|
2014
|
+
```
|
|
2015
|
+
|
|
2016
|
+
## BRM174: {name} cannot return getters or setters. Return the values themselves
|
|
2017
|
+
|
|
2018
|
+
The returned object has a getter or a setter.
|
|
2019
|
+
|
|
2020
|
+
https://brumate-docs.vercel.app/docs/errors#brm174
|
|
2021
|
+
|
|
2022
|
+
```brm fragment
|
|
2023
|
+
return { count, increment };
|
|
2024
|
+
```
|
|
2025
|
+
|
|
2026
|
+
## BRM175: {name} does not return {key}
|
|
2027
|
+
|
|
2028
|
+
The component destructures a name that the module function does not return.
|
|
2029
|
+
|
|
2030
|
+
https://brumate-docs.vercel.app/docs/errors#brm175
|
|
2031
|
+
|
|
2032
|
+
```brm fragment
|
|
2033
|
+
const { count } = counter(0);
|
|
2034
|
+
```
|
|
2035
|
+
|
|
2036
|
+
## BRM176: {name} returns {local} as {first} and as {key}. Return each local once, and give the other key a function of its own
|
|
2037
|
+
|
|
2038
|
+
A module function returns one local under two keys.
|
|
2039
|
+
|
|
2040
|
+
https://brumate-docs.vercel.app/docs/errors#brm176
|
|
2041
|
+
|
|
2042
|
+
```brm fragment
|
|
2043
|
+
return { count, increment };
|
|
2044
|
+
```
|
|
2045
|
+
|
|
2046
|
+
## BRM177: {name} is declared twice
|
|
2047
|
+
|
|
2048
|
+
A name of the module function is also a name of the component.
|
|
2049
|
+
|
|
2050
|
+
https://brumate-docs.vercel.app/docs/errors#brm177
|
|
2051
|
+
|
|
2052
|
+
```brm fragment
|
|
2053
|
+
const { count: first } = counter(0);
|
|
2054
|
+
const { count: second } = counter(10);
|
|
2055
|
+
```
|
|
2056
|
+
|
|
2057
|
+
## BRM178: Parameters of {name} must be plain names
|
|
2058
|
+
|
|
2059
|
+
A module function has a destructured or default parameter.
|
|
2060
|
+
|
|
2061
|
+
https://brumate-docs.vercel.app/docs/errors#brm178
|
|
2062
|
+
|
|
2063
|
+
```brm fragment
|
|
2064
|
+
export function counter(start: number) {
|
|
2065
|
+
let count = $signal(start);
|
|
2066
|
+
return { count };
|
|
2067
|
+
}
|
|
2068
|
+
```
|
|
2069
|
+
|
|
2070
|
+
## BRM179: {name} reads {local}, which {specifier} does not export. Export it, so the component can import it
|
|
2071
|
+
|
|
2072
|
+
A module function reads a value of its module that is not exported.
|
|
2073
|
+
|
|
2074
|
+
https://brumate-docs.vercel.app/docs/errors#brm179
|
|
2075
|
+
|
|
2076
|
+
```brm fragment
|
|
2077
|
+
export const STEP = 1;
|
|
2078
|
+
```
|