brumate 0.7.2 → 0.8.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.
Files changed (90) hide show
  1. package/dist/{boot-CMy0f_iC.d.ts → boot-DQuAhAd5.d.ts} +2 -2
  2. package/dist/cli.js +3 -2
  3. package/dist/cli.js.map +1 -1
  4. package/dist/{client-DnFF9_lv.d.ts → client-4eabQtYJ.d.ts} +38 -12
  5. package/dist/{client-COm1iA6w.js → client-CwVcmymi.js} +145 -28
  6. package/dist/client-CwVcmymi.js.map +1 -0
  7. package/dist/{defer-Cesb-k2Q.js → defer-BaXWydb0.js} +2 -2
  8. package/dist/{defer-Cesb-k2Q.js.map → defer-BaXWydb0.js.map} +1 -1
  9. package/dist/{devtools-C9IEkgc1.js → devtools-CMuj12yR.js} +257 -118
  10. package/dist/devtools-CMuj12yR.js.map +1 -0
  11. package/dist/devtools-calls-DGW6nLZ2.js +249 -0
  12. package/dist/devtools-calls-DGW6nLZ2.js.map +1 -0
  13. package/dist/devtools-panel-Cq8LpsyW.js +3978 -0
  14. package/dist/devtools-panel-Cq8LpsyW.js.map +1 -0
  15. package/dist/error-catalog-DakxjSgj.js +308 -0
  16. package/dist/error-catalog-DakxjSgj.js.map +1 -0
  17. package/dist/error-catalog-VxLbz-6p.js +1 -0
  18. package/dist/{files-BuQvpBwF.js → files-DXS8RAtZ.js} +2 -2
  19. package/dist/{files-BuQvpBwF.js.map → files-DXS8RAtZ.js.map} +1 -1
  20. package/dist/index.d.ts +73 -18
  21. package/dist/index.js +11 -1
  22. package/dist/index.js.map +1 -1
  23. package/dist/{inspect-BSHv1_25.js → inspect-B5AoHh5O.js} +639 -412
  24. package/dist/inspect-B5AoHh5O.js.map +1 -0
  25. package/dist/{loader-CLKrJMqw.js → loader-CTeT6ie9.js} +4 -4
  26. package/dist/{loader-CLKrJMqw.js.map → loader-CTeT6ie9.js.map} +1 -1
  27. package/dist/{navigate-OHb0Uw1P.js → navigate-Bj73X4ZS.js} +22 -8
  28. package/dist/navigate-Bj73X4ZS.js.map +1 -0
  29. package/dist/{rpc-BAKbRWOT.js → rpc-kVB0Ujdx.js} +5 -4
  30. package/dist/rpc-kVB0Ujdx.js.map +1 -0
  31. package/dist/runtime/bundles.d.ts +3 -2
  32. package/dist/runtime/bundles.js +14 -3
  33. package/dist/runtime/bundles.js.map +1 -1
  34. package/dist/runtime/client.d.ts +2 -2
  35. package/dist/runtime/client.js +4 -3
  36. package/dist/runtime/devtools.d.ts +59 -1
  37. package/dist/runtime/devtools.js +1 -1
  38. package/dist/runtime/hot.d.ts +1 -1
  39. package/dist/runtime/hot.js +6 -2
  40. package/dist/runtime/hot.js.map +1 -1
  41. package/dist/runtime/loader.d.ts +2 -2
  42. package/dist/runtime/loader.js +2 -2
  43. package/dist/runtime/server.d.ts +1 -1
  44. package/dist/runtime/server.js +3 -2
  45. package/dist/runtime/signals.d.ts +1 -1
  46. package/dist/runtime/static-loader.d.ts +2 -2
  47. package/dist/runtime/static-loader.js +1 -1
  48. package/dist/runtime/store.d.ts +2 -2
  49. package/dist/runtime/store.js +1 -1
  50. package/dist/runtime/testing.d.ts +2 -2
  51. package/dist/runtime/testing.js +2 -2
  52. package/dist/search-params-Wg-0FsMj.js +148 -0
  53. package/dist/search-params-Wg-0FsMj.js.map +1 -0
  54. package/dist/{stream-RXLadXx1.js → serial-ioa17MuY.js} +67 -168
  55. package/dist/serial-ioa17MuY.js.map +1 -0
  56. package/dist/serial-ribg9NAj.js +1 -0
  57. package/dist/{server-BVObWh-w.js → server-BUuf7XPZ.js} +61 -16
  58. package/dist/server-BUuf7XPZ.js.map +1 -0
  59. package/dist/{server-0rS5vUW1.d.ts → server-DesBZv5g.d.ts} +8 -3
  60. package/dist/{search-params-C64liRBj.js → shared-CX_YacDm.js} +3 -148
  61. package/dist/shared-CX_YacDm.js.map +1 -0
  62. package/dist/{signals-DBnq9QRW.d.ts → signals-7VVD9C_H.d.ts} +2 -2
  63. package/dist/{static-loader-CxANokZ4.js → static-loader-BM0-wdIc.js} +2 -2
  64. package/dist/{static-loader-CxANokZ4.js.map → static-loader-BM0-wdIc.js.map} +1 -1
  65. package/dist/{static-loader-BYbXVJDY.d.ts → static-loader-BSAyFqG0.d.ts} +2 -2
  66. package/dist/{store-xlTzAM_r.d.ts → store-9_oa0HG1.d.ts} +15 -2
  67. package/dist/{store-BIBAYZo-.js → store-Cy4EEyZ7.js} +148 -2
  68. package/dist/store-Cy4EEyZ7.js.map +1 -0
  69. package/dist/stream-read-BTsYstJY.js +22 -0
  70. package/dist/stream-read-BTsYstJY.js.map +1 -0
  71. package/dist/stream-read-Dek3HnqO.js +1 -0
  72. package/dist/vite.d.ts +1 -1
  73. package/dist/vite.js +37 -5
  74. package/dist/vite.js.map +1 -1
  75. package/package.json +7 -4
  76. package/skills/brumate/SKILL.md +6 -2
  77. package/skills/brumate/references/errors.md +21 -2
  78. package/skills/brumate/references/state.md +31 -0
  79. package/skills/brumate/references/syntax.md +45 -1
  80. package/dist/client-COm1iA6w.js.map +0 -1
  81. package/dist/devtools-C9IEkgc1.js.map +0 -1
  82. package/dist/devtools-panel-Doit__YG.js +0 -2018
  83. package/dist/devtools-panel-Doit__YG.js.map +0 -1
  84. package/dist/inspect-BSHv1_25.js.map +0 -1
  85. package/dist/navigate-OHb0Uw1P.js.map +0 -1
  86. package/dist/rpc-BAKbRWOT.js.map +0 -1
  87. package/dist/search-params-C64liRBj.js.map +0 -1
  88. package/dist/server-BVObWh-w.js.map +0 -1
  89. package/dist/store-BIBAYZo-.js.map +0 -1
  90. package/dist/stream-RXLadXx1.js.map +0 -1
@@ -0,0 +1,308 @@
1
+ //#region src/error-catalog.ts
2
+ /**
3
+ * Codes are stable. A new entry takes the next number that was never used,
4
+ * wherever the entry sits in the catalog. Never change the code of an entry,
5
+ * and never reuse a code. When an error is removed, delete its entry and
6
+ * leave its number unused. test/error-codes.json pins each code to its
7
+ * message, so a test fails when a code changes or is reused. Rewording a
8
+ * message needs a hand edit of that file, for the same code. Add the code of
9
+ * a new entry to it with `UPDATE_SKILL=1 npx vitest run test/check-command.test.ts`.
10
+ */
11
+ /** The address of the docs site. Change it here when the site moves. */
12
+ const DOCS_SITE = "https://brumate-docs.vercel.app";
13
+ /** The page of the docs that explains every code, with one anchor for each. */
14
+ const ERRORS_PAGE = `${DOCS_SITE}/docs/errors`;
15
+ /** The link to the explanation of a code. */
16
+ function errorLink(code) {
17
+ return `${ERRORS_PAGE}#${code.toLowerCase()}`;
18
+ }
19
+ function entry(code, message, cause, fix) {
20
+ return {
21
+ message,
22
+ cause,
23
+ fix,
24
+ code,
25
+ link: errorLink(code)
26
+ };
27
+ }
28
+ /** Syntax errors of the parser, in the order of a file. */
29
+ const SYNTAX = [
30
+ entry("BRM001", "Unterminated comment", "A comment starts and never ends.", "<!-- A comment ends with -->\n<script>\n /* and so does this one */\n<\/script>"),
31
+ entry("BRM002", "Unterminated string", "A string in code starts and never ends.", "const name = 'Ada';"),
32
+ entry("BRM003", "Unterminated template literal", "A template string starts and never ends.", "const label = `Hello ${name}`;"),
33
+ entry("BRM004", "Unterminated regular expression", "A regular expression starts and never ends.", "const digits = /\\d+/;"),
34
+ entry("BRM005", "Unexpected \"{char}\"", "Code has a bracket that closes nothing.", "const list = [1, 2];"),
35
+ entry("BRM006", "Expected \"{char}\"", "Code opens a bracket and never closes it. The message names the closing one.", "const list = [1, 2];"),
36
+ entry("BRM007", "Expected \"}\" to close the block", "A `#` block opens with `{` and the file ends before its `}`.", "#if (open) {\n <p>Open</p>\n}"),
37
+ entry("BRM008", "Unexpected end of file, expected a closing tag", "An element is never closed.", "<div>\n <p>Text</p>\n</div>"),
38
+ entry("BRM009", "Unexpected closing tag", "A closing tag has no opening tag.", "<p>Text</p>"),
39
+ entry("BRM010", "<script> must be at the top level or at the start of a block", "A `<script>` is inside an element, or after other markup in a block.", "#for (item of items) {\n <script>\n let open = $signal(false);\n <\/script>\n <p>{item}</p>\n}"),
40
+ entry("BRM011", "<style> must be at the top level of the file or of a block", "A `<style>` is inside an element.", "<style>\n p {\n color: red;\n }\n</style>\n<p>Text</p>"),
41
+ entry("BRM012", "#template must be at the top level or at the start of a block", "A `#template` is inside an element, or after other markup in a block.", "#template price(amount: number) {\n <b>{amount}</b>\n}"),
42
+ entry("BRM013", "#{branch} must follow its block", "A branch such as `#else` or `#catch` comes without the block that it belongs to.", "#if (open) {\n <p>Open</p>\n} #else {\n <p>Closed</p>\n}"),
43
+ entry("BRM014", "Expected a tag name", "A `<` starts a tag with no name.", "<p>1 &lt; 2</p>"),
44
+ entry("BRM015", "<{name}> must end with \"/>\"", "`<window>` and `<document>` take no children, so they close with `/>`.", "<window onKeyDown=(handler) />"),
45
+ entry("BRM016", "Expected </{name}>", "A closing tag is not complete.", "<p>Text</p>"),
46
+ entry("BRM017", "Unexpected end of file, expected \">\"", "A tag starts and the file ends before its `>`.", "<input value=name>"),
47
+ entry("BRM018", "Expected whitespace between attributes", "Two attributes touch each other.", "<input id=name type=\"text\">"),
48
+ entry("BRM019", "Only event handlers are allowed here", "`<window>` and `<document>` take event handlers and nothing else.", "<document onKeyDown=(handler) />"),
49
+ entry("BRM020", "Expected a spread or a shorthand attribute", "A `{` in a tag holds something other than `...rest` or a name.", "<a {href} {...rest}>Open</a>"),
50
+ entry("BRM021", "Expected an attribute name", "A tag has a character where an attribute name belongs.", "<input disabled>"),
51
+ entry("BRM022", "Event modifiers in the attribute name were removed. Write {fix}", "A modifier follows the event name, as in `onSubmit:prevent=send`. Wrappers of `brumate/events` write modifiers now, and `:passive` is the default, since listeners are passive unless a handler prevents.", "import { prevent } from 'brumate/events';\n\n<form onSubmit=(prevent(send))></form>"),
52
+ entry("BRM180", "\"{name}\" is not an event name. Write \"{camel}\"", "An event of more than one word is written in camel case. The lower-case form is an error.", "<input onKeyDown=(handle) onFocusOut=(handle) />"),
53
+ entry("BRM201", "\"{name}\" cannot be a handler. {fix}", "The event has capitals in its name, or the browser fires another name for it, and a handler name is lower-cased to the event. `onDOMContentLoaded` would listen to `domcontentloaded`, which the browser never fires, and page code loads after the HTML, mostly after `DOMContentLoaded`. Use the event that the message names, or `$client(fn, 'load')` to run code at load.", "<script>\n $client(() => {\n start();\n }, 'load');\n<\/script>"),
54
+ entry("BRM186", "\"{name}\" in the #loading header is not a memo that markup in the body reads. Name a $memo of the component or of a block script around the block", "The header of `#loading (…)` names something other than a memo, or a memo that no markup in the body reads, so its loads would not show the fallback for that body.", "const posts = $memo(loadPosts(id));\n#loading (posts) {\n <p>{posts.length} posts</p>\n} #else {\n <p>Loading</p>\n}"),
55
+ entry("BRM182", "The handler reads \"{name}\", a memo that can lack a value. Wait for it with await $resolve({name}), or check $isPending({name}) first", "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.", "<script>\n const user = $memo(getUser(id));\n async function save() {\n await $resolve(user);\n send(user.name);\n }\n<\/script>"),
56
+ entry("BRM183", "$resolve needs a $memo and, as an option, a timeout or a signal", "`$resolve` takes the name of a memo, and one object of options at most.", "async function save() {\n const profile = await $resolve(user, { timeout: 5000 });\n}"),
57
+ entry("BRM184", "$resolve cannot run where a memo computes or markup renders. Call it in a handler, an effect or a $client callback", "`$resolve` waits, so it is called where an event starts the code, not where a memo computes or markup renders.", "async function save() {\n await $resolve(user);\n}"),
58
+ entry("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\"", "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.", "<p>Total: <span>{total}</span></p>\n<div>\n <p>Total</p>\n</div>"),
59
+ entry("BRM187", "The {kind} {name} of {component} did not settle: it writes a value that it reads, and runs again without end. Wrap the read or the write in $untrack, or write only when the value changes", "In the browser, an effect or an update writes a value that it reads, so each run schedules the next. Past 1000 rounds of effects, or 10000 rounds of updates, in one change, the page stops the loop and sends this error to the nearest `#try` in place of hanging the tab. A production build sends the short form `Update loop {scope}:{name} [BRM187]`.", "<script>\n import { $effect, $signal, $untrack } from 'brumate/signals';\n\n let query = $signal('');\n let saves = $signal(0);\n\n $effect(() => {\n void query;\n $untrack(saves++);\n });\n<\/script>"),
60
+ entry("BRM188", "\"{name}\" gives a promise, and {place} cannot wait for one. Await it in the code that runs, or read its value with $memo", "Markup waits for a promise in text and in attribute values only. An event handler, the key of a `#for`, a `ref` and a `$bind` need the value at once, and the compiler sees that this expression gives a promise: `new Promise(…)`, a call of a server function or of an async function, or a prop typed as a promise.", "<button onClick=(() => save(draft))>Save</button>\n#for (user of users by user.id) {\n <p>{user.name}</p>\n}"),
61
+ entry("BRM024", "Expected an event handler", "An event attribute has no `=` and no value.", "<button onClick=(() => count++)>Add</button>"),
62
+ entry("BRM025", "An event handler must be an expression, not a string", "The value of an event attribute is a quoted string.", "<button onClick=(() => count++)>Add</button>"),
63
+ entry("BRM026", "An attribute name can have one \":\" namespace", "An attribute name has two or more `:`.", "<svg xlink:href=\"#icon\"></svg>"),
64
+ entry("BRM027", "ref takes $bind, as in ref=$bind(name)", "`ref` has a value that is not `$bind(name)`.", "<input ref=$bind(input)>"),
65
+ entry("BRM028", "prefetch is removed. The code of the page loads when it starts", "The `prefetch` attribute no longer exists.", "<a href=\"/about\">About</a>"),
66
+ entry("BRM029", "Markup is not allowed in attribute values. Use a #template.", "An attribute value holds an element.", "<List item=row />\n\n#template row(name: string) {\n <b>{name}</b>\n}"),
67
+ entry("BRM030", "Expected an attribute value", "An attribute has `=` and nothing after it.", "<input value=name>"),
68
+ entry("BRM031", "Wrap this attribute value in parentheses", "An attribute value without quotes has an operator or a space in it.", "<button disabled=(count > 3)>Add</button>"),
69
+ entry("BRM032", "Expected \">\" to end <{name}>", "A tag has text where its `>` belongs.", "<input value=name>"),
70
+ entry("BRM033", "Expected a quoted value", "A `<script>` or `<style>` attribute has `=` without a quoted value.", "<script generics=\"T\"><\/script>"),
71
+ entry("BRM034", "Expected {close}", "A `<script>` or `<style>` is not closed.", "<script>\n let a = 1;\n<\/script>"),
72
+ entry("BRM035", "Unknown <script> attribute \"{name}\"", "A `<script>` has an attribute other than `module` and `generics`.", "<script module>\n export const MAX = 10;\n<\/script>"),
73
+ entry("BRM036", "A file can have one <script module>", "A file has two module scripts.", "<script module>\n export const MAX = 10;\n export const MIN = 1;\n<\/script>"),
74
+ entry("BRM037", "A file can have one <script>", "A file has two instance scripts.", "<script>\n let a = $signal(1);\n let b = $signal(2);\n<\/script>"),
75
+ entry("BRM038", "lang must be \"css\", \"scss\" or \"less\"", "A `<style>` names another language.", "<style lang=\"scss\">\n p {\n a {\n color: red;\n }\n }\n</style>"),
76
+ entry("BRM189", "Unknown <style> attribute \"{name}\"", "A `<style>` has an attribute other than `lang` and `global`.", "<style scoped>\n p {\n color: red;\n }\n</style>"),
77
+ entry("BRM207", "#reveal has no style of its own", "A `<style>` is in the body of a `#reveal`, which only orders the bodies inside it.", "<style>\n p {\n color: red;\n }\n</style>\n#reveal {\n #loading {\n <p>Loaded</p>\n }\n}"),
78
+ entry("BRM190", "global takes no value, as in <style global>", "A `<style global>` gives `global` a value.", "<style global=\"true\">\n p {\n color: red;\n }\n</style>"),
79
+ entry("BRM039", "#reveal takes an order, 'sequential', 'backwards', 'together' or 'natural', and collapsed, such as #reveal ('sequential', collapsed)", "`#reveal` has an option that it does not know.", "#reveal ('sequential', collapsed) {\n …\n}"),
80
+ entry("BRM040", "collapsed shows the fallback of the next body to show, so it needs the order 'sequential', not '{order}'", "`collapsed` goes with `sequential` only.", "#reveal ('sequential', collapsed) {\n …\n}"),
81
+ entry("BRM041", "#reveal has no script of its own", "A `#reveal` body starts with a `<script>`.", "<script>\n let open = $signal(false);\n<\/script>\n#reveal {\n …\n}"),
82
+ entry("BRM042", "Expected \"(\" after #{keyword}", "A block that takes a condition or a list has no `(`.", "#if (open) {\n <p>Open</p>\n}"),
83
+ entry("BRM043", "Expected an expression after #{keyword}", "The parentheses of a block are empty.", "#if (open) {\n <p>Open</p>\n}"),
84
+ entry("BRM044", "Expected \"{\" after #{keyword}", "The header of a block is not followed by `{`.", "#if (open) {\n <p>Open</p>\n}"),
85
+ entry("BRM045", "Expected \"{\" after #switch", "`#switch` has no `{` after it.", "#switch {\n #case (tab === 1) {\n <p>One</p>\n }\n}"),
86
+ entry("BRM046", "The script of a block takes no attributes", "A `<script>` at the start of a block has attributes such as `module`.", "#for (item of items) {\n <script>\n let open = $signal(false);\n <\/script>\n <p>{item}</p>\n}"),
87
+ entry("BRM047", "#try needs a #catch block", "A `#try` body is not followed by `#catch`.", "#try {\n <p>{load()}</p>\n} #catch (error, reset) {\n <p>Failed</p>\n}"),
88
+ entry("BRM048", "Expected \"(error, reset)\" after #catch", "The header of `#catch` names something other than a plain error name and a plain reset name.", "#catch (error, reset) {\n <p>{String(error)}</p>\n}"),
89
+ entry("BRM049", "The trigger of #{keyword} must be \"visible\", \"idle\" or \"load\"", "A `#client` block names another trigger.", "#client ('idle') {\n <p>In the browser</p>\n}"),
90
+ entry("BRM050", "Unknown block #{keyword}", "A `#` starts a block that does not exist.", "#if (open) {\n <p>Open</p>\n}"),
91
+ entry("BRM051", "Expected \"index of count\" after #repeat", "The header of `#repeat` is not `index of count`.", "#repeat (star of 5) {\n <i>{star}</i>\n}"),
92
+ entry("BRM052", "Expected \"item of list\" or \"item, index of list\" after #for", "The header of `#for` has no `of`.", "#for (item, index of items by item.id) {\n <li>{item.name}</li>\n}"),
93
+ entry("BRM053", "Expected the height of an item in window(height)", "`window` after a `#for` header has no height.", "#for (row of rows by row.id) window(32) {\n <tr><td>{row.name}</td></tr>\n}"),
94
+ entry("BRM054", "Only #case and #default are allowed in #switch", "A `#switch` holds markup other than its cases.", "#switch {\n #case (tab === 1) {\n <p>One</p>\n }\n #default {\n <p>Other</p>\n }\n}"),
95
+ entry("BRM055", "#default must be the last branch of #switch", "A `#case` comes after the `#default`.", "#switch {\n #case (tab === 1) {\n <p>One</p>\n }\n #default {\n <p>Other</p>\n }\n}"),
96
+ entry("BRM056", "Expected \"(\" after the name of the template", "A `#template` has no parameter list.", "#template price(amount: number) {\n <b>{amount}</b>\n}"),
97
+ entry("BRM057", "Expected an expression", "An attribute or a block has code that is not an expression.", "<p>{count + 1}</p>"),
98
+ entry("BRM058", "Expected a binding pattern", "The name of a `#for` or `#catch` is not a name or a pattern.", "#for ({ id, name } of people by id) {\n <li>{name}</li>\n}"),
99
+ entry("BRM059", "Expected parameters", "The parameters of a `#template` are not a parameter list.", "#template price(amount: number) {\n <b>{amount}</b>\n}")
100
+ ];
101
+ /** Errors about `$signal`, `$memo` and the other compile-time functions. */
102
+ const SCRIPT = [
103
+ entry("BRM060", "\"{name}\" is already declared", "Two declarations of one scope have the same name.", "let count = $signal(0);\nlet total = $signal(0);"),
104
+ entry("BRM061", "{name} takes a handler", "`prevent`, `stop`, `once`, `capture` or `transition` has no handler, or `stop`, `once` or `capture` has keys.", "<form onSubmit=(prevent(send))></form>"),
105
+ entry("BRM062", "Only prevent of a keyboard event takes keys, such as onKeyDown", "Keys are given to `prevent` of an event that is not `onKeyDown`, `onKeyUp` or `onKeyPress`.", "<ul onKeyDown=(prevent(move, 'ArrowDown'))></ul>"),
106
+ entry("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'", "A key of `prevent` is not a string literal of an `event.key`.", "<ul onKeyDown=(prevent(move, 'ArrowDown', 'Mod+ArrowUp'))></ul>"),
107
+ entry("BRM064", "Name each key of prevent as a string, such as 'Enter'", "A key of `prevent` is not a string literal.", "<input onKeyDown=(prevent(submit, 'Enter'))>"),
108
+ entry("BRM065", "Server function \"{name}\" must be async", "A function with `'use server'` is not `async`.", "async function save(list: string[]) {\n 'use server';\n await db.save(list);\n}"),
109
+ entry("BRM066", "The module script cannot have a default export", "`<script module>` has `export default`.", "<script module>\n export const MAX = 10;\n<\/script>"),
110
+ entry("BRM067", "A script cannot export values. Use <script module>", "The instance script has an `export`.", "<script module>\n export const MAX = 10;\n<\/script>"),
111
+ entry("BRM068", "$title takes one argument, the title", "`$title` has no argument or more than one.", "$title('Todos');"),
112
+ entry("BRM069", "await works with $memo, not {name}", "A declaration awaits a compile-time function other than `$memo`.", "const user = $memo(await load(id));"),
113
+ entry("BRM070", "$props() can only be called in the component script", "`$props()` is in a module script or a function.", "const { name } = $props<{ name: string }>();"),
114
+ entry("BRM071", "Assign $props() to a const or a let", "The result of `$props()` is not assigned with `const` or `let`.", "const { name } = $props<{ name: string }>();"),
115
+ entry("BRM072", "$props() takes no arguments", "`$props()` has an argument.", "const { name } = $props<{ name: string }>();"),
116
+ entry("BRM073", "Assign $props() to a name or an object pattern", "`$props()` is assigned to an array pattern.", "const { name } = $props<{ name: string }>();"),
117
+ entry("BRM074", "Create an ID with \"const name = $id()\"", "`$id()` is not the value of a `const`.", "const field = $id();"),
118
+ entry("BRM075", "$id takes no arguments", "`$id` has an argument.", "const field = $id();"),
119
+ entry("BRM076", "$isPassed takes a prop that the component destructures, such as $isPassed(value)", "The argument of `$isPassed` is not a prop of the component.", "let { value } = $props<{ value?: Bindable<string> }>();\nconst passed = $isPassed(value);"),
120
+ entry("BRM077", "$navigation takes no arguments", "`$navigation` has an argument.", "const navigation = $navigation();"),
121
+ entry("BRM078", "$route takes at most one argument, the path of the route", "`$route` has more than one argument.", "const route = $route('/posts/[id]');"),
122
+ entry("BRM079", "Read a context with \"const name = $getContext(Context)\"", "`$getContext` is not the value of a `const`.", "const theme = $getContext(ThemeContext);"),
123
+ entry("BRM080", "$getContext takes the context, and a fallback for a read without a provider", "`$getContext` has no argument or more than two.", "const theme = $getContext(ThemeContext);\nconst locale = $getContext(LocaleContext, undefined);"),
124
+ entry("BRM081", "$setContext takes two arguments, the context and the value", "`$setContext` has fewer or more than two arguments.", "$setContext(ThemeContext, theme);"),
125
+ entry("BRM082", "Declare the result of a form with \"const name = $action(serverFunction)\"", "`$action` is not the value of a `const`.", "const result = $action(save);"),
126
+ entry("BRM083", "$action needs a server function of this file as its only argument", "`$action` has no argument, or more than one.", "const result = $action(save);"),
127
+ entry("BRM084", "$action needs a server function of this file, and {name} is not one", "The argument of `$action` is not a function with `'use server'` in this file.", "async function save(data: FormData) {\n 'use server';\n}\nconst result = $action(save);"),
128
+ entry("BRM085", "Declare {name} with const", "`$debounced` or `$throttled` is declared with `let`.", "const query = $debounced(text, 300);"),
129
+ entry("BRM086", "{name} cannot be destructured", "A signal, a memo or another value of a compile-time function is declared with a pattern.", "let count = $signal(0);"),
130
+ entry("BRM087", "{name} takes a value and a wait in milliseconds", "`$debounced` or `$throttled` does not have both arguments.", "const query = $debounced(text, 300);"),
131
+ entry("BRM088", "The wait of {name} must be a number of milliseconds, such as 300", "The wait of `$debounced` or `$throttled` is not a number literal.", "const query = $debounced(text, 300);"),
132
+ entry("BRM089", "Declare {name} with {expected}", "`$signal` and `$optimistic` need `let`, and `$memo` needs `const`.", "let count = $signal(0);\nconst double = $memo(count * 2);"),
133
+ entry("BRM090", "{name} takes one argument", "`$signal`, `$memo` or `$optimistic` has more than one argument.", "let count = $signal(0);"),
134
+ entry("BRM091", "{name} needs a value", "`$memo` or `$optimistic` has no argument.", "const double = $memo(count * 2);"),
135
+ entry("BRM092", "$optimistic needs the name of a value, such as a memo", "The argument of `$optimistic` is not a name.", "let shown = $optimistic(items);"),
136
+ entry("BRM093", "{name} does not return a value", "`$effect` or `$client` is assigned to a name.", "$effect(() => {\n document.title = title;\n});"),
137
+ entry("BRM094", "{name} needs a function", "`$effect` or `$client` has no function as its callback.", "$effect(() => {\n document.title = title;\n});"),
138
+ entry("BRM095", "The callback of {name} takes no parameters", "The callback of `$effect` or `$client` has parameters.", "$effect(() => {\n document.title = title;\n});"),
139
+ entry("BRM096", "The callback of {name} cannot be async", "The callback of `$effect` or `$client` is `async`.", "$effect(() => {\n load(id).then((value) => (data = value));\n});"),
140
+ entry("BRM097", "$effect takes one argument", "`$effect` has more than one argument.", "$effect(() => {\n document.title = title;\n});"),
141
+ entry("BRM098", "The trigger of $client must be \"visible\", \"idle\" or \"load\"", "The second argument of `$client` is another string.", "$client(() => {\n measure();\n}, 'idle');"),
142
+ entry("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", "The first argument of `$handler` is not a function.", "onClick: $handler(prevent(removeAt), index),"),
143
+ entry("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})", "A handler reads a local value of the function that calls `$handler`.", "onClick: $handler(removeAt, index),"),
144
+ entry("BRM101", "The arguments of $handler cannot be spread", "`$handler` has a spread argument.", "onClick: $handler(removeAt, index, kind),"),
145
+ entry("BRM102", "The second argument of $bind is a function that takes the new value: a function expression, or a function of the script", "The setter of `$bind` is not a function.", "<Toggle on=$bind(open, (next) => (open = next)) />"),
146
+ entry("BRM103", "The setter reads \"{name}\", a value of the function around $bind, which the browser does not have", "The setter of `$bind` reads a local value that is not a value of the component.", "<Toggle on=$bind(open, (next) => (open = next)) />"),
147
+ entry("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", "`$bind` is somewhere else, such as on a `class` or a `<div>`.", "<input value=$bind(draft)>"),
148
+ entry("BRM105", "$bind takes the name of a signal, and a function that writes it, such as $bind(open) or $bind(open, (next) => (open = next))", "`$bind` has no argument, or an argument that is not a name.", "<Toggle on=$bind(open) />"),
149
+ entry("BRM106", "$bind takes a signal, or a prop that the component destructures with let, and \"{name}\" is not one", "The name in `$bind` is a memo, a const prop or another value.", "let open = $signal(false);\n<Toggle on=$bind(open) />"),
150
+ entry("BRM107", "$isBound takes a prop that the component destructures with let, such as $isBound(open)", "The argument of `$isBound` is not a `let` prop.", "let { open } = $props<{ open?: Bindable<boolean> }>();\nconst bound = () => $isBound(open);"),
151
+ entry("BRM108", "$isPending needs async $memos as its arguments", "An argument of `$isPending` is not a memo that holds a promise, or the call has none.", "const results = $memo(search(query));\n#if ($isPending(results)) {\n <p>Searching…</p>\n}"),
152
+ entry("BRM109", "$produce needs a signal as its first argument", "The first argument of `$produce` is not a signal.", "$produce(todos, (draft) => {\n draft.push(todo);\n});"),
153
+ entry("BRM110", "$produce needs a recipe function as its second argument", "The second argument of `$produce` is not a function.", "$produce(todos, (draft) => {\n draft.push(todo);\n});"),
154
+ entry("BRM111", "\"{name}\" is reserved. Brumate writes the attributes that start with \"b-\"", "An attribute starts with `b-`.", "<div data-id=id></div>"),
155
+ entry("BRM112", "\"{name}\" is not declared", "The name in `ref=$bind(name)` is not a value of the component.", "let input = $signal<HTMLInputElement>();\n<input ref=$bind(input)>"),
156
+ entry("BRM113", "ref takes a $signal, or a prop that the component destructures with let, but \"{name}\" is {kind}", "The name in `ref=$bind(name)` is a memo, a const prop or another value.", "let input = $signal<HTMLInputElement>();\n<input ref=$bind(input)>"),
157
+ entry("BRM114", "The prop \"{name}\" is not Bindable. Type it as Bindable<HTMLElement>, so a parent can bind it", "A `let` prop is used as a `ref` and its type is not `Bindable`.", "let { ref } = $props<{ ref?: Bindable<HTMLButtonElement> }>();"),
158
+ entry("BRM115", "\"{name}\" is the props object, so read one key at a time, destructure it, or spread it in markup", "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. A spread may hold the rest as a branch of `?:`, `&&`, `||` or `??` next to an object literal, `undefined`, `null` or `false`, such as `{...(open ? rest : {})}`.", "const { class: className, ...rest } = $props();\n<button {...rest} class=className>"),
159
+ entry("BRM116", "\"{name}\" is the props object, and props are read-only. Copy the key to a $signal or a $memo to change it", "Code assigns to, updates or deletes a key of the props object or of the rest of `$props()`.", "let title = $signal('');\ntitle = 'New';"),
160
+ entry("BRM117", "Cannot assign to {kind} \"{name}\"", "Code writes a memo, a const prop or another value that cannot change.", "let count = $signal(0);\ncount = 5;"),
161
+ entry("BRM118", "Signal \"{name}\" can only be written in event handlers, effects, $client callbacks and functions", "Setup code, which runs on the server, writes a signal.", "let count = $signal(5);"),
162
+ entry("BRM119", "Server function \"{name}\" captures \"{variable}\". Pass it as an argument", "A server function reads a variable of the instance script.", "async function save(user: string) {\n 'use server';\n}"),
163
+ entry("BRM120", "$optimistic follows a memo, an action or a prop, not a signal", "The source of `$optimistic` is a signal.", "let shown = $optimistic(items);"),
164
+ entry("BRM121", "Declare server functions at the top level of a script", "A function with `'use server'` is inside another function or a block.", "async function save() {\n 'use server';\n}"),
165
+ entry("BRM122", "{name} cannot be used here", "A compile-time function is used where it is not allowed.", "let count = $signal(0);"),
166
+ entry("BRM123", "Call $setContext at the top level of a script", "`$setContext` is inside a function or a block of code.", "$setContext(ThemeContext, theme);"),
167
+ entry("BRM124", "Call $title at the top level of a script", "`$title` is inside a function or a block of code.", "$title('Todos');"),
168
+ entry("BRM125", "Create an ID with \"const name = $id()\" at the top level of a script", "`$id` is inside a function or a block of code.", "const field = $id();"),
169
+ entry("BRM126", "Check a prop with \"const name = $isPassed(prop)\" at the top level of the component script", "`$isPassed` is inside a function or a block of code.", "const passed = $isPassed(value);"),
170
+ entry("BRM127", "Read a context with \"const name = $getContext(Context)\" at the top level of a script", "`$getContext` is inside a function or a block of code.", "const theme = $getContext(ThemeContext);"),
171
+ entry("BRM128", "Read the route with \"const name = $route()\" at the top level of a script", "`$route` is inside a function or a block of code.", "const route = $route();"),
172
+ entry("BRM129", "Read the navigation with \"const name = $navigation()\" at the top level of a script", "`$navigation` is inside a function or a block of code.", "const navigation = $navigation();"),
173
+ entry("BRM130", "Call $props() as the value of a const in the component script", "`$props` is used in another place than `const { … } = $props()`.", "const { name } = $props<{ name: string }>();"),
174
+ entry("BRM131", "Declare a signal with \"let name = $signal(value)\" at the top level of a script", "`$signal` is inside a function or a block of code.", "let count = $signal(0);"),
175
+ entry("BRM132", "Declare a memo with \"const name = $memo(value)\" at the top level of a script", "`$memo` is inside a function or a block of code.", "const double = $memo(count * 2);"),
176
+ entry("BRM202", "$gate takes a value and a function, as in $gate(value, (prev, next) => next > prev)", "`$gate` does not have a value and a guard function as its two arguments. The guard is an arrow function or a function expression.", "const query = $gate(input, (_, next) => next.length >= 2);"),
177
+ entry("BRM203", "$gate takes a value that is ready. Use $memo for a promise or a server function", "The value of `$gate` awaits or calls a server function. The compiler catches these two; any other promise or stream, such as a call of a local async function, throws when the value is computed. A gate holds a value that the guard can compare, so it does not wait for one.", "const query = $gate(input, (_, next) => next.length >= 2);"),
178
+ entry("BRM204", "Declare a gated value with \"const name = $gate(value, (prev, next) => boolean)\" at the top level of a script", "`$gate` is inside a function or a block of code.", "const query = $gate(input, (_, next) => next.length >= 2);"),
179
+ entry("BRM133", "Declare a debounced value with \"const name = $debounced(value, ms)\" at the top level of a script", "`$debounced` is inside a function or a block of code.", "const query = $debounced(text, 300);"),
180
+ entry("BRM134", "Declare a throttled value with \"const name = $throttled(value, ms)\" at the top level of a script", "`$throttled` is inside a function or a block of code.", "const position = $throttled(pointer, 100);"),
181
+ entry("BRM135", "Declare an optimistic value with \"let name = $optimistic(source)\" at the top level of a script", "`$optimistic` is inside a function or a block of code.", "let shown = $optimistic(items);"),
182
+ entry("BRM136", "Declare the result of a form with \"const name = $action(serverFunction)\" at the top level of a script", "`$action` is inside a function or a block of code.", "const result = $action(save);"),
183
+ entry("BRM137", "Call $effect at the top level of a script", "`$effect` is inside a function or a block of code.", "$effect(() => {\n document.title = title;\n});"),
184
+ entry("BRM138", "Call $client at the top level of a script", "`$client` is inside a function or a block of code.", "$client(() => {\n measure();\n}, 'idle');"),
185
+ entry("BRM139", "$ref is not supported. Use a $signal with ref=$bind(name)", "`$ref` was removed.", "let input = $signal<HTMLInputElement>();\n<input ref=$bind(input)>"),
186
+ entry("BRM140", "$watch is not supported. Use $effect", "`$watch` was removed.", "$effect(() => {\n save(value);\n});"),
187
+ entry("BRM141", "$settled is not supported. Use $client", "`$settled` was removed.", "$client(() => {\n measure();\n});"),
188
+ entry("BRM142", "$cleanup is not supported. Return a cleanup function from $effect or $client", "`$cleanup` was removed.", "$effect(() => {\n const timer = setInterval(tick, 1000);\n return () => clearInterval(timer);\n});"),
189
+ entry("BRM191", "Read a store with \"const name = $store(source)\" or \"let name = $store(source)\" at the top level of a script", "`$store` is not the whole value of a `const` or `let` at the top level of a script.", "import { theme } from './theme';\nconst value = $store(theme);"),
190
+ entry("BRM192", "$store takes one argument, a store", "`$store` has no argument, or more than one.", "const field = $getContext(Field);\nconst state = $store(field.state);"),
191
+ entry("BRM193", "$toStore takes one argument, a memo, a signal or a prop, as a value of $setContext", "`$toStore` has no argument or more than one, or it is not a value of `$setContext`, alone or as a key of an object or an item of a list.", "$setContext(Field, { state: $toStore(state), pick });"),
192
+ entry("BRM195", "$store gives one name, not a pattern such as { a }", "`$store` initializes a pattern.", "const value = $store(source);"),
193
+ entry("BRM196", "The context value reads \"{name}\", which changes, but a context value is read once. Put it in a store with $toStore, or read it inside a function", "The value of `$setContext` reads a signal, a memo, a prop or a `$bind` value that changes in the browser, and a context is read once, so readers would keep the first value. A call or an immediately invoked function in the value that reads such a name is not reported, and freezes the same way.", "$setContext(Field, { state: $toStore(state), pick: () => value });"),
194
+ entry("BRM197", "Read a context that may have no provider with \"const name = $getContext(Context, undefined)\", and a store in it with \"const state = name ? $store(name.key) : undefined\", with const and no other test", "A read of a context that may have no provider has another shape: `$hasContext`, which is removed, `$store(name?.key)`, a `let` or another test in the guard, an `else` that is not `undefined`, a guard on a name that is not the optional value of `$getContext(Context, undefined)`, or a key of that value read without the guard.", "const field = $getContext(Field, undefined);\nconst state = field ? $store(field.state) : undefined;"),
195
+ entry("BRM198", "The source of $store gives its store at once, so it cannot await or call a server function", "The source of `$store` awaits, or calls a server function. The browser runs the source again when the page resumes, and links the store in the same pass, so the source must give the store, not a promise of it.", "import { theme } from './theme';\nconst value = $store(theme);"),
196
+ entry("BRM199", "$store takes a store. Read the store of a context with \"$store($getContext(Context))\", or give a store as the fallback, \"$store($getContext(Context, store(value)))\"", "`$store` reads a context that the file names in `$getContext` or `$setContext`, `undefined`, `null`, or `$getContext` with a literal fallback, which is no store. A context that the file only imports is found when the page renders, as a `TypeError`.", "const level = $store($getContext(LevelContext));\nconst locale = $store($getContext(LocaleContext, store('en-US')));"),
197
+ entry("BRM200", "The value of bridge() must be a module-level export of a script file or of <script module>, as \"export const name = bridge({ … })\"", "A call of `bridge` from `brumate/store` is in the script of a component, or in a function, or is not the value of an exported `const`. The page state names a bridge by its module and its export, so the browser can load it.", "// bears.ts, or the <script module> of a component\nimport { bridge } from 'brumate/store';\nexport const bearStore = bridge({ create, get, subscribe });"),
198
+ entry("BRM144", "$get is not supported. Signals cannot leave the file", "`$get` was removed. A signal never leaves its file.", "// Pass the value, or a function that writes it.\nonChange=((next) => (count = next))"),
199
+ entry("BRM145", "$set is not supported. Signals cannot leave the file", "`$set` was removed. A signal never leaves its file.", "// Pass the value, or a function that writes it.\nonChange=((next) => (count = next))"),
200
+ entry("BRM146", "{name} was renamed to {renamed}. Import {renamed} from '{module}'", "The file imports a name that the compiler knew before it was renamed.", "import { $signal } from 'brumate/signals';"),
201
+ entry("BRM147", "Import {name} from '{module}'", "The file calls a compile-time function that it does not import.", "import { $signal } from 'brumate/signals';")
202
+ ];
203
+ /** Errors about the code that the browser gets, and the markup that the browser renders. */
204
+ const OUTPUT = [
205
+ entry("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", "A value that cannot be sent to the browser, such as a database client, is read by code that runs there.", "async function list() {\n 'use server';\n return db.all();\n}"),
206
+ entry("BRM149", "{what} is read by code that runs in the browser ({site}). Read it in a server function", "Code that runs in the browser reads an environment variable of the server.", "async function key() {\n 'use server';\n return env.API_KEY;\n}"),
207
+ entry("BRM150", "\"{name}\" holds {what} and code that runs in the browser reads it. Keep server variables out of values that the browser reads", "A value holds an environment variable of the server, and the browser reads the value.", "async function key() {\n 'use server';\n return env.API_KEY;\n}"),
208
+ entry("BRM151", "#defer cannot be inside a #client body", "A `#defer` is in markup that only the browser renders.", "#defer {\n <Comments />\n}"),
209
+ entry("BRM152", "#defer cannot be in markup that the browser renders", "A `#defer` is in a body that the browser adds later, such as the body of a changing `#if`.", "#defer {\n <Comments />\n}"),
210
+ entry("BRM153", "A value that changes in <{tag}> must be its whole content, such as <{tag}>{`Count ${count}`}</{tag}>", "A `<title>`, `<textarea>`, `<style>` or `<script>` holds a changing value next to other content.", "<textarea>{`Count ${count}`}</textarea>"),
211
+ entry("BRM154", "Put <title> in #head, as <meta> and <link>, such as #head { <title>{`${count} left`}</title> }", "A `<title>` is outside `#head`.", "#head {\n <title>{`${count} left`}</title>\n}"),
212
+ entry("BRM155", "A dynamic tag that changes on the client is not supported yet", "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.", "<{tag} class=\"title\">Title</>"),
213
+ entry("BRM156", "Code that the browser updates can await only a memo. Load the promise in a memo instead", "Code that runs again in the browser awaits something other than a memo.", "const user = $memo(await load(id));"),
214
+ entry("BRM157", "Markup that the browser renders can await only a memo. Load the promise in a memo instead", "Markup that the browser renders awaits something other than a memo.", "const user = $memo(await load(id));"),
215
+ entry("BRM158", "This attribute cannot change on the client yet", "The name or the value of an attribute with a computed name, as in `[name]=value`, changes in the browser.", "<div class=(open ? \"open\" : \"closed\")></div>"),
216
+ entry("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", "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.", "let name = $signal('data-x');\nlet value = $signal('on');\n\n<button onClick=(() => ((name = 'data-y'), (value = 'off')))>Change</button>\n<p {...props} [name]=(value)></p>\n<p {...props} data-x=\"on\"></p>"),
217
+ entry("BRM160", "Destructuring assignment to a signal is not supported in client code yet", "Code that runs in the browser writes a signal in a destructuring assignment.", "[first, second] = pair;\n// Write each signal on its own:\nfirst = pair[0];\nsecond = pair[1];"),
218
+ entry("BRM161", "Assign to \"{name}\" with = instead of {op}", "An optimistic value is changed with `++` or `--`.", "shown = shown + 1;"),
219
+ entry("BRM162", "Invalid CSS: {message}", "A `<style>` has CSS that does not parse.", "<style>\n p {\n color: red;\n }\n</style>"),
220
+ entry("BRM163", "Module functions call each other too deeply. A module function cannot call itself", "A function of a module of reactive logic calls itself, or a loop of functions call each other.", "function counter(start: number) {\n let count = $signal(start);\n return { count };\n}")
221
+ ];
222
+ /** Errors about modules of reactive logic, such as `counter.brm.ts`. */
223
+ const MODULES = [
224
+ entry("BRM164", "Destructure what {name} returns, as in const { value } = {name}(…)", "The result of a module function is kept as one object.", "const { count, increment } = counter(0);"),
225
+ entry("BRM165", "Declare what {name} returns with const", "The result of a module function is declared with `let`.", "const { count, increment } = counter(0);"),
226
+ entry("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", "A module function is called inside a function, a condition or a loop.", "const { count, increment } = counter(0);"),
227
+ entry("BRM167", "Cannot read {specifier}", "The module that the component imports is not on disk.", "import { counter } from './counter.brm.ts';"),
228
+ entry("BRM168", "{specifier} does not export a function named {name}", "The import names a function that the module does not export.", "export function counter(start: number) {\n let count = $signal(start);\n return { count };\n}"),
229
+ entry("BRM169", "{name} needs a body that ends with return { … }", "A module function is an arrow function with an expression body.", "export function counter(start: number) {\n let count = $signal(start);\n return { count };\n}"),
230
+ entry("BRM170", "{name} must end with return { … }, an object of what it gives", "A module function does not end with `return { … }`.", "export function counter(start: number) {\n let count = $signal(start);\n return { count };\n}"),
231
+ entry("BRM171", "{name} can return only at its end", "A module function returns in the middle of its body.", "export function counter(start: number) {\n let count = $signal(start);\n return { count };\n}"),
232
+ entry("BRM172", "Destructure {name} with plain names, as in const { value, other: renamed } = {name}(…)", "The result of a module function is destructured with a default, a nested pattern or a rest.", "const { count, increment: add } = counter(0);"),
233
+ entry("BRM173", "{name} must return an object with plain keys", "The returned object has a computed key, a spread or a method.", "return { count, increment };"),
234
+ entry("BRM174", "{name} cannot return getters or setters. Return the values themselves", "The returned object has a getter or a setter.", "return { count, increment };"),
235
+ entry("BRM175", "{name} does not return {key}", "The component destructures a name that the module function does not return.", "const { count } = counter(0);"),
236
+ entry("BRM176", "{name} returns {local} as {first} and as {key}. Return each local once, and give the other key a function of its own", "A module function returns one local under two keys.", "return { count, increment };"),
237
+ entry("BRM177", "{name} is declared twice", "A name of the module function is also a name of the component.", "const { count: first } = counter(0);\nconst { count: second } = counter(10);"),
238
+ entry("BRM178", "Parameters of {name} must be plain names", "A module function has a destructured or default parameter.", "export function counter(start: number) {\n let count = $signal(start);\n return { count };\n}"),
239
+ entry("BRM179", "{name} reads {local}, which {specifier} does not export. Export it, so the component can import it", "A module function reads a value of its module that is not exported.", "export const STEP = 1;")
240
+ ];
241
+ const ERRORS = [
242
+ ...SYNTAX,
243
+ ...SCRIPT,
244
+ ...OUTPUT,
245
+ ...MODULES
246
+ ];
247
+ /** True when a message that the compiler reported has the form of an entry. */
248
+ function matchesError(error, message) {
249
+ const escaped = [];
250
+ for (const part of error.message.split(/\{\w+\}/)) escaped.push(part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
251
+ const pattern = escaped.join("[\\s\\S]*?");
252
+ return new RegExp(`^${pattern}$`).test(message);
253
+ }
254
+ /**
255
+ * The entry for a message that the compiler reported. The place of the
256
+ * error, as in `(File.brm:3:7)`, can follow the message.
257
+ */
258
+ function findError(message) {
259
+ const bare = message.replace(/(?:\s\([^()]*:\d+:\d+\))+$/, "").replace(/\s\[BRM\d+\]$/, "");
260
+ function fixed(error) {
261
+ return error.message.replace(/\{\w+\}/g, "").length;
262
+ }
263
+ let found;
264
+ for (const error of ERRORS) if (matchesError(error, bare) && (!found || fixed(error) > fixed(found))) found = error;
265
+ return found;
266
+ }
267
+ /** The text of references/errors.md. */
268
+ function renderErrors() {
269
+ const lines = [
270
+ "# Errors",
271
+ "",
272
+ "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.",
273
+ "",
274
+ "It is generated from `src/error-catalog.ts`. Do not edit it by hand."
275
+ ];
276
+ for (const error of ERRORS) {
277
+ lines.push("", `## ${error.code ? `${error.code}: ` : ""}${error.message}`, "", error.cause);
278
+ if (error.link) lines.push("", error.link);
279
+ lines.push("", "```brm fragment", error.fix, "```");
280
+ }
281
+ return `${lines.join("\n")}\n`;
282
+ }
283
+ /** The text of website/docs/errors.md: one section for each code. */
284
+ function renderErrorsPage() {
285
+ const lines = [
286
+ "# Compile errors",
287
+ "",
288
+ "Each compile error of brumate has a code. The code is part of the message, and `brumate check` prints it with a link to its section here. A `{name}` in a message is a part that varies.",
289
+ "",
290
+ "This page is generated from `packages/brumate/src/error-catalog.ts`. Do not edit it by hand."
291
+ ];
292
+ for (const error of ERRORS) {
293
+ lines.push("", `## ${error.code}`, "", `\`${error.message}\``, "", error.cause);
294
+ lines.push("", `\`\`\`${fenceLanguage(error.fix)}`, error.fix, "```");
295
+ }
296
+ return `${lines.join("\n")}\n`;
297
+ }
298
+ /**
299
+ * The language of the code block of a fix on the site: `brm` when it has markup, and `ts` when it
300
+ * is only script code, which the `.brm` highlighter would color as text.
301
+ */
302
+ function fenceLanguage(fix) {
303
+ return /^\s*(?:<[A-Za-z/!]|#[a-z]+\b|\{)/m.test(fix) ? "brm" : "ts";
304
+ }
305
+ //#endregion
306
+ export { findError as a, renderErrorsPage as c, errorLink as i, ERRORS as n, matchesError as o, ERRORS_PAGE as r, renderErrors as s, DOCS_SITE as t };
307
+
308
+ //# sourceMappingURL=error-catalog-DakxjSgj.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-catalog-DakxjSgj.js","names":[],"sources":["../src/error-catalog.ts"],"sourcesContent":["/** One compile error of a `.brm` file. */\nexport interface ErrorEntry {\n /** The message the compiler reports, with `{name}` for the parts that vary. */\n message: string;\n /** What causes it, in one sentence. */\n cause: string;\n /** The form to write instead, as a short `brm` example. */\n fix: string;\n /** A code such as BRM012. It never changes and is never reused. */\n code?: string;\n /** The docs page that explains the code. */\n link?: string;\n}\n\n/**\n * Codes are stable. A new entry takes the next number that was never used,\n * wherever the entry sits in the catalog. Never change the code of an entry,\n * and never reuse a code. When an error is removed, delete its entry and\n * leave its number unused. test/error-codes.json pins each code to its\n * message, so a test fails when a code changes or is reused. Rewording a\n * message needs a hand edit of that file, for the same code. Add the code of\n * a new entry to it with `UPDATE_SKILL=1 npx vitest run test/check-command.test.ts`.\n */\n\n/** The address of the docs site. Change it here when the site moves. */\nexport const DOCS_SITE = 'https://brumate-docs.vercel.app';\n\n/** The page of the docs that explains every code, with one anchor for each. */\nexport const ERRORS_PAGE: string = `${DOCS_SITE}/docs/errors`;\n\n/** The link to the explanation of a code. */\nexport function errorLink(code: string): string {\n return `${ERRORS_PAGE}#${code.toLowerCase()}`;\n}\n\nfunction entry(code: string, message: string, cause: string, fix: string): ErrorEntry {\n return { message, cause, fix, code, link: errorLink(code) };\n}\n\n/** Syntax errors of the parser, in the order of a file. */\nconst SYNTAX: ErrorEntry[] = [\n entry(\n 'BRM001',\n 'Unterminated comment',\n 'A comment starts and never ends.',\n '<!-- A comment ends with -->\\n<script>\\n /* and so does this one */\\n</script>',\n ),\n entry(\n 'BRM002',\n 'Unterminated string',\n 'A string in code starts and never ends.',\n \"const name = 'Ada';\",\n ),\n entry(\n 'BRM003',\n 'Unterminated template literal',\n 'A template string starts and never ends.',\n 'const label = `Hello ${name}`;',\n ),\n entry(\n 'BRM004',\n 'Unterminated regular expression',\n 'A regular expression starts and never ends.',\n 'const digits = /\\\\d+/;',\n ),\n entry(\n 'BRM005',\n 'Unexpected \"{char}\"',\n 'Code has a bracket that closes nothing.',\n 'const list = [1, 2];',\n ),\n entry(\n 'BRM006',\n 'Expected \"{char}\"',\n 'Code opens a bracket and never closes it. The message names the closing one.',\n 'const list = [1, 2];',\n ),\n entry(\n 'BRM007',\n 'Expected \"}\" to close the block',\n 'A `#` block opens with `{` and the file ends before its `}`.',\n '#if (open) {\\n <p>Open</p>\\n}',\n ),\n entry(\n 'BRM008',\n 'Unexpected end of file, expected a closing tag',\n 'An element is never closed.',\n '<div>\\n <p>Text</p>\\n</div>',\n ),\n entry('BRM009', 'Unexpected closing tag', 'A closing tag has no opening tag.', '<p>Text</p>'),\n entry(\n 'BRM010',\n '<script> must be at the top level or at the start of a block',\n 'A `<script>` is inside an element, or after other markup in a block.',\n '#for (item of items) {\\n <script>\\n let open = $signal(false);\\n </script>\\n <p>{item}</p>\\n}',\n ),\n entry(\n 'BRM011',\n '<style> must be at the top level of the file or of a block',\n 'A `<style>` is inside an element.',\n '<style>\\n p {\\n color: red;\\n }\\n</style>\\n<p>Text</p>',\n ),\n entry(\n 'BRM012',\n '#template must be at the top level or at the start of a block',\n 'A `#template` is inside an element, or after other markup in a block.',\n '#template price(amount: number) {\\n <b>{amount}</b>\\n}',\n ),\n entry(\n 'BRM013',\n '#{branch} must follow its block',\n 'A branch such as `#else` or `#catch` comes without the block that it belongs to.',\n '#if (open) {\\n <p>Open</p>\\n} #else {\\n <p>Closed</p>\\n}',\n ),\n entry('BRM014', 'Expected a tag name', 'A `<` starts a tag with no name.', '<p>1 &lt; 2</p>'),\n entry(\n 'BRM015',\n '<{name}> must end with \"/>\"',\n '`<window>` and `<document>` take no children, so they close with `/>`.',\n '<window onKeyDown=(handler) />',\n ),\n entry('BRM016', 'Expected </{name}>', 'A closing tag is not complete.', '<p>Text</p>'),\n entry(\n 'BRM017',\n 'Unexpected end of file, expected \">\"',\n 'A tag starts and the file ends before its `>`.',\n '<input value=name>',\n ),\n entry(\n 'BRM018',\n 'Expected whitespace between attributes',\n 'Two attributes touch each other.',\n '<input id=name type=\"text\">',\n ),\n entry(\n 'BRM019',\n 'Only event handlers are allowed here',\n '`<window>` and `<document>` take event handlers and nothing else.',\n '<document onKeyDown=(handler) />',\n ),\n entry(\n 'BRM020',\n 'Expected a spread or a shorthand attribute',\n 'A `{` in a tag holds something other than `...rest` or a name.',\n '<a {href} {...rest}>Open</a>',\n ),\n entry(\n 'BRM021',\n 'Expected an attribute name',\n 'A tag has a character where an attribute name belongs.',\n '<input disabled>',\n ),\n entry(\n 'BRM022',\n 'Event modifiers in the attribute name were removed. Write {fix}',\n 'A modifier follows the event name, as in `onSubmit:prevent=send`. Wrappers of `brumate/events` write modifiers now, and `:passive` is the default, since listeners are passive unless a handler prevents.',\n \"import { prevent } from 'brumate/events';\\n\\n<form onSubmit=(prevent(send))></form>\",\n ),\n entry(\n 'BRM180',\n '\"{name}\" is not an event name. Write \"{camel}\"',\n 'An event of more than one word is written in camel case. The lower-case form is an error.',\n '<input onKeyDown=(handle) onFocusOut=(handle) />',\n ),\n entry(\n 'BRM201',\n '\"{name}\" cannot be a handler. {fix}',\n \"The event has capitals in its name, or the browser fires another name for it, and a handler name is lower-cased to the event. `onDOMContentLoaded` would listen to `domcontentloaded`, which the browser never fires, and page code loads after the HTML, mostly after `DOMContentLoaded`. Use the event that the message names, or `$client(fn, 'load')` to run code at load.\",\n \"<script>\\n $client(() => {\\n start();\\n }, 'load');\\n</script>\",\n ),\n entry(\n 'BRM186',\n '\"{name}\" in the #loading header is not a memo that markup in the body reads. Name a $memo of the component or of a block script around the block',\n 'The header of `#loading (…)` names something other than a memo, or a memo that no markup in the body reads, so its loads would not show the fallback for that body.',\n 'const posts = $memo(loadPosts(id));\\n#loading (posts) {\\n <p>{posts.length} posts</p>\\n} #else {\\n <p>Loading</p>\\n}',\n ),\n entry(\n 'BRM182',\n 'The handler reads \"{name}\", a memo that can lack a value. Wait for it with await $resolve({name}), or check $isPending({name}) first',\n '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.',\n '<script>\\n const user = $memo(getUser(id));\\n async function save() {\\n await $resolve(user);\\n send(user.name);\\n }\\n</script>',\n ),\n entry(\n 'BRM183',\n '$resolve needs a $memo and, as an option, a timeout or a signal',\n '`$resolve` takes the name of a memo, and one object of options at most.',\n 'async function save() {\\n const profile = await $resolve(user, { timeout: 5000 });\\n}',\n ),\n entry(\n 'BRM184',\n '$resolve cannot run where a memo computes or markup renders. Call it in a handler, an effect or a $client callback',\n '`$resolve` waits, so it is called where an event starts the code, not where a memo computes or markup renders.',\n 'async function save() {\\n await $resolve(user);\\n}',\n ),\n entry(\n 'BRM185',\n '<{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\"',\n '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.',\n '<p>Total: <span>{total}</span></p>\\n<div>\\n <p>Total</p>\\n</div>',\n ),\n entry(\n 'BRM187',\n 'The {kind} {name} of {component} did not settle: it writes a value that it reads, and runs again without end. Wrap the read or the write in $untrack, or write only when the value changes',\n 'In the browser, an effect or an update writes a value that it reads, so each run schedules the next. Past 1000 rounds of effects, or 10000 rounds of updates, in one change, the page stops the loop and sends this error to the nearest `#try` in place of hanging the tab. A production build sends the short form `Update loop {scope}:{name} [BRM187]`.',\n \"<script>\\n import { $effect, $signal, $untrack } from 'brumate/signals';\\n\\n let query = $signal('');\\n let saves = $signal(0);\\n\\n $effect(() => {\\n void query;\\n $untrack(saves++);\\n });\\n</script>\",\n ),\n entry(\n 'BRM188',\n '\"{name}\" gives a promise, and {place} cannot wait for one. Await it in the code that runs, or read its value with $memo',\n 'Markup waits for a promise in text and in attribute values only. An event handler, the key of a `#for`, a `ref` and a `$bind` need the value at once, and the compiler sees that this expression gives a promise: `new Promise(…)`, a call of a server function or of an async function, or a prop typed as a promise.',\n '<button onClick=(() => save(draft))>Save</button>\\n#for (user of users by user.id) {\\n <p>{user.name}</p>\\n}',\n ),\n entry(\n 'BRM024',\n 'Expected an event handler',\n 'An event attribute has no `=` and no value.',\n '<button onClick=(() => count++)>Add</button>',\n ),\n entry(\n 'BRM025',\n 'An event handler must be an expression, not a string',\n 'The value of an event attribute is a quoted string.',\n '<button onClick=(() => count++)>Add</button>',\n ),\n entry(\n 'BRM026',\n 'An attribute name can have one \":\" namespace',\n 'An attribute name has two or more `:`.',\n '<svg xlink:href=\"#icon\"></svg>',\n ),\n entry(\n 'BRM027',\n 'ref takes $bind, as in ref=$bind(name)',\n '`ref` has a value that is not `$bind(name)`.',\n '<input ref=$bind(input)>',\n ),\n entry(\n 'BRM028',\n 'prefetch is removed. The code of the page loads when it starts',\n 'The `prefetch` attribute no longer exists.',\n '<a href=\"/about\">About</a>',\n ),\n entry(\n 'BRM029',\n 'Markup is not allowed in attribute values. Use a #template.',\n 'An attribute value holds an element.',\n '<List item=row />\\n\\n#template row(name: string) {\\n <b>{name}</b>\\n}',\n ),\n entry(\n 'BRM030',\n 'Expected an attribute value',\n 'An attribute has `=` and nothing after it.',\n '<input value=name>',\n ),\n entry(\n 'BRM031',\n 'Wrap this attribute value in parentheses',\n 'An attribute value without quotes has an operator or a space in it.',\n '<button disabled=(count > 3)>Add</button>',\n ),\n entry(\n 'BRM032',\n 'Expected \">\" to end <{name}>',\n 'A tag has text where its `>` belongs.',\n '<input value=name>',\n ),\n entry(\n 'BRM033',\n 'Expected a quoted value',\n 'A `<script>` or `<style>` attribute has `=` without a quoted value.',\n '<script generics=\"T\"></script>',\n ),\n entry(\n 'BRM034',\n 'Expected {close}',\n 'A `<script>` or `<style>` is not closed.',\n '<script>\\n let a = 1;\\n</script>',\n ),\n entry(\n 'BRM035',\n 'Unknown <script> attribute \"{name}\"',\n 'A `<script>` has an attribute other than `module` and `generics`.',\n '<script module>\\n export const MAX = 10;\\n</script>',\n ),\n entry(\n 'BRM036',\n 'A file can have one <script module>',\n 'A file has two module scripts.',\n '<script module>\\n export const MAX = 10;\\n export const MIN = 1;\\n</script>',\n ),\n entry(\n 'BRM037',\n 'A file can have one <script>',\n 'A file has two instance scripts.',\n '<script>\\n let a = $signal(1);\\n let b = $signal(2);\\n</script>',\n ),\n entry(\n 'BRM038',\n 'lang must be \"css\", \"scss\" or \"less\"',\n 'A `<style>` names another language.',\n '<style lang=\"scss\">\\n p {\\n a {\\n color: red;\\n }\\n }\\n</style>',\n ),\n entry(\n 'BRM189',\n 'Unknown <style> attribute \"{name}\"',\n 'A `<style>` has an attribute other than `lang` and `global`.',\n '<style scoped>\\n p {\\n color: red;\\n }\\n</style>',\n ),\n entry(\n 'BRM207',\n '#reveal has no style of its own',\n 'A `<style>` is in the body of a `#reveal`, which only orders the bodies inside it.',\n '<style>\\n p {\\n color: red;\\n }\\n</style>\\n#reveal {\\n #loading {\\n <p>Loaded</p>\\n }\\n}',\n ),\n entry(\n 'BRM190',\n 'global takes no value, as in <style global>',\n 'A `<style global>` gives `global` a value.',\n '<style global=\"true\">\\n p {\\n color: red;\\n }\\n</style>',\n ),\n entry(\n 'BRM039',\n \"#reveal takes an order, 'sequential', 'backwards', 'together' or 'natural', and collapsed, such as #reveal ('sequential', collapsed)\",\n '`#reveal` has an option that it does not know.',\n \"#reveal ('sequential', collapsed) {\\n …\\n}\",\n ),\n entry(\n 'BRM040',\n \"collapsed shows the fallback of the next body to show, so it needs the order 'sequential', not '{order}'\",\n '`collapsed` goes with `sequential` only.',\n \"#reveal ('sequential', collapsed) {\\n …\\n}\",\n ),\n entry(\n 'BRM041',\n '#reveal has no script of its own',\n 'A `#reveal` body starts with a `<script>`.',\n '<script>\\n let open = $signal(false);\\n</script>\\n#reveal {\\n …\\n}',\n ),\n entry(\n 'BRM042',\n 'Expected \"(\" after #{keyword}',\n 'A block that takes a condition or a list has no `(`.',\n '#if (open) {\\n <p>Open</p>\\n}',\n ),\n entry(\n 'BRM043',\n 'Expected an expression after #{keyword}',\n 'The parentheses of a block are empty.',\n '#if (open) {\\n <p>Open</p>\\n}',\n ),\n entry(\n 'BRM044',\n 'Expected \"{\" after #{keyword}',\n 'The header of a block is not followed by `{`.',\n '#if (open) {\\n <p>Open</p>\\n}',\n ),\n entry(\n 'BRM045',\n 'Expected \"{\" after #switch',\n '`#switch` has no `{` after it.',\n '#switch {\\n #case (tab === 1) {\\n <p>One</p>\\n }\\n}',\n ),\n entry(\n 'BRM046',\n 'The script of a block takes no attributes',\n 'A `<script>` at the start of a block has attributes such as `module`.',\n '#for (item of items) {\\n <script>\\n let open = $signal(false);\\n </script>\\n <p>{item}</p>\\n}',\n ),\n entry(\n 'BRM047',\n '#try needs a #catch block',\n 'A `#try` body is not followed by `#catch`.',\n '#try {\\n <p>{load()}</p>\\n} #catch (error, reset) {\\n <p>Failed</p>\\n}',\n ),\n entry(\n 'BRM048',\n 'Expected \"(error, reset)\" after #catch',\n 'The header of `#catch` names something other than a plain error name and a plain reset name.',\n '#catch (error, reset) {\\n <p>{String(error)}</p>\\n}',\n ),\n entry(\n 'BRM049',\n 'The trigger of #{keyword} must be \"visible\", \"idle\" or \"load\"',\n 'A `#client` block names another trigger.',\n \"#client ('idle') {\\n <p>In the browser</p>\\n}\",\n ),\n entry(\n 'BRM050',\n 'Unknown block #{keyword}',\n 'A `#` starts a block that does not exist.',\n '#if (open) {\\n <p>Open</p>\\n}',\n ),\n entry(\n 'BRM051',\n 'Expected \"index of count\" after #repeat',\n 'The header of `#repeat` is not `index of count`.',\n '#repeat (star of 5) {\\n <i>{star}</i>\\n}',\n ),\n entry(\n 'BRM052',\n 'Expected \"item of list\" or \"item, index of list\" after #for',\n 'The header of `#for` has no `of`.',\n '#for (item, index of items by item.id) {\\n <li>{item.name}</li>\\n}',\n ),\n entry(\n 'BRM053',\n 'Expected the height of an item in window(height)',\n '`window` after a `#for` header has no height.',\n '#for (row of rows by row.id) window(32) {\\n <tr><td>{row.name}</td></tr>\\n}',\n ),\n entry(\n 'BRM054',\n 'Only #case and #default are allowed in #switch',\n 'A `#switch` holds markup other than its cases.',\n '#switch {\\n #case (tab === 1) {\\n <p>One</p>\\n }\\n #default {\\n <p>Other</p>\\n }\\n}',\n ),\n entry(\n 'BRM055',\n '#default must be the last branch of #switch',\n 'A `#case` comes after the `#default`.',\n '#switch {\\n #case (tab === 1) {\\n <p>One</p>\\n }\\n #default {\\n <p>Other</p>\\n }\\n}',\n ),\n entry(\n 'BRM056',\n 'Expected \"(\" after the name of the template',\n 'A `#template` has no parameter list.',\n '#template price(amount: number) {\\n <b>{amount}</b>\\n}',\n ),\n entry(\n 'BRM057',\n 'Expected an expression',\n 'An attribute or a block has code that is not an expression.',\n '<p>{count + 1}</p>',\n ),\n entry(\n 'BRM058',\n 'Expected a binding pattern',\n 'The name of a `#for` or `#catch` is not a name or a pattern.',\n '#for ({ id, name } of people by id) {\\n <li>{name}</li>\\n}',\n ),\n entry(\n 'BRM059',\n 'Expected parameters',\n 'The parameters of a `#template` are not a parameter list.',\n '#template price(amount: number) {\\n <b>{amount}</b>\\n}',\n ),\n];\n\n/** Errors about `$signal`, `$memo` and the other compile-time functions. */\nconst SCRIPT: ErrorEntry[] = [\n entry(\n 'BRM060',\n '\"{name}\" is already declared',\n 'Two declarations of one scope have the same name.',\n 'let count = $signal(0);\\nlet total = $signal(0);',\n ),\n entry(\n 'BRM061',\n '{name} takes a handler',\n '`prevent`, `stop`, `once`, `capture` or `transition` has no handler, or `stop`, `once` or `capture` has keys.',\n '<form onSubmit=(prevent(send))></form>',\n ),\n entry(\n 'BRM062',\n 'Only prevent of a keyboard event takes keys, such as onKeyDown',\n 'Keys are given to `prevent` of an event that is not `onKeyDown`, `onKeyUp` or `onKeyPress`.',\n \"<ul onKeyDown=(prevent(move, 'ArrowDown'))></ul>\",\n ),\n entry(\n 'BRM063',\n \"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'\",\n 'A key of `prevent` is not a string literal of an `event.key`.',\n \"<ul onKeyDown=(prevent(move, 'ArrowDown', 'Mod+ArrowUp'))></ul>\",\n ),\n entry(\n 'BRM064',\n \"Name each key of prevent as a string, such as 'Enter'\",\n 'A key of `prevent` is not a string literal.',\n \"<input onKeyDown=(prevent(submit, 'Enter'))>\",\n ),\n entry(\n 'BRM065',\n 'Server function \"{name}\" must be async',\n \"A function with `'use server'` is not `async`.\",\n \"async function save(list: string[]) {\\n 'use server';\\n await db.save(list);\\n}\",\n ),\n entry(\n 'BRM066',\n 'The module script cannot have a default export',\n '`<script module>` has `export default`.',\n '<script module>\\n export const MAX = 10;\\n</script>',\n ),\n entry(\n 'BRM067',\n 'A script cannot export values. Use <script module>',\n 'The instance script has an `export`.',\n '<script module>\\n export const MAX = 10;\\n</script>',\n ),\n entry(\n 'BRM068',\n '$title takes one argument, the title',\n '`$title` has no argument or more than one.',\n \"$title('Todos');\",\n ),\n entry(\n 'BRM069',\n 'await works with $memo, not {name}',\n 'A declaration awaits a compile-time function other than `$memo`.',\n 'const user = $memo(await load(id));',\n ),\n entry(\n 'BRM070',\n '$props() can only be called in the component script',\n '`$props()` is in a module script or a function.',\n 'const { name } = $props<{ name: string }>();',\n ),\n entry(\n 'BRM071',\n 'Assign $props() to a const or a let',\n 'The result of `$props()` is not assigned with `const` or `let`.',\n 'const { name } = $props<{ name: string }>();',\n ),\n entry(\n 'BRM072',\n '$props() takes no arguments',\n '`$props()` has an argument.',\n 'const { name } = $props<{ name: string }>();',\n ),\n entry(\n 'BRM073',\n 'Assign $props() to a name or an object pattern',\n '`$props()` is assigned to an array pattern.',\n 'const { name } = $props<{ name: string }>();',\n ),\n entry(\n 'BRM074',\n 'Create an ID with \"const name = $id()\"',\n '`$id()` is not the value of a `const`.',\n 'const field = $id();',\n ),\n entry('BRM075', '$id takes no arguments', '`$id` has an argument.', 'const field = $id();'),\n entry(\n 'BRM076',\n '$isPassed takes a prop that the component destructures, such as $isPassed(value)',\n 'The argument of `$isPassed` is not a prop of the component.',\n 'let { value } = $props<{ value?: Bindable<string> }>();\\nconst passed = $isPassed(value);',\n ),\n entry(\n 'BRM077',\n '$navigation takes no arguments',\n '`$navigation` has an argument.',\n 'const navigation = $navigation();',\n ),\n entry(\n 'BRM078',\n '$route takes at most one argument, the path of the route',\n '`$route` has more than one argument.',\n \"const route = $route('/posts/[id]');\",\n ),\n entry(\n 'BRM079',\n 'Read a context with \"const name = $getContext(Context)\"',\n '`$getContext` is not the value of a `const`.',\n 'const theme = $getContext(ThemeContext);',\n ),\n entry(\n 'BRM080',\n '$getContext takes the context, and a fallback for a read without a provider',\n '`$getContext` has no argument or more than two.',\n 'const theme = $getContext(ThemeContext);\\nconst locale = $getContext(LocaleContext, undefined);',\n ),\n entry(\n 'BRM081',\n '$setContext takes two arguments, the context and the value',\n '`$setContext` has fewer or more than two arguments.',\n '$setContext(ThemeContext, theme);',\n ),\n entry(\n 'BRM082',\n 'Declare the result of a form with \"const name = $action(serverFunction)\"',\n '`$action` is not the value of a `const`.',\n 'const result = $action(save);',\n ),\n entry(\n 'BRM083',\n '$action needs a server function of this file as its only argument',\n '`$action` has no argument, or more than one.',\n 'const result = $action(save);',\n ),\n entry(\n 'BRM084',\n '$action needs a server function of this file, and {name} is not one',\n \"The argument of `$action` is not a function with `'use server'` in this file.\",\n \"async function save(data: FormData) {\\n 'use server';\\n}\\nconst result = $action(save);\",\n ),\n entry(\n 'BRM085',\n 'Declare {name} with const',\n '`$debounced` or `$throttled` is declared with `let`.',\n 'const query = $debounced(text, 300);',\n ),\n entry(\n 'BRM086',\n '{name} cannot be destructured',\n 'A signal, a memo or another value of a compile-time function is declared with a pattern.',\n 'let count = $signal(0);',\n ),\n entry(\n 'BRM087',\n '{name} takes a value and a wait in milliseconds',\n '`$debounced` or `$throttled` does not have both arguments.',\n 'const query = $debounced(text, 300);',\n ),\n entry(\n 'BRM088',\n 'The wait of {name} must be a number of milliseconds, such as 300',\n 'The wait of `$debounced` or `$throttled` is not a number literal.',\n 'const query = $debounced(text, 300);',\n ),\n entry(\n 'BRM089',\n 'Declare {name} with {expected}',\n '`$signal` and `$optimistic` need `let`, and `$memo` needs `const`.',\n 'let count = $signal(0);\\nconst double = $memo(count * 2);',\n ),\n entry(\n 'BRM090',\n '{name} takes one argument',\n '`$signal`, `$memo` or `$optimistic` has more than one argument.',\n 'let count = $signal(0);',\n ),\n entry(\n 'BRM091',\n '{name} needs a value',\n '`$memo` or `$optimistic` has no argument.',\n 'const double = $memo(count * 2);',\n ),\n entry(\n 'BRM092',\n '$optimistic needs the name of a value, such as a memo',\n 'The argument of `$optimistic` is not a name.',\n 'let shown = $optimistic(items);',\n ),\n entry(\n 'BRM093',\n '{name} does not return a value',\n '`$effect` or `$client` is assigned to a name.',\n '$effect(() => {\\n document.title = title;\\n});',\n ),\n entry(\n 'BRM094',\n '{name} needs a function',\n '`$effect` or `$client` has no function as its callback.',\n '$effect(() => {\\n document.title = title;\\n});',\n ),\n entry(\n 'BRM095',\n 'The callback of {name} takes no parameters',\n 'The callback of `$effect` or `$client` has parameters.',\n '$effect(() => {\\n document.title = title;\\n});',\n ),\n entry(\n 'BRM096',\n 'The callback of {name} cannot be async',\n 'The callback of `$effect` or `$client` is `async`.',\n '$effect(() => {\\n load(id).then((value) => (data = value));\\n});',\n ),\n entry(\n 'BRM097',\n '$effect takes one argument',\n '`$effect` has more than one argument.',\n '$effect(() => {\\n document.title = title;\\n});',\n ),\n entry(\n 'BRM098',\n 'The trigger of $client must be \"visible\", \"idle\" or \"load\"',\n 'The second argument of `$client` is another string.',\n \"$client(() => {\\n measure();\\n}, 'idle');\",\n ),\n entry(\n 'BRM099',\n '$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',\n 'The first argument of `$handler` is not a function.',\n 'onClick: $handler(prevent(removeAt), index),',\n ),\n entry(\n 'BRM100',\n '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})',\n 'A handler reads a local value of the function that calls `$handler`.',\n 'onClick: $handler(removeAt, index),',\n ),\n entry(\n 'BRM101',\n 'The arguments of $handler cannot be spread',\n '`$handler` has a spread argument.',\n 'onClick: $handler(removeAt, index, kind),',\n ),\n entry(\n 'BRM102',\n 'The second argument of $bind is a function that takes the new value: a function expression, or a function of the script',\n 'The setter of `$bind` is not a function.',\n '<Toggle on=$bind(open, (next) => (open = next)) />',\n ),\n entry(\n 'BRM103',\n 'The setter reads \"{name}\", a value of the function around $bind, which the browser does not have',\n 'The setter of `$bind` reads a local value that is not a value of the component.',\n '<Toggle on=$bind(open, (next) => (open = next)) />',\n ),\n entry(\n 'BRM104',\n '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',\n '`$bind` is somewhere else, such as on a `class` or a `<div>`.',\n '<input value=$bind(draft)>',\n ),\n entry(\n 'BRM105',\n '$bind takes the name of a signal, and a function that writes it, such as $bind(open) or $bind(open, (next) => (open = next))',\n '`$bind` has no argument, or an argument that is not a name.',\n '<Toggle on=$bind(open) />',\n ),\n entry(\n 'BRM106',\n '$bind takes a signal, or a prop that the component destructures with let, and \"{name}\" is not one',\n 'The name in `$bind` is a memo, a const prop or another value.',\n 'let open = $signal(false);\\n<Toggle on=$bind(open) />',\n ),\n entry(\n 'BRM107',\n '$isBound takes a prop that the component destructures with let, such as $isBound(open)',\n 'The argument of `$isBound` is not a `let` prop.',\n 'let { open } = $props<{ open?: Bindable<boolean> }>();\\nconst bound = () => $isBound(open);',\n ),\n entry(\n 'BRM108',\n '$isPending needs async $memos as its arguments',\n 'An argument of `$isPending` is not a memo that holds a promise, or the call has none.',\n 'const results = $memo(search(query));\\n#if ($isPending(results)) {\\n <p>Searching…</p>\\n}',\n ),\n entry(\n 'BRM109',\n '$produce needs a signal as its first argument',\n 'The first argument of `$produce` is not a signal.',\n '$produce(todos, (draft) => {\\n draft.push(todo);\\n});',\n ),\n entry(\n 'BRM110',\n '$produce needs a recipe function as its second argument',\n 'The second argument of `$produce` is not a function.',\n '$produce(todos, (draft) => {\\n draft.push(todo);\\n});',\n ),\n entry(\n 'BRM111',\n '\"{name}\" is reserved. Brumate writes the attributes that start with \"b-\"',\n 'An attribute starts with `b-`.',\n '<div data-id=id></div>',\n ),\n entry(\n 'BRM112',\n '\"{name}\" is not declared',\n 'The name in `ref=$bind(name)` is not a value of the component.',\n 'let input = $signal<HTMLInputElement>();\\n<input ref=$bind(input)>',\n ),\n entry(\n 'BRM113',\n 'ref takes a $signal, or a prop that the component destructures with let, but \"{name}\" is {kind}',\n 'The name in `ref=$bind(name)` is a memo, a const prop or another value.',\n 'let input = $signal<HTMLInputElement>();\\n<input ref=$bind(input)>',\n ),\n entry(\n 'BRM114',\n 'The prop \"{name}\" is not Bindable. Type it as Bindable<HTMLElement>, so a parent can bind it',\n 'A `let` prop is used as a `ref` and its type is not `Bindable`.',\n 'let { ref } = $props<{ ref?: Bindable<HTMLButtonElement> }>();',\n ),\n entry(\n 'BRM115',\n '\"{name}\" is the props object, so read one key at a time, destructure it, or spread it in markup',\n '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. A spread may hold the rest as a branch of `?:`, `&&`, `||` or `??` next to an object literal, `undefined`, `null` or `false`, such as `{...(open ? rest : {})}`.',\n 'const { class: className, ...rest } = $props();\\n<button {...rest} class=className>',\n ),\n entry(\n 'BRM116',\n '\"{name}\" is the props object, and props are read-only. Copy the key to a $signal or a $memo to change it',\n 'Code assigns to, updates or deletes a key of the props object or of the rest of `$props()`.',\n \"let title = $signal('');\\ntitle = 'New';\",\n ),\n entry(\n 'BRM117',\n 'Cannot assign to {kind} \"{name}\"',\n 'Code writes a memo, a const prop or another value that cannot change.',\n 'let count = $signal(0);\\ncount = 5;',\n ),\n entry(\n 'BRM118',\n 'Signal \"{name}\" can only be written in event handlers, effects, $client callbacks and functions',\n 'Setup code, which runs on the server, writes a signal.',\n 'let count = $signal(5);',\n ),\n entry(\n 'BRM119',\n 'Server function \"{name}\" captures \"{variable}\". Pass it as an argument',\n 'A server function reads a variable of the instance script.',\n \"async function save(user: string) {\\n 'use server';\\n}\",\n ),\n entry(\n 'BRM120',\n '$optimistic follows a memo, an action or a prop, not a signal',\n 'The source of `$optimistic` is a signal.',\n 'let shown = $optimistic(items);',\n ),\n entry(\n 'BRM121',\n 'Declare server functions at the top level of a script',\n \"A function with `'use server'` is inside another function or a block.\",\n \"async function save() {\\n 'use server';\\n}\",\n ),\n entry(\n 'BRM122',\n '{name} cannot be used here',\n 'A compile-time function is used where it is not allowed.',\n 'let count = $signal(0);',\n ),\n entry(\n 'BRM123',\n 'Call $setContext at the top level of a script',\n '`$setContext` is inside a function or a block of code.',\n '$setContext(ThemeContext, theme);',\n ),\n entry(\n 'BRM124',\n 'Call $title at the top level of a script',\n '`$title` is inside a function or a block of code.',\n \"$title('Todos');\",\n ),\n entry(\n 'BRM125',\n 'Create an ID with \"const name = $id()\" at the top level of a script',\n '`$id` is inside a function or a block of code.',\n 'const field = $id();',\n ),\n entry(\n 'BRM126',\n 'Check a prop with \"const name = $isPassed(prop)\" at the top level of the component script',\n '`$isPassed` is inside a function or a block of code.',\n 'const passed = $isPassed(value);',\n ),\n entry(\n 'BRM127',\n 'Read a context with \"const name = $getContext(Context)\" at the top level of a script',\n '`$getContext` is inside a function or a block of code.',\n 'const theme = $getContext(ThemeContext);',\n ),\n entry(\n 'BRM128',\n 'Read the route with \"const name = $route()\" at the top level of a script',\n '`$route` is inside a function or a block of code.',\n 'const route = $route();',\n ),\n entry(\n 'BRM129',\n 'Read the navigation with \"const name = $navigation()\" at the top level of a script',\n '`$navigation` is inside a function or a block of code.',\n 'const navigation = $navigation();',\n ),\n entry(\n 'BRM130',\n 'Call $props() as the value of a const in the component script',\n '`$props` is used in another place than `const { … } = $props()`.',\n 'const { name } = $props<{ name: string }>();',\n ),\n entry(\n 'BRM131',\n 'Declare a signal with \"let name = $signal(value)\" at the top level of a script',\n '`$signal` is inside a function or a block of code.',\n 'let count = $signal(0);',\n ),\n entry(\n 'BRM132',\n 'Declare a memo with \"const name = $memo(value)\" at the top level of a script',\n '`$memo` is inside a function or a block of code.',\n 'const double = $memo(count * 2);',\n ),\n entry(\n 'BRM202',\n '$gate takes a value and a function, as in $gate(value, (prev, next) => next > prev)',\n '`$gate` does not have a value and a guard function as its two arguments. The guard is an arrow function or a function expression.',\n 'const query = $gate(input, (_, next) => next.length >= 2);',\n ),\n entry(\n 'BRM203',\n '$gate takes a value that is ready. Use $memo for a promise or a server function',\n 'The value of `$gate` awaits or calls a server function. The compiler catches these two; any other promise or stream, such as a call of a local async function, throws when the value is computed. A gate holds a value that the guard can compare, so it does not wait for one.',\n 'const query = $gate(input, (_, next) => next.length >= 2);',\n ),\n entry(\n 'BRM204',\n 'Declare a gated value with \"const name = $gate(value, (prev, next) => boolean)\" at the top level of a script',\n '`$gate` is inside a function or a block of code.',\n 'const query = $gate(input, (_, next) => next.length >= 2);',\n ),\n entry(\n 'BRM133',\n 'Declare a debounced value with \"const name = $debounced(value, ms)\" at the top level of a script',\n '`$debounced` is inside a function or a block of code.',\n 'const query = $debounced(text, 300);',\n ),\n entry(\n 'BRM134',\n 'Declare a throttled value with \"const name = $throttled(value, ms)\" at the top level of a script',\n '`$throttled` is inside a function or a block of code.',\n 'const position = $throttled(pointer, 100);',\n ),\n entry(\n 'BRM135',\n 'Declare an optimistic value with \"let name = $optimistic(source)\" at the top level of a script',\n '`$optimistic` is inside a function or a block of code.',\n 'let shown = $optimistic(items);',\n ),\n entry(\n 'BRM136',\n 'Declare the result of a form with \"const name = $action(serverFunction)\" at the top level of a script',\n '`$action` is inside a function or a block of code.',\n 'const result = $action(save);',\n ),\n entry(\n 'BRM137',\n 'Call $effect at the top level of a script',\n '`$effect` is inside a function or a block of code.',\n '$effect(() => {\\n document.title = title;\\n});',\n ),\n entry(\n 'BRM138',\n 'Call $client at the top level of a script',\n '`$client` is inside a function or a block of code.',\n \"$client(() => {\\n measure();\\n}, 'idle');\",\n ),\n entry(\n 'BRM139',\n '$ref is not supported. Use a $signal with ref=$bind(name)',\n '`$ref` was removed.',\n 'let input = $signal<HTMLInputElement>();\\n<input ref=$bind(input)>',\n ),\n entry(\n 'BRM140',\n '$watch is not supported. Use $effect',\n '`$watch` was removed.',\n '$effect(() => {\\n save(value);\\n});',\n ),\n entry(\n 'BRM141',\n '$settled is not supported. Use $client',\n '`$settled` was removed.',\n '$client(() => {\\n measure();\\n});',\n ),\n entry(\n 'BRM142',\n '$cleanup is not supported. Return a cleanup function from $effect or $client',\n '`$cleanup` was removed.',\n '$effect(() => {\\n const timer = setInterval(tick, 1000);\\n return () => clearInterval(timer);\\n});',\n ),\n entry(\n 'BRM191',\n 'Read a store with \"const name = $store(source)\" or \"let name = $store(source)\" at the top level of a script',\n '`$store` is not the whole value of a `const` or `let` at the top level of a script.',\n \"import { theme } from './theme';\\nconst value = $store(theme);\",\n ),\n entry(\n 'BRM192',\n '$store takes one argument, a store',\n '`$store` has no argument, or more than one.',\n 'const field = $getContext(Field);\\nconst state = $store(field.state);',\n ),\n entry(\n 'BRM193',\n '$toStore takes one argument, a memo, a signal or a prop, as a value of $setContext',\n '`$toStore` has no argument or more than one, or it is not a value of `$setContext`, alone or as a key of an object or an item of a list.',\n '$setContext(Field, { state: $toStore(state), pick });',\n ),\n entry(\n 'BRM195',\n '$store gives one name, not a pattern such as { a }',\n '`$store` initializes a pattern.',\n 'const value = $store(source);',\n ),\n entry(\n 'BRM196',\n 'The context value reads \"{name}\", which changes, but a context value is read once. Put it in a store with $toStore, or read it inside a function',\n 'The value of `$setContext` reads a signal, a memo, a prop or a `$bind` value that changes in the browser, and a context is read once, so readers would keep the first value. A call or an immediately invoked function in the value that reads such a name is not reported, and freezes the same way.',\n '$setContext(Field, { state: $toStore(state), pick: () => value });',\n ),\n entry(\n 'BRM197',\n 'Read a context that may have no provider with \"const name = $getContext(Context, undefined)\", and a store in it with \"const state = name ? $store(name.key) : undefined\", with const and no other test',\n 'A read of a context that may have no provider has another shape: `$hasContext`, which is removed, `$store(name?.key)`, a `let` or another test in the guard, an `else` that is not `undefined`, a guard on a name that is not the optional value of `$getContext(Context, undefined)`, or a key of that value read without the guard.',\n 'const field = $getContext(Field, undefined);\\nconst state = field ? $store(field.state) : undefined;',\n ),\n entry(\n 'BRM198',\n 'The source of $store gives its store at once, so it cannot await or call a server function',\n 'The source of `$store` awaits, or calls a server function. The browser runs the source again when the page resumes, and links the store in the same pass, so the source must give the store, not a promise of it.',\n \"import { theme } from './theme';\\nconst value = $store(theme);\",\n ),\n entry(\n 'BRM199',\n '$store takes a store. Read the store of a context with \"$store($getContext(Context))\", or give a store as the fallback, \"$store($getContext(Context, store(value)))\"',\n '`$store` reads a context that the file names in `$getContext` or `$setContext`, `undefined`, `null`, or `$getContext` with a literal fallback, which is no store. A context that the file only imports is found when the page renders, as a `TypeError`.',\n \"const level = $store($getContext(LevelContext));\\nconst locale = $store($getContext(LocaleContext, store('en-US')));\",\n ),\n entry(\n 'BRM200',\n 'The value of bridge() must be a module-level export of a script file or of <script module>, as \"export const name = bridge({ … })\"',\n 'A call of `bridge` from `brumate/store` is in the script of a component, or in a function, or is not the value of an exported `const`. The page state names a bridge by its module and its export, so the browser can load it.',\n \"// bears.ts, or the <script module> of a component\\nimport { bridge } from 'brumate/store';\\nexport const bearStore = bridge({ create, get, subscribe });\",\n ),\n entry(\n 'BRM144',\n '$get is not supported. Signals cannot leave the file',\n '`$get` was removed. A signal never leaves its file.',\n '// Pass the value, or a function that writes it.\\nonChange=((next) => (count = next))',\n ),\n entry(\n 'BRM145',\n '$set is not supported. Signals cannot leave the file',\n '`$set` was removed. A signal never leaves its file.',\n '// Pass the value, or a function that writes it.\\nonChange=((next) => (count = next))',\n ),\n entry(\n 'BRM146',\n \"{name} was renamed to {renamed}. Import {renamed} from '{module}'\",\n 'The file imports a name that the compiler knew before it was renamed.',\n \"import { $signal } from 'brumate/signals';\",\n ),\n entry(\n 'BRM147',\n \"Import {name} from '{module}'\",\n 'The file calls a compile-time function that it does not import.',\n \"import { $signal } from 'brumate/signals';\",\n ),\n];\n\n/** Errors about the code that the browser gets, and the markup that the browser renders. */\nconst OUTPUT: ErrorEntry[] = [\n entry(\n 'BRM148',\n '\"{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',\n 'A value that cannot be sent to the browser, such as a database client, is read by code that runs there.',\n \"async function list() {\\n 'use server';\\n return db.all();\\n}\",\n ),\n entry(\n 'BRM149',\n '{what} is read by code that runs in the browser ({site}). Read it in a server function',\n 'Code that runs in the browser reads an environment variable of the server.',\n \"async function key() {\\n 'use server';\\n return env.API_KEY;\\n}\",\n ),\n entry(\n 'BRM150',\n '\"{name}\" holds {what} and code that runs in the browser reads it. Keep server variables out of values that the browser reads',\n 'A value holds an environment variable of the server, and the browser reads the value.',\n \"async function key() {\\n 'use server';\\n return env.API_KEY;\\n}\",\n ),\n entry(\n 'BRM151',\n '#defer cannot be inside a #client body',\n 'A `#defer` is in markup that only the browser renders.',\n '#defer {\\n <Comments />\\n}',\n ),\n entry(\n 'BRM152',\n '#defer cannot be in markup that the browser renders',\n 'A `#defer` is in a body that the browser adds later, such as the body of a changing `#if`.',\n '#defer {\\n <Comments />\\n}',\n ),\n entry(\n 'BRM153',\n 'A value that changes in <{tag}> must be its whole content, such as <{tag}>{`Count ${count}`}</{tag}>',\n 'A `<title>`, `<textarea>`, `<style>` or `<script>` holds a changing value next to other content.',\n '<textarea>{`Count ${count}`}</textarea>',\n ),\n entry(\n 'BRM154',\n 'Put <title> in #head, as <meta> and <link>, such as #head { <title>{`${count} left`}</title> }',\n 'A `<title>` is outside `#head`.',\n '#head {\\n <title>{`${count} left`}</title>\\n}',\n ),\n entry(\n 'BRM155',\n 'A dynamic tag that changes on the client is not supported yet',\n '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.',\n '<{tag} class=\"title\">Title</>',\n ),\n entry(\n 'BRM156',\n 'Code that the browser updates can await only a memo. Load the promise in a memo instead',\n 'Code that runs again in the browser awaits something other than a memo.',\n 'const user = $memo(await load(id));',\n ),\n entry(\n 'BRM157',\n 'Markup that the browser renders can await only a memo. Load the promise in a memo instead',\n 'Markup that the browser renders awaits something other than a memo.',\n 'const user = $memo(await load(id));',\n ),\n entry(\n 'BRM158',\n 'This attribute cannot change on the client yet',\n 'The name or the value of an attribute with a computed name, as in `[name]=value`, changes in the browser.',\n '<div class=(open ? \"open\" : \"closed\")></div>',\n ),\n entry(\n 'BRM159',\n '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',\n '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.',\n \"let name = $signal('data-x');\\nlet value = $signal('on');\\n\\n<button onClick=(() => ((name = 'data-y'), (value = 'off')))>Change</button>\\n<p {...props} [name]=(value)></p>\\n<p {...props} data-x=\\\"on\\\"></p>\",\n ),\n entry(\n 'BRM160',\n 'Destructuring assignment to a signal is not supported in client code yet',\n 'Code that runs in the browser writes a signal in a destructuring assignment.',\n '[first, second] = pair;\\n// Write each signal on its own:\\nfirst = pair[0];\\nsecond = pair[1];',\n ),\n entry(\n 'BRM161',\n 'Assign to \"{name}\" with = instead of {op}',\n 'An optimistic value is changed with `++` or `--`.',\n 'shown = shown + 1;',\n ),\n entry(\n 'BRM162',\n 'Invalid CSS: {message}',\n 'A `<style>` has CSS that does not parse.',\n '<style>\\n p {\\n color: red;\\n }\\n</style>',\n ),\n entry(\n 'BRM163',\n 'Module functions call each other too deeply. A module function cannot call itself',\n 'A function of a module of reactive logic calls itself, or a loop of functions call each other.',\n 'function counter(start: number) {\\n let count = $signal(start);\\n return { count };\\n}',\n ),\n];\n\n/** Errors about modules of reactive logic, such as `counter.brm.ts`. */\nconst MODULES: ErrorEntry[] = [\n entry(\n 'BRM164',\n 'Destructure what {name} returns, as in const { value } = {name}(…)',\n 'The result of a module function is kept as one object.',\n 'const { count, increment } = counter(0);',\n ),\n entry(\n 'BRM165',\n 'Declare what {name} returns with const',\n 'The result of a module function is declared with `let`.',\n 'const { count, increment } = counter(0);',\n ),\n entry(\n 'BRM166',\n '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',\n 'A module function is called inside a function, a condition or a loop.',\n 'const { count, increment } = counter(0);',\n ),\n entry(\n 'BRM167',\n 'Cannot read {specifier}',\n 'The module that the component imports is not on disk.',\n \"import { counter } from './counter.brm.ts';\",\n ),\n entry(\n 'BRM168',\n '{specifier} does not export a function named {name}',\n 'The import names a function that the module does not export.',\n 'export function counter(start: number) {\\n let count = $signal(start);\\n return { count };\\n}',\n ),\n entry(\n 'BRM169',\n '{name} needs a body that ends with return { … }',\n 'A module function is an arrow function with an expression body.',\n 'export function counter(start: number) {\\n let count = $signal(start);\\n return { count };\\n}',\n ),\n entry(\n 'BRM170',\n '{name} must end with return { … }, an object of what it gives',\n 'A module function does not end with `return { … }`.',\n 'export function counter(start: number) {\\n let count = $signal(start);\\n return { count };\\n}',\n ),\n entry(\n 'BRM171',\n '{name} can return only at its end',\n 'A module function returns in the middle of its body.',\n 'export function counter(start: number) {\\n let count = $signal(start);\\n return { count };\\n}',\n ),\n entry(\n 'BRM172',\n 'Destructure {name} with plain names, as in const { value, other: renamed } = {name}(…)',\n 'The result of a module function is destructured with a default, a nested pattern or a rest.',\n 'const { count, increment: add } = counter(0);',\n ),\n entry(\n 'BRM173',\n '{name} must return an object with plain keys',\n 'The returned object has a computed key, a spread or a method.',\n 'return { count, increment };',\n ),\n entry(\n 'BRM174',\n '{name} cannot return getters or setters. Return the values themselves',\n 'The returned object has a getter or a setter.',\n 'return { count, increment };',\n ),\n entry(\n 'BRM175',\n '{name} does not return {key}',\n 'The component destructures a name that the module function does not return.',\n 'const { count } = counter(0);',\n ),\n entry(\n 'BRM176',\n '{name} returns {local} as {first} and as {key}. Return each local once, and give the other key a function of its own',\n 'A module function returns one local under two keys.',\n 'return { count, increment };',\n ),\n entry(\n 'BRM177',\n '{name} is declared twice',\n 'A name of the module function is also a name of the component.',\n 'const { count: first } = counter(0);\\nconst { count: second } = counter(10);',\n ),\n entry(\n 'BRM178',\n 'Parameters of {name} must be plain names',\n 'A module function has a destructured or default parameter.',\n 'export function counter(start: number) {\\n let count = $signal(start);\\n return { count };\\n}',\n ),\n entry(\n 'BRM179',\n '{name} reads {local}, which {specifier} does not export. Export it, so the component can import it',\n 'A module function reads a value of its module that is not exported.',\n 'export const STEP = 1;',\n ),\n];\n\nexport const ERRORS: readonly ErrorEntry[] = [...SYNTAX, ...SCRIPT, ...OUTPUT, ...MODULES];\n\n/** True when a message that the compiler reported has the form of an entry. */\nexport function matchesError(error: ErrorEntry, message: string): boolean {\n const escaped: string[] = [];\n for (const part of error.message.split(/\\{\\w+\\}/)) {\n escaped.push(part.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'));\n }\n const pattern = escaped.join('[\\\\s\\\\S]*?');\n return new RegExp(`^${pattern}$`).test(message);\n}\n\n/**\n * The entry for a message that the compiler reported. The place of the\n * error, as in `(File.brm:3:7)`, can follow the message.\n */\nexport function findError(message: string): ErrorEntry | undefined {\n const bare = message.replace(/(?:\\s\\([^()]*:\\d+:\\d+\\))+$/, '').replace(/\\s\\[BRM\\d+\\]$/, '');\n // Of the entries that match, the one with the most fixed text is the most specific.\n function fixed(error: ErrorEntry): number {\n return error.message.replace(/\\{\\w+\\}/g, '').length;\n }\n let found: ErrorEntry | undefined;\n for (const error of ERRORS) {\n if (matchesError(error, bare) && (!found || fixed(error) > fixed(found))) {\n found = error;\n }\n }\n return found;\n}\n\n/** The text of references/errors.md. */\nexport function renderErrors(): string {\n const lines = [\n '# Errors',\n '',\n '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.',\n '',\n 'It is generated from `src/error-catalog.ts`. Do not edit it by hand.',\n ];\n for (const error of ERRORS) {\n lines.push('', `## ${error.code ? `${error.code}: ` : ''}${error.message}`, '', error.cause);\n if (error.link) {\n lines.push('', error.link);\n }\n lines.push('', '```brm fragment', error.fix, '```');\n }\n return `${lines.join('\\n')}\\n`;\n}\n\n/** The text of website/docs/errors.md: one section for each code. */\nexport function renderErrorsPage(): string {\n const lines = [\n '# Compile errors',\n '',\n 'Each compile error of brumate has a code. The code is part of the message, and `brumate check` prints it with a link to its section here. A `{name}` in a message is a part that varies.',\n '',\n 'This page is generated from `packages/brumate/src/error-catalog.ts`. Do not edit it by hand.',\n ];\n for (const error of ERRORS) {\n lines.push('', `## ${error.code}`, '', `\\`${error.message}\\``, '', error.cause);\n lines.push('', `\\`\\`\\`${fenceLanguage(error.fix)}`, error.fix, '```');\n }\n return `${lines.join('\\n')}\\n`;\n}\n\n/**\n * The language of the code block of a fix on the site: `brm` when it has markup, and `ts` when it\n * is only script code, which the `.brm` highlighter would color as text.\n */\nfunction fenceLanguage(fix: string): 'brm' | 'ts' {\n return /^\\s*(?:<[A-Za-z/!]|#[a-z]+\\b|\\{)/m.test(fix) ? 'brm' : 'ts';\n}\n"],"mappings":";;;;;;;;;;;AAyBA,MAAa,YAAY;;AAGzB,MAAa,cAAsB,GAAG,UAAU;;AAGhD,SAAgB,UAAU,MAAsB;CAC9C,OAAO,GAAG,YAAY,GAAG,KAAK,YAAY;AAC5C;AAEA,SAAS,MAAM,MAAc,SAAiB,OAAe,KAAyB;CACpF,OAAO;EAAE;EAAS;EAAO;EAAK;EAAM,MAAM,UAAU,IAAI;CAAE;AAC5D;;AAGA,MAAM,SAAuB;CAC3B,MACE,UACA,wBACA,oCACA,kFACF;CACA,MACE,UACA,uBACA,2CACA,qBACF;CACA,MACE,UACA,iCACA,4CACA,gCACF;CACA,MACE,UACA,mCACA,+CACA,wBACF;CACA,MACE,UACA,yBACA,2CACA,sBACF;CACA,MACE,UACA,uBACA,gFACA,sBACF;CACA,MACE,UACA,qCACA,gEACA,gCACF;CACA,MACE,UACA,kDACA,+BACA,8BACF;CACA,MAAM,UAAU,0BAA0B,qCAAqC,aAAa;CAC5F,MACE,UACA,gEACA,wEACA,sGACF;CACA,MACE,UACA,8DACA,qCACA,6DACF;CACA,MACE,UACA,iEACA,yEACA,yDACF;CACA,MACE,UACA,mCACA,oFACA,4DACF;CACA,MAAM,UAAU,uBAAuB,oCAAoC,iBAAiB;CAC5F,MACE,UACA,iCACA,0EACA,gCACF;CACA,MAAM,UAAU,sBAAsB,kCAAkC,aAAa;CACrF,MACE,UACA,0CACA,kDACA,oBACF;CACA,MACE,UACA,0CACA,oCACA,+BACF;CACA,MACE,UACA,wCACA,qEACA,kCACF;CACA,MACE,UACA,8CACA,kEACA,8BACF;CACA,MACE,UACA,8BACA,0DACA,kBACF;CACA,MACE,UACA,mEACA,6MACA,qFACF;CACA,MACE,UACA,sDACA,6FACA,kDACF;CACA,MACE,UACA,yCACA,kXACA,sEACF;CACA,MACE,UACA,sJACA,uKACA,wHACF;CACA,MACE,UACA,0IACA,oKACA,2IACF;CACA,MACE,UACA,mEACA,2EACA,wFACF;CACA,MACE,UACA,sHACA,kHACA,qDACF;CACA,MACE,UACA,+JACA,6TACA,mEACF;CACA,MACE,UACA,8LACA,+VACA,qNACF;CACA,MACE,UACA,6HACA,0TACA,+GACF;CACA,MACE,UACA,6BACA,+CACA,8CACF;CACA,MACE,UACA,wDACA,uDACA,8CACF;CACA,MACE,UACA,kDACA,0CACA,kCACF;CACA,MACE,UACA,0CACA,gDACA,0BACF;CACA,MACE,UACA,kEACA,8CACA,8BACF;CACA,MACE,UACA,+DACA,wCACA,wEACF;CACA,MACE,UACA,+BACA,8CACA,oBACF;CACA,MACE,UACA,4CACA,uEACA,2CACF;CACA,MACE,UACA,kCACA,yCACA,oBACF;CACA,MACE,UACA,2BACA,uEACA,mCACF;CACA,MACE,UACA,oBACA,4CACA,oCACF;CACA,MACE,UACA,yCACA,qEACA,uDACF;CACA,MACE,UACA,uCACA,kCACA,gFACF;CACA,MACE,UACA,gCACA,oCACA,oEACF;CACA,MACE,UACA,8CACA,uCACA,gFACF;CACA,MACE,UACA,wCACA,gEACA,uDACF;CACA,MACE,UACA,mCACA,sFACA,oGACF;CACA,MACE,UACA,+CACA,8CACA,gEACF;CACA,MACE,UACA,wIACA,kDACA,6CACF;CACA,MACE,UACA,4GACA,4CACA,6CACF;CACA,MACE,UACA,oCACA,8CACA,uEACF;CACA,MACE,UACA,mCACA,wDACA,gCACF;CACA,MACE,UACA,2CACA,yCACA,gCACF;CACA,MACE,UACA,mCACA,iDACA,gCACF;CACA,MACE,UACA,gCACA,kCACA,0DACF;CACA,MACE,UACA,6CACA,yEACA,sGACF;CACA,MACE,UACA,6BACA,8CACA,0EACF;CACA,MACE,UACA,4CACA,gGACA,sDACF;CACA,MACE,UACA,uEACA,4CACA,gDACF;CACA,MACE,UACA,4BACA,6CACA,gCACF;CACA,MACE,UACA,6CACA,oDACA,2CACF;CACA,MACE,UACA,mEACA,qCACA,qEACF;CACA,MACE,UACA,oDACA,iDACA,8EACF;CACA,MACE,UACA,kDACA,kDACA,+FACF;CACA,MACE,UACA,+CACA,yCACA,+FACF;CACA,MACE,UACA,iDACA,wCACA,yDACF;CACA,MACE,UACA,0BACA,+DACA,oBACF;CACA,MACE,UACA,8BACA,gEACA,6DACF;CACA,MACE,UACA,uBACA,6DACA,yDACF;AACF;;AAGA,MAAM,SAAuB;CAC3B,MACE,UACA,kCACA,qDACA,kDACF;CACA,MACE,UACA,0BACA,iHACA,wCACF;CACA,MACE,UACA,kEACA,+FACA,kDACF;CACA,MACE,UACA,gKACA,iEACA,iEACF;CACA,MACE,UACA,yDACA,+CACA,8CACF;CACA,MACE,UACA,4CACA,kDACA,mFACF;CACA,MACE,UACA,kDACA,2CACA,uDACF;CACA,MACE,UACA,sDACA,wCACA,uDACF;CACA,MACE,UACA,wCACA,8CACA,kBACF;CACA,MACE,UACA,sCACA,oEACA,qCACF;CACA,MACE,UACA,uDACA,mDACA,8CACF;CACA,MACE,UACA,uCACA,mEACA,8CACF;CACA,MACE,UACA,+BACA,+BACA,8CACF;CACA,MACE,UACA,kDACA,+CACA,8CACF;CACA,MACE,UACA,4CACA,0CACA,sBACF;CACA,MAAM,UAAU,0BAA0B,0BAA0B,sBAAsB;CAC1F,MACE,UACA,oFACA,+DACA,2FACF;CACA,MACE,UACA,kCACA,kCACA,mCACF;CACA,MACE,UACA,4DACA,wCACA,sCACF;CACA,MACE,UACA,6DACA,gDACA,0CACF;CACA,MACE,UACA,+EACA,mDACA,iGACF;CACA,MACE,UACA,8DACA,uDACA,mCACF;CACA,MACE,UACA,8EACA,4CACA,+BACF;CACA,MACE,UACA,qEACA,gDACA,+BACF;CACA,MACE,UACA,uEACA,iFACA,0FACF;CACA,MACE,UACA,6BACA,wDACA,sCACF;CACA,MACE,UACA,iCACA,4FACA,yBACF;CACA,MACE,UACA,mDACA,8DACA,sCACF;CACA,MACE,UACA,oEACA,qEACA,sCACF;CACA,MACE,UACA,kCACA,sEACA,2DACF;CACA,MACE,UACA,6BACA,mEACA,yBACF;CACA,MACE,UACA,wBACA,6CACA,kCACF;CACA,MACE,UACA,yDACA,gDACA,iCACF;CACA,MACE,UACA,kCACA,iDACA,iDACF;CACA,MACE,UACA,2BACA,2DACA,iDACF;CACA,MACE,UACA,8CACA,0DACA,iDACF;CACA,MACE,UACA,0CACA,sDACA,mEACF;CACA,MACE,UACA,8BACA,yCACA,iDACF;CACA,MACE,UACA,oEACA,uDACA,4CACF;CACA,MACE,UACA,mJACA,uDACA,8CACF;CACA,MACE,UACA,wJACA,wEACA,qCACF;CACA,MACE,UACA,8CACA,qCACA,2CACF;CACA,MACE,UACA,2HACA,4CACA,oDACF;CACA,MACE,UACA,sGACA,mFACA,oDACF;CACA,MACE,UACA,sHACA,iEACA,4BACF;CACA,MACE,UACA,gIACA,+DACA,2BACF;CACA,MACE,UACA,uGACA,iEACA,uDACF;CACA,MACE,UACA,0FACA,mDACA,6FACF;CACA,MACE,UACA,kDACA,yFACA,4FACF;CACA,MACE,UACA,iDACA,qDACA,wDACF;CACA,MACE,UACA,2DACA,wDACA,wDACF;CACA,MACE,UACA,gFACA,kCACA,wBACF;CACA,MACE,UACA,8BACA,kEACA,oEACF;CACA,MACE,UACA,qGACA,2EACA,oEACF;CACA,MACE,UACA,kGACA,mEACA,gEACF;CACA,MACE,UACA,qGACA,ycACA,qFACF;CACA,MACE,UACA,8GACA,+FACA,0CACF;CACA,MACE,UACA,sCACA,yEACA,qCACF;CACA,MACE,UACA,qGACA,0DACA,yBACF;CACA,MACE,UACA,8EACA,8DACA,yDACF;CACA,MACE,UACA,iEACA,4CACA,iCACF;CACA,MACE,UACA,yDACA,yEACA,6CACF;CACA,MACE,UACA,8BACA,4DACA,yBACF;CACA,MACE,UACA,iDACA,0DACA,mCACF;CACA,MACE,UACA,4CACA,qDACA,kBACF;CACA,MACE,UACA,yEACA,kDACA,sBACF;CACA,MACE,UACA,+FACA,wDACA,kCACF;CACA,MACE,UACA,0FACA,0DACA,0CACF;CACA,MACE,UACA,8EACA,qDACA,yBACF;CACA,MACE,UACA,wFACA,0DACA,mCACF;CACA,MACE,UACA,iEACA,oEACA,8CACF;CACA,MACE,UACA,oFACA,sDACA,yBACF;CACA,MACE,UACA,kFACA,oDACA,kCACF;CACA,MACE,UACA,uFACA,qIACA,4DACF;CACA,MACE,UACA,mFACA,mRACA,4DACF;CACA,MACE,UACA,kHACA,oDACA,4DACF;CACA,MACE,UACA,sGACA,yDACA,sCACF;CACA,MACE,UACA,sGACA,yDACA,4CACF;CACA,MACE,UACA,oGACA,0DACA,iCACF;CACA,MACE,UACA,2GACA,sDACA,+BACF;CACA,MACE,UACA,6CACA,sDACA,iDACF;CACA,MACE,UACA,6CACA,sDACA,4CACF;CACA,MACE,UACA,6DACA,uBACA,oEACF;CACA,MACE,UACA,wCACA,yBACA,sCACF;CACA,MACE,UACA,0CACA,2BACA,oCACF;CACA,MACE,UACA,gFACA,2BACA,sGACF;CACA,MACE,UACA,mHACA,uFACA,gEACF;CACA,MACE,UACA,sCACA,+CACA,uEACF;CACA,MACE,UACA,sFACA,4IACA,uDACF;CACA,MACE,UACA,sDACA,mCACA,+BACF;CACA,MACE,UACA,sJACA,ySACA,oEACF;CACA,MACE,UACA,8MACA,yUACA,sGACF;CACA,MACE,UACA,8FACA,qNACA,gEACF;CACA,MACE,UACA,4KACA,4PACA,sHACF;CACA,MACE,UACA,wIACA,kOACA,2JACF;CACA,MACE,UACA,wDACA,uDACA,uFACF;CACA,MACE,UACA,wDACA,uDACA,uFACF;CACA,MACE,UACA,qEACA,yEACA,4CACF;CACA,MACE,UACA,iCACA,mEACA,4CACF;AACF;;AAGA,MAAM,SAAuB;CAC3B,MACE,UACA,wMACA,2GACA,iEACF;CACA,MACE,UACA,0FACA,8EACA,mEACF;CACA,MACE,UACA,kIACA,yFACA,mEACF;CACA,MACE,UACA,0CACA,0DACA,6BACF;CACA,MACE,UACA,uDACA,8FACA,6BACF;CACA,MACE,UACA,wGACA,oGACA,yCACF;CACA,MACE,UACA,kGACA,mCACA,gDACF;CACA,MACE,UACA,iEACA,sLACA,iCACF;CACA,MACE,UACA,2FACA,2EACA,qCACF;CACA,MACE,UACA,6FACA,uEACA,qCACF;CACA,MACE,UACA,kDACA,6GACA,kDACF;CACA,MACE,UACA,wIACA,gXACA,gNACF;CACA,MACE,UACA,4EACA,gFACA,gGACF;CACA,MACE,UACA,+CACA,qDACA,oBACF;CACA,MACE,UACA,0BACA,4CACA,gDACF;CACA,MACE,UACA,qFACA,kGACA,0FACF;AACF;;AAGA,MAAM,UAAwB;CAC5B,MACE,UACA,sEACA,0DACA,0CACF;CACA,MACE,UACA,0CACA,2DACA,0CACF;CACA,MACE,UACA,kLACA,yEACA,0CACF;CACA,MACE,UACA,2BACA,yDACA,6CACF;CACA,MACE,UACA,uDACA,gEACA,iGACF;CACA,MACE,UACA,mDACA,mEACA,iGACF;CACA,MACE,UACA,iEACA,uDACA,iGACF;CACA,MACE,UACA,qCACA,wDACA,iGACF;CACA,MACE,UACA,0FACA,+FACA,+CACF;CACA,MACE,UACA,gDACA,iEACA,8BACF;CACA,MACE,UACA,yEACA,iDACA,8BACF;CACA,MACE,UACA,gCACA,+EACA,+BACF;CACA,MACE,UACA,wHACA,uDACA,8BACF;CACA,MACE,UACA,4BACA,kEACA,8EACF;CACA,MACE,UACA,4CACA,8DACA,iGACF;CACA,MACE,UACA,sGACA,uEACA,wBACF;AACF;AAEA,MAAa,SAAgC;CAAC,GAAG;CAAQ,GAAG;CAAQ,GAAG;CAAQ,GAAG;AAAO;;AAGzF,SAAgB,aAAa,OAAmB,SAA0B;CACxE,MAAM,UAAoB,CAAC;CAC3B,KAAK,MAAM,QAAQ,MAAM,QAAQ,MAAM,SAAS,GAC9C,QAAQ,KAAK,KAAK,QAAQ,uBAAuB,MAAM,CAAC;CAE1D,MAAM,UAAU,QAAQ,KAAK,YAAY;CACzC,OAAO,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC,CAAC,KAAK,OAAO;AAChD;;;;;AAMA,SAAgB,UAAU,SAAyC;CACjE,MAAM,OAAO,QAAQ,QAAQ,8BAA8B,EAAE,CAAC,CAAC,QAAQ,iBAAiB,EAAE;CAE1F,SAAS,MAAM,OAA2B;EACxC,OAAO,MAAM,QAAQ,QAAQ,YAAY,EAAE,CAAC,CAAC;CAC/C;CACA,IAAI;CACJ,KAAK,MAAM,SAAS,QAClB,IAAI,aAAa,OAAO,IAAI,MAAM,CAAC,SAAS,MAAM,KAAK,IAAI,MAAM,KAAK,IACpE,QAAQ;CAGZ,OAAO;AACT;;AAGA,SAAgB,eAAuB;CACrC,MAAM,QAAQ;EACZ;EACA;EACA;EACA;EACA;CACF;CACA,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,KAAK,IAAI,MAAM,MAAM,OAAO,GAAG,MAAM,KAAK,MAAM,KAAK,MAAM,WAAW,IAAI,MAAM,KAAK;EAC3F,IAAI,MAAM,MACR,MAAM,KAAK,IAAI,MAAM,IAAI;EAE3B,MAAM,KAAK,IAAI,mBAAmB,MAAM,KAAK,KAAK;CACpD;CACA,OAAO,GAAG,MAAM,KAAK,IAAI,EAAE;AAC7B;;AAGA,SAAgB,mBAA2B;CACzC,MAAM,QAAQ;EACZ;EACA;EACA;EACA;EACA;CACF;CACA,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,KAAK,IAAI,MAAM,MAAM,QAAQ,IAAI,KAAK,MAAM,QAAQ,KAAK,IAAI,MAAM,KAAK;EAC9E,MAAM,KAAK,IAAI,SAAS,cAAc,MAAM,GAAG,KAAK,MAAM,KAAK,KAAK;CACtE;CACA,OAAO,GAAG,MAAM,KAAK,IAAI,EAAE;AAC7B;;;;;AAMA,SAAS,cAAc,KAA2B;CAChD,OAAO,oCAAoC,KAAK,GAAG,IAAI,QAAQ;AACjE"}
@@ -0,0 +1 @@
1
+ export { t as DOCS_SITE, n as ERRORS, r as ERRORS_PAGE, i as errorLink, a as findError, o as matchesError, s as renderErrors, c as renderErrorsPage } from "./error-catalog-DakxjSgj.js";
@@ -1,4 +1,4 @@
1
- import { K as hasBridge, _ as functionId, q as mayHaveBridge } from "./inspect-BSHv1_25.js";
1
+ import { K as hasBridge, g as functionId, q as mayHaveBridge } from "./inspect-B5AoHh5O.js";
2
2
  import { parseSync } from "oxc-parser";
3
3
  import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
4
4
  import { readFile, readdir, stat } from "node:fs/promises";
@@ -594,4 +594,4 @@ async function collectSources(root, paths) {
594
594
  //#endregion
595
595
  export { findPackages as _, findScripts as a, resolveComponentPackage as b, findServerImport as c, isScriptFile as d, serverExports as f, findPackage as g, findBridgePackages as h, findFiles as i, hasServerMiddleware as l, serverStubs as m, defaultExclude as n, findServerFiles as o, serverModule as p, findBridgeFiles as r, findPackageServerFile as s, collectSources as t, hasUseServer as u, packageFileName as v, reachableFiles as y };
596
596
 
597
- //# sourceMappingURL=files-BuQvpBwF.js.map
597
+ //# sourceMappingURL=files-DXS8RAtZ.js.map