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.
- package/dist/{boot-CMy0f_iC.d.ts → boot-DQuAhAd5.d.ts} +2 -2
- package/dist/cli.js +3 -2
- package/dist/cli.js.map +1 -1
- package/dist/{client-DnFF9_lv.d.ts → client-4eabQtYJ.d.ts} +38 -12
- package/dist/{client-COm1iA6w.js → client-CwVcmymi.js} +145 -28
- package/dist/client-CwVcmymi.js.map +1 -0
- package/dist/{defer-Cesb-k2Q.js → defer-BaXWydb0.js} +2 -2
- package/dist/{defer-Cesb-k2Q.js.map → defer-BaXWydb0.js.map} +1 -1
- package/dist/{devtools-C9IEkgc1.js → devtools-CMuj12yR.js} +257 -118
- package/dist/devtools-CMuj12yR.js.map +1 -0
- package/dist/devtools-calls-DGW6nLZ2.js +249 -0
- package/dist/devtools-calls-DGW6nLZ2.js.map +1 -0
- package/dist/devtools-panel-Cq8LpsyW.js +3978 -0
- package/dist/devtools-panel-Cq8LpsyW.js.map +1 -0
- package/dist/error-catalog-DakxjSgj.js +308 -0
- package/dist/error-catalog-DakxjSgj.js.map +1 -0
- package/dist/error-catalog-VxLbz-6p.js +1 -0
- package/dist/{files-BuQvpBwF.js → files-DXS8RAtZ.js} +2 -2
- package/dist/{files-BuQvpBwF.js.map → files-DXS8RAtZ.js.map} +1 -1
- package/dist/index.d.ts +73 -18
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/{inspect-BSHv1_25.js → inspect-B5AoHh5O.js} +639 -412
- package/dist/inspect-B5AoHh5O.js.map +1 -0
- package/dist/{loader-CLKrJMqw.js → loader-CTeT6ie9.js} +4 -4
- package/dist/{loader-CLKrJMqw.js.map → loader-CTeT6ie9.js.map} +1 -1
- package/dist/{navigate-OHb0Uw1P.js → navigate-Bj73X4ZS.js} +22 -8
- package/dist/navigate-Bj73X4ZS.js.map +1 -0
- package/dist/{rpc-BAKbRWOT.js → rpc-kVB0Ujdx.js} +5 -4
- package/dist/rpc-kVB0Ujdx.js.map +1 -0
- package/dist/runtime/bundles.d.ts +3 -2
- package/dist/runtime/bundles.js +14 -3
- package/dist/runtime/bundles.js.map +1 -1
- package/dist/runtime/client.d.ts +2 -2
- package/dist/runtime/client.js +4 -3
- package/dist/runtime/devtools.d.ts +59 -1
- package/dist/runtime/devtools.js +1 -1
- package/dist/runtime/hot.d.ts +1 -1
- package/dist/runtime/hot.js +6 -2
- package/dist/runtime/hot.js.map +1 -1
- package/dist/runtime/loader.d.ts +2 -2
- package/dist/runtime/loader.js +2 -2
- package/dist/runtime/server.d.ts +1 -1
- package/dist/runtime/server.js +3 -2
- package/dist/runtime/signals.d.ts +1 -1
- package/dist/runtime/static-loader.d.ts +2 -2
- package/dist/runtime/static-loader.js +1 -1
- package/dist/runtime/store.d.ts +2 -2
- package/dist/runtime/store.js +1 -1
- package/dist/runtime/testing.d.ts +2 -2
- package/dist/runtime/testing.js +2 -2
- package/dist/search-params-Wg-0FsMj.js +148 -0
- package/dist/search-params-Wg-0FsMj.js.map +1 -0
- package/dist/{stream-RXLadXx1.js → serial-ioa17MuY.js} +67 -168
- package/dist/serial-ioa17MuY.js.map +1 -0
- package/dist/serial-ribg9NAj.js +1 -0
- package/dist/{server-BVObWh-w.js → server-BUuf7XPZ.js} +61 -16
- package/dist/server-BUuf7XPZ.js.map +1 -0
- package/dist/{server-0rS5vUW1.d.ts → server-DesBZv5g.d.ts} +8 -3
- package/dist/{search-params-C64liRBj.js → shared-CX_YacDm.js} +3 -148
- package/dist/shared-CX_YacDm.js.map +1 -0
- package/dist/{signals-DBnq9QRW.d.ts → signals-7VVD9C_H.d.ts} +2 -2
- package/dist/{static-loader-CxANokZ4.js → static-loader-BM0-wdIc.js} +2 -2
- package/dist/{static-loader-CxANokZ4.js.map → static-loader-BM0-wdIc.js.map} +1 -1
- package/dist/{static-loader-BYbXVJDY.d.ts → static-loader-BSAyFqG0.d.ts} +2 -2
- package/dist/{store-xlTzAM_r.d.ts → store-9_oa0HG1.d.ts} +15 -2
- package/dist/{store-BIBAYZo-.js → store-Cy4EEyZ7.js} +148 -2
- package/dist/store-Cy4EEyZ7.js.map +1 -0
- package/dist/stream-read-BTsYstJY.js +22 -0
- package/dist/stream-read-BTsYstJY.js.map +1 -0
- package/dist/stream-read-Dek3HnqO.js +1 -0
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +37 -5
- package/dist/vite.js.map +1 -1
- package/package.json +7 -4
- package/skills/brumate/SKILL.md +6 -2
- package/skills/brumate/references/errors.md +21 -2
- package/skills/brumate/references/state.md +31 -0
- package/skills/brumate/references/syntax.md +45 -1
- package/dist/client-COm1iA6w.js.map +0 -1
- package/dist/devtools-C9IEkgc1.js.map +0 -1
- package/dist/devtools-panel-Doit__YG.js +0 -2018
- package/dist/devtools-panel-Doit__YG.js.map +0 -1
- package/dist/inspect-BSHv1_25.js.map +0 -1
- package/dist/navigate-OHb0Uw1P.js.map +0 -1
- package/dist/rpc-BAKbRWOT.js.map +0 -1
- package/dist/search-params-C64liRBj.js.map +0 -1
- package/dist/server-BVObWh-w.js.map +0 -1
- package/dist/store-BIBAYZo-.js.map +0 -1
- package/dist/stream-RXLadXx1.js.map +0 -1
|
@@ -1,263 +1,10 @@
|
|
|
1
|
+
import { a as findError } from "./error-catalog-DakxjSgj.js";
|
|
1
2
|
import { i as paragraphComponents, t as checkNesting } from "./nesting-DA5vJw9X.js";
|
|
2
3
|
import { t as KEY_NAMES } from "./events-LgLdp1R7.js";
|
|
3
4
|
import { p as insertValue } from "./html-Cf5uKhLs.js";
|
|
4
5
|
import { parseSync } from "oxc-parser";
|
|
5
6
|
import { parse } from "postcss";
|
|
6
7
|
import selectorParser from "postcss-selector-parser";
|
|
7
|
-
/** The page of the docs that explains every code, with one anchor for each. */
|
|
8
|
-
const ERRORS_PAGE = `https://brumate-docs.vercel.app/docs/errors`;
|
|
9
|
-
/** The link to the explanation of a code. */
|
|
10
|
-
function errorLink(code) {
|
|
11
|
-
return `${ERRORS_PAGE}#${code.toLowerCase()}`;
|
|
12
|
-
}
|
|
13
|
-
function entry(code, message, cause, fix) {
|
|
14
|
-
return {
|
|
15
|
-
message,
|
|
16
|
-
cause,
|
|
17
|
-
fix,
|
|
18
|
-
code,
|
|
19
|
-
link: errorLink(code)
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
/** Syntax errors of the parser, in the order of a file. */
|
|
23
|
-
const SYNTAX = [
|
|
24
|
-
entry("BRM001", "Unterminated comment", "A comment starts and never ends.", "<!-- A comment ends with -->\n<script>\n /* and so does this one */\n<\/script>"),
|
|
25
|
-
entry("BRM002", "Unterminated string", "A string in code starts and never ends.", "const name = 'Ada';"),
|
|
26
|
-
entry("BRM003", "Unterminated template literal", "A template string starts and never ends.", "const label = `Hello ${name}`;"),
|
|
27
|
-
entry("BRM004", "Unterminated regular expression", "A regular expression starts and never ends.", "const digits = /\\d+/;"),
|
|
28
|
-
entry("BRM005", "Unexpected \"{char}\"", "Code has a bracket that closes nothing.", "const list = [1, 2];"),
|
|
29
|
-
entry("BRM006", "Expected \"{char}\"", "Code opens a bracket and never closes it. The message names the closing one.", "const list = [1, 2];"),
|
|
30
|
-
entry("BRM007", "Expected \"}\" to close the block", "A `#` block opens with `{` and the file ends before its `}`.", "#if (open) {\n <p>Open</p>\n}"),
|
|
31
|
-
entry("BRM008", "Unexpected end of file, expected a closing tag", "An element is never closed.", "<div>\n <p>Text</p>\n</div>"),
|
|
32
|
-
entry("BRM009", "Unexpected closing tag", "A closing tag has no opening tag.", "<p>Text</p>"),
|
|
33
|
-
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}"),
|
|
34
|
-
entry("BRM011", "<style> must be at the top level", "A `<style>` is inside an element or a block.", "<style>\n p {\n color: red;\n }\n</style>\n<p>Text</p>"),
|
|
35
|
-
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}"),
|
|
36
|
-
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}"),
|
|
37
|
-
entry("BRM014", "Expected a tag name", "A `<` starts a tag with no name.", "<p>1 < 2</p>"),
|
|
38
|
-
entry("BRM015", "<{name}> must end with \"/>\"", "`<window>` and `<document>` take no children, so they close with `/>`.", "<window onKeyDown=(handler) />"),
|
|
39
|
-
entry("BRM016", "Expected </{name}>", "A closing tag is not complete.", "<p>Text</p>"),
|
|
40
|
-
entry("BRM017", "Unexpected end of file, expected \">\"", "A tag starts and the file ends before its `>`.", "<input value=name>"),
|
|
41
|
-
entry("BRM018", "Expected whitespace between attributes", "Two attributes touch each other.", "<input id=name type=\"text\">"),
|
|
42
|
-
entry("BRM019", "Only event handlers are allowed here", "`<window>` and `<document>` take event handlers and nothing else.", "<document onKeyDown=(handler) />"),
|
|
43
|
-
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>"),
|
|
44
|
-
entry("BRM021", "Expected an attribute name", "A tag has a character where an attribute name belongs.", "<input disabled>"),
|
|
45
|
-
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>"),
|
|
46
|
-
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) />"),
|
|
47
|
-
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>"),
|
|
48
|
-
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}"),
|
|
49
|
-
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>"),
|
|
50
|
-
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}"),
|
|
51
|
-
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}"),
|
|
52
|
-
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>"),
|
|
53
|
-
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>"),
|
|
54
|
-
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}"),
|
|
55
|
-
entry("BRM024", "Expected an event handler", "An event attribute has no `=` and no value.", "<button onClick=(() => count++)>Add</button>"),
|
|
56
|
-
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>"),
|
|
57
|
-
entry("BRM026", "An attribute name can have one \":\" namespace", "An attribute name has two or more `:`.", "<svg xlink:href=\"#icon\"></svg>"),
|
|
58
|
-
entry("BRM027", "ref takes $bind, as in ref=$bind(name)", "`ref` has a value that is not `$bind(name)`.", "<input ref=$bind(input)>"),
|
|
59
|
-
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>"),
|
|
60
|
-
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}"),
|
|
61
|
-
entry("BRM030", "Expected an attribute value", "An attribute has `=` and nothing after it.", "<input value=name>"),
|
|
62
|
-
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>"),
|
|
63
|
-
entry("BRM032", "Expected \">\" to end <{name}>", "A tag has text where its `>` belongs.", "<input value=name>"),
|
|
64
|
-
entry("BRM033", "Expected a quoted value", "A `<script>` or `<style>` attribute has `=` without a quoted value.", "<script generics=\"T\"><\/script>"),
|
|
65
|
-
entry("BRM034", "Expected {close}", "A `<script>` or `<style>` is not closed.", "<script>\n let a = 1;\n<\/script>"),
|
|
66
|
-
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>"),
|
|
67
|
-
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>"),
|
|
68
|
-
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>"),
|
|
69
|
-
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>"),
|
|
70
|
-
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>"),
|
|
71
|
-
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>"),
|
|
72
|
-
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}"),
|
|
73
|
-
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}"),
|
|
74
|
-
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}"),
|
|
75
|
-
entry("BRM042", "Expected \"(\" after #{keyword}", "A block that takes a condition or a list has no `(`.", "#if (open) {\n <p>Open</p>\n}"),
|
|
76
|
-
entry("BRM043", "Expected an expression after #{keyword}", "The parentheses of a block are empty.", "#if (open) {\n <p>Open</p>\n}"),
|
|
77
|
-
entry("BRM044", "Expected \"{\" after #{keyword}", "The header of a block is not followed by `{`.", "#if (open) {\n <p>Open</p>\n}"),
|
|
78
|
-
entry("BRM045", "Expected \"{\" after #switch", "`#switch` has no `{` after it.", "#switch {\n #case (tab === 1) {\n <p>One</p>\n }\n}"),
|
|
79
|
-
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}"),
|
|
80
|
-
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}"),
|
|
81
|
-
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}"),
|
|
82
|
-
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}"),
|
|
83
|
-
entry("BRM050", "Unknown block #{keyword}", "A `#` starts a block that does not exist.", "#if (open) {\n <p>Open</p>\n}"),
|
|
84
|
-
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}"),
|
|
85
|
-
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}"),
|
|
86
|
-
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}"),
|
|
87
|
-
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}"),
|
|
88
|
-
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}"),
|
|
89
|
-
entry("BRM056", "Expected \"(\" after the name of the template", "A `#template` has no parameter list.", "#template price(amount: number) {\n <b>{amount}</b>\n}"),
|
|
90
|
-
entry("BRM057", "Expected an expression", "An attribute or a block has code that is not an expression.", "<p>{count + 1}</p>"),
|
|
91
|
-
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}"),
|
|
92
|
-
entry("BRM059", "Expected parameters", "The parameters of a `#template` are not a parameter list.", "#template price(amount: number) {\n <b>{amount}</b>\n}")
|
|
93
|
-
];
|
|
94
|
-
/** Errors about `$signal`, `$memo` and the other compile-time functions. */
|
|
95
|
-
const SCRIPT = [
|
|
96
|
-
entry("BRM060", "\"{name}\" is already declared", "Two declarations of one scope have the same name.", "let count = $signal(0);\nlet total = $signal(0);"),
|
|
97
|
-
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>"),
|
|
98
|
-
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>"),
|
|
99
|
-
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>"),
|
|
100
|
-
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'))>"),
|
|
101
|
-
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}"),
|
|
102
|
-
entry("BRM066", "The module script cannot have a default export", "`<script module>` has `export default`.", "<script module>\n export const MAX = 10;\n<\/script>"),
|
|
103
|
-
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>"),
|
|
104
|
-
entry("BRM068", "$title takes one argument, the title", "`$title` has no argument or more than one.", "$title('Todos');"),
|
|
105
|
-
entry("BRM069", "await works with $memo, not {name}", "A declaration awaits a compile-time function other than `$memo`.", "const user = $memo(await load(id));"),
|
|
106
|
-
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 }>();"),
|
|
107
|
-
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 }>();"),
|
|
108
|
-
entry("BRM072", "$props() takes no arguments", "`$props()` has an argument.", "const { name } = $props<{ name: string }>();"),
|
|
109
|
-
entry("BRM073", "Assign $props() to a name or an object pattern", "`$props()` is assigned to an array pattern.", "const { name } = $props<{ name: string }>();"),
|
|
110
|
-
entry("BRM074", "Create an ID with \"const name = $id()\"", "`$id()` is not the value of a `const`.", "const field = $id();"),
|
|
111
|
-
entry("BRM075", "$id takes no arguments", "`$id` has an argument.", "const field = $id();"),
|
|
112
|
-
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);"),
|
|
113
|
-
entry("BRM077", "$navigation takes no arguments", "`$navigation` has an argument.", "const navigation = $navigation();"),
|
|
114
|
-
entry("BRM078", "$route takes at most one argument, the path of the route", "`$route` has more than one argument.", "const route = $route('/posts/[id]');"),
|
|
115
|
-
entry("BRM079", "Read a context with \"const name = $getContext(Context)\"", "`$getContext` is not the value of a `const`.", "const theme = $getContext(ThemeContext);"),
|
|
116
|
-
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);"),
|
|
117
|
-
entry("BRM081", "$setContext takes two arguments, the context and the value", "`$setContext` has fewer or more than two arguments.", "$setContext(ThemeContext, theme);"),
|
|
118
|
-
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);"),
|
|
119
|
-
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);"),
|
|
120
|
-
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);"),
|
|
121
|
-
entry("BRM085", "Declare {name} with const", "`$debounced` or `$throttled` is declared with `let`.", "const query = $debounced(text, 300);"),
|
|
122
|
-
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);"),
|
|
123
|
-
entry("BRM087", "{name} takes a value and a wait in milliseconds", "`$debounced` or `$throttled` does not have both arguments.", "const query = $debounced(text, 300);"),
|
|
124
|
-
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);"),
|
|
125
|
-
entry("BRM089", "Declare {name} with {expected}", "`$signal` and `$optimistic` need `let`, and `$memo` needs `const`.", "let count = $signal(0);\nconst double = $memo(count * 2);"),
|
|
126
|
-
entry("BRM090", "{name} takes one argument", "`$signal`, `$memo` or `$optimistic` has more than one argument.", "let count = $signal(0);"),
|
|
127
|
-
entry("BRM091", "{name} needs a value", "`$memo` or `$optimistic` has no argument.", "const double = $memo(count * 2);"),
|
|
128
|
-
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);"),
|
|
129
|
-
entry("BRM093", "{name} does not return a value", "`$effect` or `$client` is assigned to a name.", "$effect(() => {\n document.title = title;\n});"),
|
|
130
|
-
entry("BRM094", "{name} needs a function", "`$effect` or `$client` has no function as its callback.", "$effect(() => {\n document.title = title;\n});"),
|
|
131
|
-
entry("BRM095", "The callback of {name} takes no parameters", "The callback of `$effect` or `$client` has parameters.", "$effect(() => {\n document.title = title;\n});"),
|
|
132
|
-
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});"),
|
|
133
|
-
entry("BRM097", "$effect takes one argument", "`$effect` has more than one argument.", "$effect(() => {\n document.title = title;\n});"),
|
|
134
|
-
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');"),
|
|
135
|
-
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),"),
|
|
136
|
-
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),"),
|
|
137
|
-
entry("BRM101", "The arguments of $handler cannot be spread", "`$handler` has a spread argument.", "onClick: $handler(removeAt, index, kind),"),
|
|
138
|
-
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)) />"),
|
|
139
|
-
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)) />"),
|
|
140
|
-
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)>"),
|
|
141
|
-
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) />"),
|
|
142
|
-
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) />"),
|
|
143
|
-
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);"),
|
|
144
|
-
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}"),
|
|
145
|
-
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});"),
|
|
146
|
-
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});"),
|
|
147
|
-
entry("BRM111", "\"{name}\" is reserved. Brumate writes the attributes that start with \"b-\"", "An attribute starts with `b-`.", "<div data-id=id></div>"),
|
|
148
|
-
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)>"),
|
|
149
|
-
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)>"),
|
|
150
|
-
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> }>();"),
|
|
151
|
-
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>"),
|
|
152
|
-
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';"),
|
|
153
|
-
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;"),
|
|
154
|
-
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);"),
|
|
155
|
-
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}"),
|
|
156
|
-
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);"),
|
|
157
|
-
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}"),
|
|
158
|
-
entry("BRM122", "{name} cannot be used here", "A compile-time function is used where it is not allowed.", "let count = $signal(0);"),
|
|
159
|
-
entry("BRM123", "Call $setContext at the top level of a script", "`$setContext` is inside a function or a block of code.", "$setContext(ThemeContext, theme);"),
|
|
160
|
-
entry("BRM124", "Call $title at the top level of a script", "`$title` is inside a function or a block of code.", "$title('Todos');"),
|
|
161
|
-
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();"),
|
|
162
|
-
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);"),
|
|
163
|
-
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);"),
|
|
164
|
-
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();"),
|
|
165
|
-
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();"),
|
|
166
|
-
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 }>();"),
|
|
167
|
-
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);"),
|
|
168
|
-
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);"),
|
|
169
|
-
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);"),
|
|
170
|
-
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);"),
|
|
171
|
-
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);"),
|
|
172
|
-
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);"),
|
|
173
|
-
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);"),
|
|
174
|
-
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);"),
|
|
175
|
-
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);"),
|
|
176
|
-
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});"),
|
|
177
|
-
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');"),
|
|
178
|
-
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)>"),
|
|
179
|
-
entry("BRM140", "$watch is not supported. Use $effect", "`$watch` was removed.", "$effect(() => {\n save(value);\n});"),
|
|
180
|
-
entry("BRM141", "$settled is not supported. Use $client", "`$settled` was removed.", "$client(() => {\n measure();\n});"),
|
|
181
|
-
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});"),
|
|
182
|
-
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);"),
|
|
183
|
-
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);"),
|
|
184
|
-
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 });"),
|
|
185
|
-
entry("BRM195", "$store gives one name, not a pattern such as { a }", "`$store` initializes a pattern.", "const value = $store(source);"),
|
|
186
|
-
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 });"),
|
|
187
|
-
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;"),
|
|
188
|
-
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);"),
|
|
189
|
-
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')));"),
|
|
190
|
-
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 });"),
|
|
191
|
-
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))"),
|
|
192
|
-
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))"),
|
|
193
|
-
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';"),
|
|
194
|
-
entry("BRM147", "Import {name} from '{module}'", "The file calls a compile-time function that it does not import.", "import { $signal } from 'brumate/signals';")
|
|
195
|
-
];
|
|
196
|
-
/** Errors about the code that the browser gets, and the markup that the browser renders. */
|
|
197
|
-
const OUTPUT = [
|
|
198
|
-
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}"),
|
|
199
|
-
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}"),
|
|
200
|
-
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}"),
|
|
201
|
-
entry("BRM151", "#defer cannot be inside a #client body", "A `#defer` is in markup that only the browser renders.", "#defer {\n <Comments />\n}"),
|
|
202
|
-
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}"),
|
|
203
|
-
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>"),
|
|
204
|
-
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}"),
|
|
205
|
-
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</>"),
|
|
206
|
-
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));"),
|
|
207
|
-
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));"),
|
|
208
|
-
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>"),
|
|
209
|
-
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>"),
|
|
210
|
-
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];"),
|
|
211
|
-
entry("BRM161", "Assign to \"{name}\" with = instead of {op}", "An optimistic value is changed with `++` or `--`.", "shown = shown + 1;"),
|
|
212
|
-
entry("BRM162", "Invalid CSS: {message}", "A `<style>` has CSS that does not parse.", "<style>\n p {\n color: red;\n }\n</style>"),
|
|
213
|
-
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}")
|
|
214
|
-
];
|
|
215
|
-
/** Errors about modules of reactive logic, such as `counter.brm.ts`. */
|
|
216
|
-
const MODULES = [
|
|
217
|
-
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);"),
|
|
218
|
-
entry("BRM165", "Declare what {name} returns with const", "The result of a module function is declared with `let`.", "const { count, increment } = counter(0);"),
|
|
219
|
-
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);"),
|
|
220
|
-
entry("BRM167", "Cannot read {specifier}", "The module that the component imports is not on disk.", "import { counter } from './counter.brm.ts';"),
|
|
221
|
-
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}"),
|
|
222
|
-
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}"),
|
|
223
|
-
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}"),
|
|
224
|
-
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}"),
|
|
225
|
-
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);"),
|
|
226
|
-
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 };"),
|
|
227
|
-
entry("BRM174", "{name} cannot return getters or setters. Return the values themselves", "The returned object has a getter or a setter.", "return { count, increment };"),
|
|
228
|
-
entry("BRM175", "{name} does not return {key}", "The component destructures a name that the module function does not return.", "const { count } = counter(0);"),
|
|
229
|
-
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 };"),
|
|
230
|
-
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);"),
|
|
231
|
-
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}"),
|
|
232
|
-
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;")
|
|
233
|
-
];
|
|
234
|
-
const ERRORS = [
|
|
235
|
-
...SYNTAX,
|
|
236
|
-
...SCRIPT,
|
|
237
|
-
...OUTPUT,
|
|
238
|
-
...MODULES
|
|
239
|
-
];
|
|
240
|
-
/** True when a message that the compiler reported has the form of an entry. */
|
|
241
|
-
function matchesError(error, message) {
|
|
242
|
-
const escaped = [];
|
|
243
|
-
for (const part of error.message.split(/\{\w+\}/)) escaped.push(part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
244
|
-
const pattern = escaped.join("[\\s\\S]*?");
|
|
245
|
-
return new RegExp(`^${pattern}$`).test(message);
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* The entry for a message that the compiler reported. The place of the
|
|
249
|
-
* error, as in `(File.brm:3:7)`, can follow the message.
|
|
250
|
-
*/
|
|
251
|
-
function findError(message) {
|
|
252
|
-
const bare = message.replace(/(?:\s\([^()]*:\d+:\d+\))+$/, "").replace(/\s\[BRM\d+\]$/, "");
|
|
253
|
-
function fixed(error) {
|
|
254
|
-
return error.message.replace(/\{\w+\}/g, "").length;
|
|
255
|
-
}
|
|
256
|
-
let found;
|
|
257
|
-
for (const error of ERRORS) if (matchesError(error, bare) && (!found || fixed(error) > fixed(found))) found = error;
|
|
258
|
-
return found;
|
|
259
|
-
}
|
|
260
|
-
//#endregion
|
|
261
8
|
//#region src/error.ts
|
|
262
9
|
function getLocation(source, offset) {
|
|
263
10
|
let line = 1;
|
|
@@ -1896,6 +1643,7 @@ var Analyzer = class {
|
|
|
1896
1643
|
visitBodyContent(body, scope) {
|
|
1897
1644
|
if (body.script) this.declareScript(body.script.program, scope, false);
|
|
1898
1645
|
for (const template of body.templates) this.declareTemplate(template, scope);
|
|
1646
|
+
for (const style of body.styles) for (const variable of style.variables) this.createExpressionSite("style", scope, variable, "style");
|
|
1899
1647
|
this.visitNodes(body.children, scope);
|
|
1900
1648
|
}
|
|
1901
1649
|
visitNodes(nodes, scope) {
|
|
@@ -2681,6 +2429,82 @@ function forEachNode(nodes, visit) {
|
|
|
2681
2429
|
forEachNode(getChildren(node), visit);
|
|
2682
2430
|
}
|
|
2683
2431
|
}
|
|
2432
|
+
/** Returns the bodies of a block, in source order. */
|
|
2433
|
+
function blockBodies(block) {
|
|
2434
|
+
switch (block.kind) {
|
|
2435
|
+
case "if": {
|
|
2436
|
+
const bodies = [];
|
|
2437
|
+
for (const branch of block.branches) bodies.push(branch.body);
|
|
2438
|
+
if (block.fallback) bodies.push(block.fallback);
|
|
2439
|
+
return bodies;
|
|
2440
|
+
}
|
|
2441
|
+
case "switch": {
|
|
2442
|
+
const bodies = [];
|
|
2443
|
+
for (const branch of block.cases) bodies.push(branch.body);
|
|
2444
|
+
if (block.fallback) bodies.push(block.fallback);
|
|
2445
|
+
return bodies;
|
|
2446
|
+
}
|
|
2447
|
+
case "for":
|
|
2448
|
+
case "repeat":
|
|
2449
|
+
case "loading":
|
|
2450
|
+
case "client":
|
|
2451
|
+
case "defer": return [block.body, ...block.fallback ? [block.fallback] : []];
|
|
2452
|
+
case "try": return [block.body, block.fallback];
|
|
2453
|
+
default: return [block.body];
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
/** The place of every body of a file: the bodies of blocks and of templates. */
|
|
2457
|
+
function bodyTree(file) {
|
|
2458
|
+
const tree = /* @__PURE__ */ new Map();
|
|
2459
|
+
function visitBody(body, parent, top, template = false) {
|
|
2460
|
+
tree.set(body, {
|
|
2461
|
+
parent,
|
|
2462
|
+
top,
|
|
2463
|
+
template
|
|
2464
|
+
});
|
|
2465
|
+
for (const declared of body.templates) visitBody(declared.body, body, false, true);
|
|
2466
|
+
visitNodes(body.children, body, true);
|
|
2467
|
+
}
|
|
2468
|
+
function visitNodes(nodes, parent, top) {
|
|
2469
|
+
for (const node of nodes) switch (node.kind) {
|
|
2470
|
+
case "element":
|
|
2471
|
+
visitNodes(node.children, parent, false);
|
|
2472
|
+
break;
|
|
2473
|
+
case "component":
|
|
2474
|
+
case "dynamic":
|
|
2475
|
+
case "fragment":
|
|
2476
|
+
visitNodes(node.children, parent, top);
|
|
2477
|
+
break;
|
|
2478
|
+
case "text":
|
|
2479
|
+
case "insert":
|
|
2480
|
+
case "listener": break;
|
|
2481
|
+
default: for (const body of blockBodies(node)) visitBody(body, parent, top);
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
for (const template of file.templates) visitBody(template.body, void 0, false, true);
|
|
2485
|
+
visitNodes(file.children, void 0, true);
|
|
2486
|
+
return tree;
|
|
2487
|
+
}
|
|
2488
|
+
const fileBodies = /* @__PURE__ */ new WeakMap();
|
|
2489
|
+
/**
|
|
2490
|
+
* The body of the file itself, the outermost block: its script, `<style>` elements, templates
|
|
2491
|
+
* and markup. It is not in `bodyTree`, where a body without a parent sits directly in it.
|
|
2492
|
+
*/
|
|
2493
|
+
function fileBody(file) {
|
|
2494
|
+
let body = fileBodies.get(file);
|
|
2495
|
+
if (!body) {
|
|
2496
|
+
body = {
|
|
2497
|
+
start: 0,
|
|
2498
|
+
end: file.source.length,
|
|
2499
|
+
script: file.instanceScript,
|
|
2500
|
+
styles: file.styles,
|
|
2501
|
+
templates: file.templates,
|
|
2502
|
+
children: file.children
|
|
2503
|
+
};
|
|
2504
|
+
fileBodies.set(file, body);
|
|
2505
|
+
}
|
|
2506
|
+
return body;
|
|
2507
|
+
}
|
|
2684
2508
|
//#endregion
|
|
2685
2509
|
//#region src/graph.ts
|
|
2686
2510
|
/** Memos that a server function refreshes are live, so they have client code. */
|
|
@@ -3444,6 +3268,7 @@ var Parser = class {
|
|
|
3444
3268
|
filename,
|
|
3445
3269
|
source,
|
|
3446
3270
|
styles: [],
|
|
3271
|
+
blockStyles: [],
|
|
3447
3272
|
templates: [],
|
|
3448
3273
|
children: []
|
|
3449
3274
|
};
|
|
@@ -3520,7 +3345,7 @@ var Parser = class {
|
|
|
3520
3345
|
if (after === "(" || after === "{") return keyword;
|
|
3521
3346
|
if (keyword === "else" && this.source.startsWith("if", next)) return keyword;
|
|
3522
3347
|
}
|
|
3523
|
-
parseNodes(mode, templates) {
|
|
3348
|
+
parseNodes(mode, templates, styles) {
|
|
3524
3349
|
const nodes = [];
|
|
3525
3350
|
for (;;) {
|
|
3526
3351
|
if (this.pos >= this.source.length) {
|
|
@@ -3542,8 +3367,12 @@ var Parser = class {
|
|
|
3542
3367
|
continue;
|
|
3543
3368
|
}
|
|
3544
3369
|
if (this.isTagStart("style")) {
|
|
3545
|
-
if (mode
|
|
3546
|
-
this.
|
|
3370
|
+
if (mode === "element") this.fail("<style> must be at the top level of the file or of a block", this.pos);
|
|
3371
|
+
const style = this.parseStyle();
|
|
3372
|
+
if (styles) {
|
|
3373
|
+
styles.push(style);
|
|
3374
|
+
this.file.blockStyles.push(style);
|
|
3375
|
+
} else this.file.styles.push(style);
|
|
3547
3376
|
continue;
|
|
3548
3377
|
}
|
|
3549
3378
|
if (this.peek() === "<") {
|
|
@@ -3636,6 +3465,7 @@ var Parser = class {
|
|
|
3636
3465
|
body: {
|
|
3637
3466
|
start,
|
|
3638
3467
|
end: this.pos,
|
|
3468
|
+
styles: [],
|
|
3639
3469
|
templates: [],
|
|
3640
3470
|
children: [node]
|
|
3641
3471
|
}
|
|
@@ -4002,6 +3832,7 @@ var Parser = class {
|
|
|
4002
3832
|
if (reveal.collapsed && reveal.order !== "sequential") this.fail(`collapsed shows the fallback of the next body to show, so it needs the order 'sequential', not '${reveal.order}'`, header.start);
|
|
4003
3833
|
const body = this.parseBody("reveal");
|
|
4004
3834
|
if (body.script) this.fail("#reveal has no script of its own", body.script.start);
|
|
3835
|
+
if (body.styles.length > 0) this.fail("#reveal has no style of its own", body.styles[0].start);
|
|
4005
3836
|
return {
|
|
4006
3837
|
kind: "fragment",
|
|
4007
3838
|
start,
|
|
@@ -4034,12 +3865,14 @@ var Parser = class {
|
|
|
4034
3865
|
script = parsed.script;
|
|
4035
3866
|
}
|
|
4036
3867
|
const templates = [];
|
|
4037
|
-
const
|
|
3868
|
+
const styles = [];
|
|
3869
|
+
const children = this.parseNodes("body", templates, styles);
|
|
4038
3870
|
this.pos++;
|
|
4039
3871
|
return {
|
|
4040
3872
|
start,
|
|
4041
3873
|
end: this.pos,
|
|
4042
3874
|
script,
|
|
3875
|
+
styles,
|
|
4043
3876
|
templates,
|
|
4044
3877
|
children
|
|
4045
3878
|
};
|
|
@@ -5934,15 +5767,247 @@ function keyName(property) {
|
|
|
5934
5767
|
if (property.key.type === "Identifier") return property.key.name;
|
|
5935
5768
|
return property.key.type === "Literal" ? String(property.key.value) : void 0;
|
|
5936
5769
|
}
|
|
5770
|
+
/** The node types that a walk through code that always runs enters. */
|
|
5771
|
+
const ALWAYS_RUNS = /* @__PURE__ */ new Set([
|
|
5772
|
+
"ExpressionStatement",
|
|
5773
|
+
"VariableDeclaration",
|
|
5774
|
+
"VariableDeclarator",
|
|
5775
|
+
"AssignmentExpression",
|
|
5776
|
+
"MemberExpression",
|
|
5777
|
+
"CallExpression",
|
|
5778
|
+
"NewExpression",
|
|
5779
|
+
"BinaryExpression",
|
|
5780
|
+
"UnaryExpression",
|
|
5781
|
+
"TemplateLiteral",
|
|
5782
|
+
"TaggedTemplateExpression",
|
|
5783
|
+
"ObjectExpression",
|
|
5784
|
+
"Property",
|
|
5785
|
+
"ArrayExpression",
|
|
5786
|
+
"SpreadElement",
|
|
5787
|
+
"ParenthesizedExpression",
|
|
5788
|
+
"SequenceExpression",
|
|
5789
|
+
"TSAsExpression",
|
|
5790
|
+
"TSSatisfiesExpression",
|
|
5791
|
+
"TSNonNullExpression"
|
|
5792
|
+
]);
|
|
5793
|
+
/**
|
|
5794
|
+
* Adds the start of each name that the code reads whenever it runs. A function, an optional
|
|
5795
|
+
* chain, the branch of a condition and the right side of `&&`, `||` and `??` may not run.
|
|
5796
|
+
*/
|
|
5797
|
+
function addAlwaysRead(node, into) {
|
|
5798
|
+
if (node.type === "Identifier") {
|
|
5799
|
+
into.add(node.start);
|
|
5800
|
+
return;
|
|
5801
|
+
}
|
|
5802
|
+
if (node.type === "ConditionalExpression") {
|
|
5803
|
+
addAlwaysRead(node.test, into);
|
|
5804
|
+
return;
|
|
5805
|
+
}
|
|
5806
|
+
if (node.type === "LogicalExpression") {
|
|
5807
|
+
addAlwaysRead(node.left, into);
|
|
5808
|
+
return;
|
|
5809
|
+
}
|
|
5810
|
+
if (node.type === "CallExpression" && (calleeName(node) === "$isPending" || calleeName(node) === "$isBound")) return;
|
|
5811
|
+
if (!ALWAYS_RUNS.has(node.type)) return;
|
|
5812
|
+
for (const [, child] of children(node)) addAlwaysRead(child, into);
|
|
5813
|
+
}
|
|
5814
|
+
/**
|
|
5815
|
+
* The expressions of markup that run when the body around them renders: text, and the values of
|
|
5816
|
+
* attributes and props. The children of a component and the bodies of blocks render apart.
|
|
5817
|
+
*/
|
|
5818
|
+
function addAlwaysMarkup(nodes, into) {
|
|
5819
|
+
for (const node of nodes) if (node.kind === "insert") into.add(node.expression.ast);
|
|
5820
|
+
else if (node.kind === "element" || node.kind === "dynamic" || node.kind === "component") {
|
|
5821
|
+
for (const attribute of node.attributes) if (attribute.kind === "value") into.add(attribute.value.ast);
|
|
5822
|
+
if (node.kind !== "component") addAlwaysMarkup(node.children, into);
|
|
5823
|
+
} else if (node.kind === "fragment") addAlwaysMarkup(node.children, into);
|
|
5824
|
+
}
|
|
5825
|
+
/** The site kinds whose code does not run when a render runs. */
|
|
5826
|
+
const NOT_RUN = /* @__PURE__ */ new Set([
|
|
5827
|
+
"function",
|
|
5828
|
+
"server-function",
|
|
5829
|
+
"effect",
|
|
5830
|
+
"client",
|
|
5831
|
+
"event"
|
|
5832
|
+
]);
|
|
5833
|
+
/** The site kinds of markup, which run after the script of their scope. */
|
|
5834
|
+
const MARKUP_SITES$2 = /* @__PURE__ */ new Set([
|
|
5835
|
+
"insert",
|
|
5836
|
+
"attribute",
|
|
5837
|
+
"prop",
|
|
5838
|
+
"spread",
|
|
5839
|
+
"tag",
|
|
5840
|
+
"block",
|
|
5841
|
+
"title",
|
|
5842
|
+
"style"
|
|
5843
|
+
]);
|
|
5844
|
+
/** The first step of evaluating `node` up to the name at `target` that can throw, if any. */
|
|
5845
|
+
function throwsBefore(node, target, safe) {
|
|
5846
|
+
if (target < node.start || target >= node.end) return;
|
|
5847
|
+
if (node.type === "Identifier") return false;
|
|
5848
|
+
const parts = [];
|
|
5849
|
+
for (const [, child] of children(node)) {
|
|
5850
|
+
if (node.type === "VariableDeclarator" && child === node.id) continue;
|
|
5851
|
+
parts.push(child);
|
|
5852
|
+
}
|
|
5853
|
+
parts.sort((a, b) => a.start - b.start);
|
|
5854
|
+
for (const part of parts) {
|
|
5855
|
+
const found = throwsBefore(part, target, safe);
|
|
5856
|
+
if (found !== void 0) return found;
|
|
5857
|
+
if (part.end <= target && !cannotThrow(part, safe)) return true;
|
|
5858
|
+
}
|
|
5859
|
+
}
|
|
5860
|
+
/** True when the markup holds a component or a dynamic tag, at any depth. */
|
|
5861
|
+
function hasChildren(value) {
|
|
5862
|
+
if (Array.isArray(value)) {
|
|
5863
|
+
for (const item of value) if (hasChildren(item)) return true;
|
|
5864
|
+
return false;
|
|
5865
|
+
}
|
|
5866
|
+
if (value === null || typeof value !== "object") return false;
|
|
5867
|
+
const node = value;
|
|
5868
|
+
if (node.kind === "component" || node.kind === "dynamic") return true;
|
|
5869
|
+
for (const [key, child] of Object.entries(value)) if (key !== "ast" && key !== "script" && key !== "styles" && hasChildren(child)) return true;
|
|
5870
|
+
return false;
|
|
5871
|
+
}
|
|
5937
5872
|
/**
|
|
5938
|
-
*
|
|
5939
|
-
*
|
|
5940
|
-
*
|
|
5873
|
+
* The memos that the browser render runs through `renderMemo`, so each holds its error until a
|
|
5874
|
+
* read throws it. The others add to `settled`, since they hold none:
|
|
5875
|
+
* - a memo that cannot throw, such as `{ show: wanted }`, if it reads no memo that holds an error;
|
|
5876
|
+
* - a memo that the render always reads, in code that always runs. It throws at its declaration,
|
|
5877
|
+
* which is the throw of the read to the nearest `#try`, so no read needs a check. A memo of
|
|
5878
|
+
* another memo that always runs counts too. The error must also be the first one: nothing that
|
|
5879
|
+
* can throw runs between the declaration and the first read.
|
|
5880
|
+
* A memo with `await` is a promise at once, and a promise holds its error.
|
|
5941
5881
|
*/
|
|
5942
|
-
function
|
|
5943
|
-
const
|
|
5944
|
-
for (const
|
|
5945
|
-
|
|
5882
|
+
function heldMemos(file, sites, inline, settled) {
|
|
5883
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
5884
|
+
for (const site of sites) if (site.kind === "memo" && site.declaration && !inline.has(site.declaration)) {
|
|
5885
|
+
const node = site.node;
|
|
5886
|
+
const memoReads = /* @__PURE__ */ new Set();
|
|
5887
|
+
for (const read of site.reads) if (read.declaration.kind === "memo" || read.declaration.kind === "async-memo") memoReads.add(read.range.start);
|
|
5888
|
+
if (!site.awaits && (!neverPromise(node) || !cannotThrow(node, (name) => !memoReads.has(name.start)))) candidates.add(site.declaration);
|
|
5889
|
+
}
|
|
5890
|
+
const candidateReads = /* @__PURE__ */ new Set();
|
|
5891
|
+
for (const memo of candidates) for (const read of memo.reads) candidateReads.add(read.range.start);
|
|
5892
|
+
const markup = /* @__PURE__ */ new Set();
|
|
5893
|
+
addAlwaysMarkup(file.children, markup);
|
|
5894
|
+
const bodies = /* @__PURE__ */ new Set();
|
|
5895
|
+
for (const site of sites) {
|
|
5896
|
+
const body = site.scope.body;
|
|
5897
|
+
if (site.scope.kind === "body" && body && !bodies.has(body)) {
|
|
5898
|
+
bodies.add(body);
|
|
5899
|
+
addAlwaysMarkup(body.children, markup);
|
|
5900
|
+
}
|
|
5901
|
+
}
|
|
5902
|
+
const reached = /* @__PURE__ */ new Map();
|
|
5903
|
+
function alwaysReads(site) {
|
|
5904
|
+
let starts = reached.get(site);
|
|
5905
|
+
if (!starts) {
|
|
5906
|
+
starts = /* @__PURE__ */ new Set();
|
|
5907
|
+
if ((site.scope.kind === "component" || site.scope.kind === "body") && (site.kind === "memo" || site.kind === "provide" || site.kind === "setup" && (site.label === "setup" || site.label.startsWith("signal ")) || (site.kind === "insert" || site.kind === "attribute" || site.kind === "prop") && markup.has(site.node))) addAlwaysRead(site.node, starts);
|
|
5908
|
+
reached.set(site, starts);
|
|
5909
|
+
}
|
|
5910
|
+
return starts;
|
|
5911
|
+
}
|
|
5912
|
+
const blocked = /* @__PURE__ */ new Set();
|
|
5913
|
+
let held = /* @__PURE__ */ new Set();
|
|
5914
|
+
let thrown = /* @__PURE__ */ new Map();
|
|
5915
|
+
for (;;) {
|
|
5916
|
+
held = new Set(candidates);
|
|
5917
|
+
thrown = /* @__PURE__ */ new Map();
|
|
5918
|
+
settled.clear();
|
|
5919
|
+
settle();
|
|
5920
|
+
let again = false;
|
|
5921
|
+
for (const [memo, read] of thrown) if (!inOrder(memo, read)) {
|
|
5922
|
+
blocked.add(memo);
|
|
5923
|
+
again = true;
|
|
5924
|
+
}
|
|
5925
|
+
if (!again) return held;
|
|
5926
|
+
}
|
|
5927
|
+
function runsAtOnce(site) {
|
|
5928
|
+
const owner = site.declaration;
|
|
5929
|
+
return !!owner && !held.has(owner) && !site.awaits;
|
|
5930
|
+
}
|
|
5931
|
+
function alwaysRead(memo) {
|
|
5932
|
+
const result = [];
|
|
5933
|
+
for (const read of memo.reads) {
|
|
5934
|
+
const site = read.site;
|
|
5935
|
+
if (site.scope === memo.scope && alwaysReads(site).has(read.range.start) && (site.kind !== "memo" || runsAtOnce(site))) result.push(read);
|
|
5936
|
+
}
|
|
5937
|
+
return result;
|
|
5938
|
+
}
|
|
5939
|
+
function settle() {
|
|
5940
|
+
let changed = true;
|
|
5941
|
+
while (changed) {
|
|
5942
|
+
changed = false;
|
|
5943
|
+
for (const site of sites) {
|
|
5944
|
+
const memo = site.declaration;
|
|
5945
|
+
if (site.kind !== "memo" || !memo || !held.has(memo)) continue;
|
|
5946
|
+
let settles = false;
|
|
5947
|
+
if (!memo.gate && cannotThrow(site.node)) {
|
|
5948
|
+
settles = true;
|
|
5949
|
+
for (const read of site.reads) if (held.has(read.declaration)) settles = false;
|
|
5950
|
+
}
|
|
5951
|
+
if (!settles && !blocked.has(memo)) {
|
|
5952
|
+
const reads = alwaysRead(memo);
|
|
5953
|
+
if (reads.length > 0) {
|
|
5954
|
+
settles = true;
|
|
5955
|
+
thrown.set(memo, reads.toSorted(compareReads)[0]);
|
|
5956
|
+
}
|
|
5957
|
+
}
|
|
5958
|
+
if (settles) {
|
|
5959
|
+
held.delete(memo);
|
|
5960
|
+
settled.add(memo);
|
|
5961
|
+
changed = true;
|
|
5962
|
+
}
|
|
5963
|
+
}
|
|
5964
|
+
}
|
|
5965
|
+
}
|
|
5966
|
+
function phase(site) {
|
|
5967
|
+
return MARKUP_SITES$2.has(site.kind) ? 1 : 0;
|
|
5968
|
+
}
|
|
5969
|
+
function compareReads(a, b) {
|
|
5970
|
+
return phase(a.site) - phase(b.site) || a.range.start - b.range.start;
|
|
5971
|
+
}
|
|
5972
|
+
function mayThrow(site, own) {
|
|
5973
|
+
const owner = site.kind === "memo" ? site.declaration : void 0;
|
|
5974
|
+
if (owner) {
|
|
5975
|
+
if (site.awaits || held.has(owner) && !thrown.has(owner)) return false;
|
|
5976
|
+
if (thrown.has(owner)) return true;
|
|
5977
|
+
}
|
|
5978
|
+
const ownReads = /* @__PURE__ */ new Set();
|
|
5979
|
+
let firstOwn = Infinity;
|
|
5980
|
+
for (const read of own.reads) {
|
|
5981
|
+
ownReads.add(read.range.start);
|
|
5982
|
+
if (read.site === site && alwaysReads(site).has(read.range.start)) firstOwn = Math.min(firstOwn, read.range.start);
|
|
5983
|
+
}
|
|
5984
|
+
const safe = (name) => ownReads.has(name.start) || !candidateReads.has(name.start);
|
|
5985
|
+
if (firstOwn < Infinity && throwsBefore(site.node, firstOwn, safe) === false) return false;
|
|
5986
|
+
return !cannotThrow(site.node, safe);
|
|
5987
|
+
}
|
|
5988
|
+
function isInside(scope, outer) {
|
|
5989
|
+
for (let at = scope?.parent; at; at = at.parent) if (at === outer) return true;
|
|
5990
|
+
return false;
|
|
5991
|
+
}
|
|
5992
|
+
function inOrder(memo, read) {
|
|
5993
|
+
const declared = memo.site;
|
|
5994
|
+
if (!declared) return false;
|
|
5995
|
+
const own = /* @__PURE__ */ new Set();
|
|
5996
|
+
for (const other of memo.reads) own.add(other.range.start);
|
|
5997
|
+
if (throwsBefore(read.site.node, read.range.start, (name) => own.has(name.start) || !candidateReads.has(name.start))) return false;
|
|
5998
|
+
const atMarkup = phase(read.site) === 1;
|
|
5999
|
+
if (atMarkup && hasChildren(memo.scope.kind === "body" ? memo.scope.body?.children : file.children)) return false;
|
|
6000
|
+
for (const site of sites) {
|
|
6001
|
+
if (site === declared || site === read.site || NOT_RUN.has(site.kind)) continue;
|
|
6002
|
+
let between = false;
|
|
6003
|
+
if (site.scope === memo.scope) {
|
|
6004
|
+
if (phase(site) === 0) between = site.node.start > declared.node.start && (atMarkup || site.node.start < read.range.start);
|
|
6005
|
+
else between = atMarkup;
|
|
6006
|
+
} else if (atMarkup && isInside(site.scope, memo.scope)) between = true;
|
|
6007
|
+
if (between && mayThrow(site, memo)) return false;
|
|
6008
|
+
}
|
|
6009
|
+
return true;
|
|
6010
|
+
}
|
|
5946
6011
|
}
|
|
5947
6012
|
function addValueEdits(patch, file, sites, mode = "server", inline = /* @__PURE__ */ new Set(), lazy = /* @__PURE__ */ new Set(), component) {
|
|
5948
6013
|
const sitesByNode = /* @__PURE__ */ new Map();
|
|
@@ -6004,11 +6069,10 @@ function addValueEdits(patch, file, sites, mode = "server", inline = /* @__PURE_
|
|
|
6004
6069
|
replacedAt.add(range.start);
|
|
6005
6070
|
}
|
|
6006
6071
|
}
|
|
6072
|
+
const settled = /* @__PURE__ */ new Set();
|
|
6073
|
+
let held = /* @__PURE__ */ new Set();
|
|
6007
6074
|
if (mode === "render") {
|
|
6008
|
-
|
|
6009
|
-
for (const site of sites) if (site.kind === "memo" && site.declaration && !inline.has(site.declaration)) {
|
|
6010
|
-
if (!isPlainMemo(site, site.node)) held.add(site.declaration);
|
|
6011
|
-
}
|
|
6075
|
+
held = heldMemos(file, sites, inline, settled);
|
|
6012
6076
|
for (const site of sites) readMemos(site, site.node, site.declaration, held);
|
|
6013
6077
|
}
|
|
6014
6078
|
if (mode === "server") {
|
|
@@ -6090,11 +6154,14 @@ function addValueEdits(patch, file, sites, mode = "server", inline = /* @__PURE_
|
|
|
6090
6154
|
patch.replace(node.start, argument.start, open);
|
|
6091
6155
|
patch.replace(argument.end, node.end, `), $$ctx, ${JSON.stringify(declaration.name)})`);
|
|
6092
6156
|
} else if (mode === "render" && declaration?.gate) {
|
|
6093
|
-
|
|
6094
|
-
patch.replace(
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6157
|
+
const open = settled.has(declaration) ? "$$b.gateValue(" : "$$b.renderMemo(() => $$b.gateValue(";
|
|
6158
|
+
patch.replace(node.start, argument.start, open);
|
|
6159
|
+
patch.replace(argument.end, node.end, settled.has(declaration) ? ")" : "))");
|
|
6160
|
+
} else if (mode === "render" && declaration && (site.awaits || !neverPromise(argument) || held.has(declaration))) {
|
|
6161
|
+
let open = site.awaits ? "$$b.renderMemo(async () => (" : "$$b.renderMemo(() => (";
|
|
6162
|
+
if (settled.has(declaration)) open = "$$b.memoNow(";
|
|
6163
|
+
patch.replace(node.start, argument.start, open);
|
|
6164
|
+
patch.replace(argument.end, node.end, settled.has(declaration) ? ")" : "))");
|
|
6098
6165
|
} else if (site?.awaits) {
|
|
6099
6166
|
patch.replace(node.start, argument.start, "(async () => (");
|
|
6100
6167
|
patch.replace(argument.end, node.end, "))()");
|
|
@@ -6727,60 +6794,159 @@ function preprocess(lang, source, file, dependencies) {
|
|
|
6727
6794
|
if (css === void 0) throw new Error("Less did not finish. Imports that load over the network are not supported");
|
|
6728
6795
|
return css;
|
|
6729
6796
|
}
|
|
6730
|
-
/**
|
|
6797
|
+
/**
|
|
6798
|
+
* Compiles one `<style>` into scoped CSS, and adds its interpolations to `state.variables`.
|
|
6799
|
+
* `name` makes the name of a custom property from its index. Returns undefined after an error.
|
|
6800
|
+
*/
|
|
6801
|
+
function compileStyle(file, style, attribute, name, state) {
|
|
6802
|
+
const { variables } = state;
|
|
6803
|
+
const contentStart = file.source.indexOf(style.content, style.start);
|
|
6804
|
+
let content = "";
|
|
6805
|
+
let position = 0;
|
|
6806
|
+
for (const expression of style.variables) {
|
|
6807
|
+
const variable = name(variables.length);
|
|
6808
|
+
let start = expression.start - 2 - contentStart;
|
|
6809
|
+
let end = expression.end + 1 - contentStart;
|
|
6810
|
+
const prefixStart = start;
|
|
6811
|
+
while (start > position && /[#\w.%-]/.test(style.content[start - 1])) start--;
|
|
6812
|
+
const prefix = style.content.slice(start, prefixStart);
|
|
6813
|
+
const suffixStart = end;
|
|
6814
|
+
while (end < style.content.length && /[\w.%-]/.test(style.content[end])) end++;
|
|
6815
|
+
const suffix = style.content.slice(suffixStart, end);
|
|
6816
|
+
variables.push({
|
|
6817
|
+
name: variable,
|
|
6818
|
+
expression,
|
|
6819
|
+
prefix,
|
|
6820
|
+
suffix
|
|
6821
|
+
});
|
|
6822
|
+
content += `${style.content.slice(position, start)}var(${variable})`;
|
|
6823
|
+
position = end;
|
|
6824
|
+
}
|
|
6825
|
+
content += style.content.slice(position);
|
|
6826
|
+
try {
|
|
6827
|
+
const root = parse(style.lang === "css" ? content : preprocess(style.lang, content, state.filePath, state.dependencies));
|
|
6828
|
+
scopeRules(root, attribute, state.targets, style.global);
|
|
6829
|
+
return root.toString().trim();
|
|
6830
|
+
} catch (error) {
|
|
6831
|
+
state.diagnostics.push({
|
|
6832
|
+
severity: "error",
|
|
6833
|
+
message: style.lang === "css" ? `Invalid CSS: ${error.message}` : error.message,
|
|
6834
|
+
range: {
|
|
6835
|
+
start: style.start,
|
|
6836
|
+
end: style.end
|
|
6837
|
+
}
|
|
6838
|
+
});
|
|
6839
|
+
return;
|
|
6840
|
+
}
|
|
6841
|
+
}
|
|
6842
|
+
/**
|
|
6843
|
+
* What each body takes from the styles around it. See `BodyStyles`. A body that no style reaches
|
|
6844
|
+
* is left out. The file's own style reaches every body and the file's body. Its variables go on
|
|
6845
|
+
* the top-level elements of the bodies that sit at the top level of the file, and of a template,
|
|
6846
|
+
* which renders anywhere.
|
|
6847
|
+
*/
|
|
6848
|
+
function bodyStyles(file, blocks) {
|
|
6849
|
+
const result = /* @__PURE__ */ new Map();
|
|
6850
|
+
if (blocks.length === 0) return result;
|
|
6851
|
+
const root = fileBody(file);
|
|
6852
|
+
const byBody = /* @__PURE__ */ new Map();
|
|
6853
|
+
for (const block of blocks) byBody.set(block.body, block);
|
|
6854
|
+
const tree = bodyTree(file);
|
|
6855
|
+
const outermost = byBody.get(root);
|
|
6856
|
+
if (outermost) result.set(root, {
|
|
6857
|
+
attributes: [outermost],
|
|
6858
|
+
variables: outermost.variables.length > 0 ? [outermost] : []
|
|
6859
|
+
});
|
|
6860
|
+
for (const body of tree.keys()) {
|
|
6861
|
+
const attributes = [];
|
|
6862
|
+
const variables = [];
|
|
6863
|
+
let atTop = true;
|
|
6864
|
+
let atRoot = true;
|
|
6865
|
+
let current = body;
|
|
6866
|
+
while (current) {
|
|
6867
|
+
const block = byBody.get(current);
|
|
6868
|
+
if (block) {
|
|
6869
|
+
attributes.unshift(block);
|
|
6870
|
+
if (atTop && block.variables.length > 0) variables.unshift(block);
|
|
6871
|
+
}
|
|
6872
|
+
const info = tree.get(current);
|
|
6873
|
+
atTop = atTop && info.top;
|
|
6874
|
+
atRoot = atRoot && (info.top || info.template);
|
|
6875
|
+
current = info.parent;
|
|
6876
|
+
}
|
|
6877
|
+
if (outermost) {
|
|
6878
|
+
attributes.unshift(outermost);
|
|
6879
|
+
if (atRoot && outermost.variables.length > 0) variables.unshift(outermost);
|
|
6880
|
+
}
|
|
6881
|
+
if (attributes.length > 0) result.set(body, {
|
|
6882
|
+
attributes,
|
|
6883
|
+
variables
|
|
6884
|
+
});
|
|
6885
|
+
}
|
|
6886
|
+
return result;
|
|
6887
|
+
}
|
|
6888
|
+
/**
|
|
6889
|
+
* Compiles the `<style>` elements of a file into scoped CSS, one style for each body that has
|
|
6890
|
+
* any, each with its own attribute. The file's body comes first.
|
|
6891
|
+
*/
|
|
6731
6892
|
function compileStyles(file, scope, filePath) {
|
|
6732
6893
|
const attribute = `b-c-${scope}`;
|
|
6733
|
-
const
|
|
6734
|
-
|
|
6735
|
-
|
|
6894
|
+
const state = {
|
|
6895
|
+
filePath,
|
|
6896
|
+
diagnostics: [],
|
|
6897
|
+
dependencies: [],
|
|
6898
|
+
variables: [],
|
|
6899
|
+
targets: []
|
|
6900
|
+
};
|
|
6901
|
+
const root = fileBody(file);
|
|
6902
|
+
const bodies = [root];
|
|
6903
|
+
if (file.blockStyles.length > 0) {
|
|
6904
|
+
const inner = [];
|
|
6905
|
+
for (const body of bodyTree(file).keys()) if (body.styles.length > 0) inner.push(body);
|
|
6906
|
+
inner.sort((a, b) => a.start - b.start);
|
|
6907
|
+
bodies.push(...inner);
|
|
6908
|
+
}
|
|
6909
|
+
const blocks = [];
|
|
6736
6910
|
const parts = [];
|
|
6737
|
-
|
|
6738
|
-
for (const
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
content += style.content.slice(position);
|
|
6762
|
-
try {
|
|
6763
|
-
const root = parse(style.lang === "css" ? content : preprocess(style.lang, content, filePath, dependencies));
|
|
6764
|
-
scopeRules(root, attribute, targets, style.global);
|
|
6765
|
-
parts.push(root.toString().trim());
|
|
6766
|
-
} catch (error) {
|
|
6767
|
-
diagnostics.push({
|
|
6768
|
-
severity: "error",
|
|
6769
|
-
message: style.lang === "css" ? `Invalid CSS: ${error.message}` : error.message,
|
|
6770
|
-
range: {
|
|
6771
|
-
start: style.start,
|
|
6772
|
-
end: style.end
|
|
6773
|
-
}
|
|
6774
|
-
});
|
|
6911
|
+
let rootStyle;
|
|
6912
|
+
for (const body of bodies) {
|
|
6913
|
+
if (body.styles.length === 0) continue;
|
|
6914
|
+
const number = body === root ? void 0 : blocks.length - (rootStyle ? 1 : 0) + 1;
|
|
6915
|
+
const block = body === root ? {
|
|
6916
|
+
body,
|
|
6917
|
+
attribute,
|
|
6918
|
+
variables: state.variables,
|
|
6919
|
+
targets: state.targets
|
|
6920
|
+
} : {
|
|
6921
|
+
body,
|
|
6922
|
+
attribute: `${attribute}-${number}`,
|
|
6923
|
+
variables: [],
|
|
6924
|
+
targets: []
|
|
6925
|
+
};
|
|
6926
|
+
const blockState = {
|
|
6927
|
+
...state,
|
|
6928
|
+
variables: block.variables,
|
|
6929
|
+
targets: block.targets
|
|
6930
|
+
};
|
|
6931
|
+
const own = [];
|
|
6932
|
+
for (const style of body.styles) {
|
|
6933
|
+
const css = compileStyle(file, style, block.attribute, (index) => number === void 0 ? `--s-${scope}-${index}` : `--s-${scope}-${number}-${index}`, blockState);
|
|
6934
|
+
if (css !== void 0) own.push(css);
|
|
6775
6935
|
}
|
|
6936
|
+
parts.push(...own);
|
|
6937
|
+
if (body === root) {
|
|
6938
|
+
if (own.join("\n") !== "") {
|
|
6939
|
+
rootStyle = block;
|
|
6940
|
+
blocks.push(block);
|
|
6941
|
+
}
|
|
6942
|
+
} else blocks.push(block);
|
|
6776
6943
|
}
|
|
6777
6944
|
return {
|
|
6778
6945
|
css: parts.join("\n"),
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
targets
|
|
6946
|
+
diagnostics: state.diagnostics,
|
|
6947
|
+
dependencies: state.dependencies,
|
|
6948
|
+
blocks,
|
|
6949
|
+
bodies: bodyStyles(file, blocks)
|
|
6784
6950
|
};
|
|
6785
6951
|
}
|
|
6786
6952
|
//#endregion
|
|
@@ -7220,17 +7386,19 @@ function createPlan(file, graph, path, hideNames = false) {
|
|
|
7220
7386
|
}
|
|
7221
7387
|
}
|
|
7222
7388
|
const styles = compileStyles(file, hash(file.filename), path);
|
|
7223
|
-
|
|
7224
|
-
for (const site of model.sites)
|
|
7225
|
-
|
|
7226
|
-
|
|
7389
|
+
const liveBlocks = /* @__PURE__ */ new Set();
|
|
7390
|
+
for (const site of model.sites) {
|
|
7391
|
+
if (site.kind !== "style" || !isLiveSite(site)) continue;
|
|
7392
|
+
liveBlocks.add(site.scope.body ?? fileBody(file));
|
|
7393
|
+
const plan = site.scope.body ? scopes.get(site.scope) : void 0;
|
|
7394
|
+
if (plan) plan.needsId = true;
|
|
7227
7395
|
}
|
|
7228
7396
|
return {
|
|
7229
7397
|
graph,
|
|
7230
7398
|
name,
|
|
7231
7399
|
id: `${name}_${hash(file.filename)}`,
|
|
7232
7400
|
styles,
|
|
7233
|
-
|
|
7401
|
+
liveBlocks,
|
|
7234
7402
|
hideNames,
|
|
7235
7403
|
scopes,
|
|
7236
7404
|
bodyScopes,
|
|
@@ -7281,30 +7449,6 @@ function holdsStream(block) {
|
|
|
7281
7449
|
});
|
|
7282
7450
|
return found;
|
|
7283
7451
|
}
|
|
7284
|
-
/** Returns the bodies of a block, in source order. */
|
|
7285
|
-
function blockBodies(block) {
|
|
7286
|
-
switch (block.kind) {
|
|
7287
|
-
case "if": {
|
|
7288
|
-
const bodies = [];
|
|
7289
|
-
for (const branch of block.branches) bodies.push(branch.body);
|
|
7290
|
-
if (block.fallback) bodies.push(block.fallback);
|
|
7291
|
-
return bodies;
|
|
7292
|
-
}
|
|
7293
|
-
case "switch": {
|
|
7294
|
-
const bodies = [];
|
|
7295
|
-
for (const branch of block.cases) bodies.push(branch.body);
|
|
7296
|
-
if (block.fallback) bodies.push(block.fallback);
|
|
7297
|
-
return bodies;
|
|
7298
|
-
}
|
|
7299
|
-
case "for":
|
|
7300
|
-
case "repeat":
|
|
7301
|
-
case "loading":
|
|
7302
|
-
case "client":
|
|
7303
|
-
case "defer": return [block.body, ...block.fallback ? [block.fallback] : []];
|
|
7304
|
-
case "try": return [block.body, block.fallback];
|
|
7305
|
-
default: return [block.body];
|
|
7306
|
-
}
|
|
7307
|
-
}
|
|
7308
7452
|
/**
|
|
7309
7453
|
* The arguments that tell the core which component holds a block in its children: the kind of the
|
|
7310
7454
|
* scope that renders the component and its anchor. Empty for a block outside children.
|
|
@@ -7905,13 +8049,14 @@ function cloneLines(emitter, hoist, fn = 0, owner) {
|
|
|
7905
8049
|
lines.push(`${indent}${line}`);
|
|
7906
8050
|
return;
|
|
7907
8051
|
}
|
|
7908
|
-
const key = `${memos.scope} ${memos.names.join(" ")}`;
|
|
8052
|
+
const key = `${memos.scope} ${memos.names.join(" ")}${memos.pend ? ` ${settled.size}` : ""}`;
|
|
7909
8053
|
let group = settled.get(key);
|
|
7910
8054
|
if (!group) {
|
|
7911
8055
|
group = {
|
|
7912
8056
|
scope: memos.scope,
|
|
7913
8057
|
names: memos.names,
|
|
7914
|
-
writes: []
|
|
8058
|
+
writes: [],
|
|
8059
|
+
pend: memos.pend
|
|
7915
8060
|
};
|
|
7916
8061
|
settled.set(key, group);
|
|
7917
8062
|
}
|
|
@@ -7952,7 +8097,9 @@ function cloneLines(emitter, hoist, fn = 0, owner) {
|
|
|
7952
8097
|
}
|
|
7953
8098
|
for (const group of settled.values()) {
|
|
7954
8099
|
const names = group.names.join(", ");
|
|
7955
|
-
|
|
8100
|
+
const writes = group.writes.join(" ");
|
|
8101
|
+
const body = group.pend ? `$$b.fillPend(${group.scope}, () => { ${writes} });` : writes;
|
|
8102
|
+
lines.push(group.pend && names === "" ? `${indent}${body}` : `${indent}$$b.fillSettled(${group.scope}, [${names}], (${names}) => { ${body} });`);
|
|
7956
8103
|
}
|
|
7957
8104
|
if (missing) return false;
|
|
7958
8105
|
const sizes = /* @__PURE__ */ new Map();
|
|
@@ -8387,6 +8534,26 @@ const PLAIN_METHODS = /* @__PURE__ */ new Set([
|
|
|
8387
8534
|
"trimStart"
|
|
8388
8535
|
]);
|
|
8389
8536
|
/**
|
|
8537
|
+
* True if a value of markup calls code that can read a memo that is still loading: a function
|
|
8538
|
+
* prop, or a function of the component that reads a memo, also through the functions it calls. The
|
|
8539
|
+
* browser render waits for the memo, as an update does.
|
|
8540
|
+
*/
|
|
8541
|
+
function callsPending(site) {
|
|
8542
|
+
if (!site) return false;
|
|
8543
|
+
if (site.opaqueCalls) return true;
|
|
8544
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8545
|
+
function reads(from) {
|
|
8546
|
+
if (seen.has(from)) return false;
|
|
8547
|
+
seen.add(from);
|
|
8548
|
+
if (from.opaqueCalls) return true;
|
|
8549
|
+
for (const read of from.reads) if (isMemo(read.declaration)) return true;
|
|
8550
|
+
for (const callee of from.calls) if (callee.kind === "function" && callee.site && reads(callee.site)) return true;
|
|
8551
|
+
return false;
|
|
8552
|
+
}
|
|
8553
|
+
for (const callee of site.calls) if (callee.kind === "function" && callee.site && reads(callee.site)) return true;
|
|
8554
|
+
return false;
|
|
8555
|
+
}
|
|
8556
|
+
/**
|
|
8390
8557
|
* True if a value of markup can be a promise, which the browser writes once it settles: a call,
|
|
8391
8558
|
* such as `{load(id)}` or `title=getTitle()`, or a read of a prop typed as a promise. A call of a
|
|
8392
8559
|
* macro of brumate, such as `$isPending`, of `String` or of a method of strings and arrays, such
|
|
@@ -8812,6 +8979,8 @@ var Emitter = class {
|
|
|
8812
8979
|
depth = 0;
|
|
8813
8980
|
/** How many of this component's elements contain the current node. */
|
|
8814
8981
|
nesting = 0;
|
|
8982
|
+
/** The `nesting` where the body that renders began, so its top-level elements are at this level. */
|
|
8983
|
+
bodyBase = 0;
|
|
8815
8984
|
/** How many `#head` blocks contain the current node, where a `<title>` sets the title of the page. */
|
|
8816
8985
|
headBlocks = 0;
|
|
8817
8986
|
counter = 0;
|
|
@@ -9011,6 +9180,14 @@ var Emitter = class {
|
|
|
9011
9180
|
this.parts.push(part);
|
|
9012
9181
|
}
|
|
9013
9182
|
/**
|
|
9183
|
+
* In the browser, the code of a value of markup that calls code that can read a memo that is
|
|
9184
|
+
* still loading. The value is a promise then, which the clone waits for.
|
|
9185
|
+
*/
|
|
9186
|
+
pended(code, expression, scope) {
|
|
9187
|
+
const promise = this.promiseScope(expression, scope);
|
|
9188
|
+
return promise && callsPending(this.sitesByNode.get(expression.ast)) ? `$$b.pend(() => (${code}), ${promise})` : code;
|
|
9189
|
+
}
|
|
9190
|
+
/**
|
|
9014
9191
|
* In the browser, the scope of a value of markup that can be a promise: one that calls code,
|
|
9015
9192
|
* such as `{load(id)}`, or reads a prop typed as a promise. The clone writes its value once it
|
|
9016
9193
|
* settles, and a `#loading` around it shows its fallback until then.
|
|
@@ -9023,21 +9200,29 @@ var Emitter = class {
|
|
|
9023
9200
|
* promise, such as an insert, the headers of a block or the props of a component. No update
|
|
9024
9201
|
* writes them when the memos settle, so the clone holds back what reads them.
|
|
9025
9202
|
*/
|
|
9026
|
-
settledMemos(expressions, scope) {
|
|
9203
|
+
settledMemos(expressions, scope, waits = true) {
|
|
9027
9204
|
if (this.options.mode !== "client") return;
|
|
9028
9205
|
const names = [];
|
|
9206
|
+
let pend = false;
|
|
9029
9207
|
for (const expression of expressions) {
|
|
9030
9208
|
const site = this.sitesByNode.get(expression.ast);
|
|
9031
9209
|
if (!site || this.liveSites.has(site)) return;
|
|
9210
|
+
pend ||= waits && callsPending(site);
|
|
9032
9211
|
for (const reference of site.reads) {
|
|
9033
9212
|
const declaration = reference.declaration;
|
|
9034
9213
|
if (isMemo(declaration) && !isNeverPromise(declaration) && !this.splitMemos.has(declaration) && !names.includes(declaration.name)) names.push(declaration.name);
|
|
9035
9214
|
}
|
|
9036
9215
|
}
|
|
9037
|
-
|
|
9216
|
+
if (names.length === 0 && !pend) return;
|
|
9217
|
+
const own = this.scopeVar(instanceScope(this.plan, scope));
|
|
9218
|
+
return pend ? {
|
|
9038
9219
|
names,
|
|
9039
|
-
scope:
|
|
9040
|
-
|
|
9220
|
+
scope: own,
|
|
9221
|
+
pend
|
|
9222
|
+
} : {
|
|
9223
|
+
names,
|
|
9224
|
+
scope: own
|
|
9225
|
+
};
|
|
9041
9226
|
}
|
|
9042
9227
|
flush() {
|
|
9043
9228
|
if (this.parts.length === 0) return;
|
|
@@ -9681,6 +9866,12 @@ var Emitter = class {
|
|
|
9681
9866
|
* before the markup, after the script.
|
|
9682
9867
|
*/
|
|
9683
9868
|
emitBody(body, createScope = true, markup) {
|
|
9869
|
+
const base = this.bodyBase;
|
|
9870
|
+
this.bodyBase = this.nesting;
|
|
9871
|
+
this.emitBodyContent(body, createScope, markup);
|
|
9872
|
+
this.bodyBase = base;
|
|
9873
|
+
}
|
|
9874
|
+
emitBodyContent(body, createScope, markup) {
|
|
9684
9875
|
const scope = this.plan.bodyScopes.get(body);
|
|
9685
9876
|
if ((this.plan.scopes.get(scope).needsId || this.splitsScript(body, scope)) && createScope) this.createScope(scope);
|
|
9686
9877
|
if (body.script) this.emitStatements(body.script.program.body, scope);
|
|
@@ -9788,9 +9979,10 @@ var Emitter = class {
|
|
|
9788
9979
|
let rest = server && spacer !== void 0 ? `, ${JSON.stringify(spacer)}` : "";
|
|
9789
9980
|
if (server && anchor) rest = `${rest || ", undefined"}, ${anchor.index}`;
|
|
9790
9981
|
const at = this.options.mode === "server" || readsProp || callsTemplate(site) ? `, ${this.ctxArgument}, ${this.scopeVar(instanceScope(this.plan, scope))}${rest}` : "";
|
|
9791
|
-
const
|
|
9982
|
+
const inner = this.pended(this.expression(node.expression), node.expression, scope);
|
|
9983
|
+
const value = this.isPrimitiveInsert(node.expression) ? `$$b.insert(${inner})` : this.ready(`$$b.insert(${inner}${at})`);
|
|
9792
9984
|
const text = literalText(node.expression.ast);
|
|
9793
|
-
const settled = this.settledMemos([node.expression], scope);
|
|
9985
|
+
const settled = this.settledMemos([node.expression], scope, !this.promiseScope(node.expression, scope));
|
|
9794
9986
|
const promise = this.promiseScope(node.expression, scope);
|
|
9795
9987
|
const emitValue = () => text === void 0 ? this.code(value, settled, promise) : this.html(text);
|
|
9796
9988
|
if (anchor && !this.plan.contents.has(node)) {
|
|
@@ -9898,16 +10090,16 @@ var Emitter = class {
|
|
|
9898
10090
|
}
|
|
9899
10091
|
/**
|
|
9900
10092
|
* The style attribute of a top-level element, with the style variables of
|
|
9901
|
-
* the component
|
|
9902
|
-
* spreads gets them after its attributes
|
|
9903
|
-
* and the style of a spread does not
|
|
10093
|
+
* the component and of the block styles around it, so the elements inside
|
|
10094
|
+
* inherit them. An element with spreads gets them after its attributes
|
|
10095
|
+
* merge, so it returns them as code, and the style of a spread does not
|
|
10096
|
+
* take the place of the variables.
|
|
9904
10097
|
*/
|
|
9905
|
-
emitVariables(node) {
|
|
9906
|
-
const
|
|
9907
|
-
if (
|
|
9908
|
-
const values = this.variableValues();
|
|
10098
|
+
emitVariables(node, scope) {
|
|
10099
|
+
const values = this.variableValues(scope);
|
|
10100
|
+
if (values === void 0) return;
|
|
9909
10101
|
if (hasSpread(node.attributes)) {
|
|
9910
|
-
this.emitLiveStyles();
|
|
10102
|
+
this.emitLiveStyles(scope);
|
|
9911
10103
|
return values;
|
|
9912
10104
|
}
|
|
9913
10105
|
const own = findStyleAttribute(node.attributes);
|
|
@@ -9915,25 +10107,59 @@ var Emitter = class {
|
|
|
9915
10107
|
if (own?.kind === "static") existing = own.value === true ? "undefined" : JSON.stringify(own.value);
|
|
9916
10108
|
else if (own?.kind === "value") existing = this.expression(own.value);
|
|
9917
10109
|
this.code(`$$b.attribute("style", $$b.vars(${values}, ${existing}))`);
|
|
9918
|
-
this.emitLiveStyles();
|
|
10110
|
+
this.emitLiveStyles(scope);
|
|
9919
10111
|
return values;
|
|
9920
10112
|
}
|
|
9921
|
-
/**
|
|
9922
|
-
|
|
10113
|
+
/**
|
|
10114
|
+
* The styles that reach the elements written in a scope: those of its body and of the bodies
|
|
10115
|
+
* around it. A scope of no body is the file's.
|
|
10116
|
+
*/
|
|
10117
|
+
blockStyles(scope) {
|
|
10118
|
+
return this.plan.styles.bodies.get(scope.body ?? fileBody(this.file));
|
|
10119
|
+
}
|
|
10120
|
+
/**
|
|
10121
|
+
* The style variables of the element that renders now and their values, as an object in code, or
|
|
10122
|
+
* undefined for none. A top-level element of a body has those of the styles that it is at the
|
|
10123
|
+
* top level of.
|
|
10124
|
+
*/
|
|
10125
|
+
variableValues(scope) {
|
|
9923
10126
|
const values = [];
|
|
9924
|
-
for (const
|
|
9925
|
-
return `{ ${values.join(", ")} }
|
|
10127
|
+
if (this.nesting === this.bodyBase) for (const block of this.blockStyles(scope)?.variables ?? []) for (const variable of block.variables) values.push(`${JSON.stringify(variable.name)}: ${variableValue(variable, this.expression(variable.expression))}`);
|
|
10128
|
+
return values.length > 0 ? `{ ${values.join(", ")} }` : void 0;
|
|
9926
10129
|
}
|
|
9927
|
-
/**
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
|
|
9931
|
-
|
|
10130
|
+
/**
|
|
10131
|
+
* The names of the scope attributes of an element: those of the styles of its body and of the
|
|
10132
|
+
* bodies around it. In a build, an attribute is left out when no selector of its style could
|
|
10133
|
+
* match the element. In development, every element gets it, so a change to the styles applies
|
|
10134
|
+
* without rendering the page again.
|
|
10135
|
+
*/
|
|
10136
|
+
scopeAttributes(scope, tag, classes) {
|
|
10137
|
+
const names = [];
|
|
10138
|
+
for (const block of this.blockStyles(scope)?.attributes ?? []) if (!this.plan.hideNames || needsScope(block.targets, tag, classes)) names.push(block.attribute);
|
|
10139
|
+
return names;
|
|
10140
|
+
}
|
|
10141
|
+
/**
|
|
10142
|
+
* The scopes whose style variables the element that renders now carries and that change on the
|
|
10143
|
+
* client, as code: the IDs of the instances, or undefined for none. A top-level element of a
|
|
10144
|
+
* body carries the live styles that it is at the top level of.
|
|
10145
|
+
*/
|
|
10146
|
+
liveVariableScopes(scope) {
|
|
10147
|
+
const ids = [];
|
|
10148
|
+
if (this.nesting === this.bodyBase) {
|
|
10149
|
+
for (const block of this.blockStyles(scope)?.variables ?? []) if (this.plan.liveBlocks.has(block.body)) {
|
|
10150
|
+
const owner = this.plan.bodyScopes.get(block.body) ?? this.plan.graph.model.component;
|
|
10151
|
+
const name = this.scopeVar(instanceScope(this.plan, owner));
|
|
10152
|
+
ids.push(this.isInside(owner) ? name : `${name}.id`);
|
|
10153
|
+
}
|
|
10154
|
+
}
|
|
10155
|
+
if (ids.length === 0) return;
|
|
10156
|
+
return ids.length === 1 ? ids[0] : `[${ids.join(", ")}].join(" ")`;
|
|
9932
10157
|
}
|
|
9933
|
-
emitLiveStyles() {
|
|
9934
|
-
|
|
10158
|
+
emitLiveStyles(scope) {
|
|
10159
|
+
const ids = this.liveVariableScopes(scope);
|
|
10160
|
+
if (ids !== void 0) {
|
|
9935
10161
|
this.html(" b-v=\"");
|
|
9936
|
-
this.code(
|
|
10162
|
+
this.code(ids);
|
|
9937
10163
|
this.html("\"");
|
|
9938
10164
|
}
|
|
9939
10165
|
}
|
|
@@ -9978,14 +10204,14 @@ var Emitter = class {
|
|
|
9978
10204
|
this.line(`const ${spreadHandlers}: string[] = [];`);
|
|
9979
10205
|
}
|
|
9980
10206
|
this.html(`<${node.tag}`);
|
|
9981
|
-
|
|
10207
|
+
for (const name of this.scopeAttributes(scope, node.tag, staticClasses(node.attributes))) this.html(` ${name}`);
|
|
9982
10208
|
const anchor = this.anchor(scope, node);
|
|
9983
10209
|
if (anchor && spreadHandlers) {
|
|
9984
10210
|
this.html(" b-b=\"");
|
|
9985
10211
|
this.code(anchor.scope);
|
|
9986
10212
|
this.html(`:${anchor.index}"`);
|
|
9987
10213
|
}
|
|
9988
|
-
const variables = this.emitVariables(node);
|
|
10214
|
+
const variables = this.emitVariables(node, scope);
|
|
9989
10215
|
const events = [];
|
|
9990
10216
|
const merged = hasSpread(node.attributes) ? [] : void 0;
|
|
9991
10217
|
let liveSpread = false;
|
|
@@ -10018,8 +10244,8 @@ var Emitter = class {
|
|
|
10018
10244
|
this.emitClasses(classes);
|
|
10019
10245
|
break;
|
|
10020
10246
|
}
|
|
10021
|
-
const call = `$$b.attribute(${JSON.stringify(attribute.name)}, ${this.expression(attribute.value)})`;
|
|
10022
|
-
this.code(isPrimitive(attribute.value.ast) ? call : this.ready(call), this.settledMemos([attribute.value], scope), this.promiseScope(attribute.value, scope));
|
|
10247
|
+
const call = `$$b.attribute(${JSON.stringify(attribute.name)}, ${this.pended(this.expression(attribute.value), attribute.value, scope)})`;
|
|
10248
|
+
this.code(isPrimitive(attribute.value.ast) ? call : this.ready(call), this.settledMemos([attribute.value], scope, !this.promiseScope(attribute.value, scope)), this.promiseScope(attribute.value, scope));
|
|
10023
10249
|
const bound = this.bindEntry(node, attribute, scope);
|
|
10024
10250
|
if (bound) events.unshift(bound);
|
|
10025
10251
|
break;
|
|
@@ -10132,17 +10358,6 @@ var Emitter = class {
|
|
|
10132
10358
|
this.code(`$$b.classAttribute(${pieces.join(" + ")})`);
|
|
10133
10359
|
}
|
|
10134
10360
|
}
|
|
10135
|
-
/**
|
|
10136
|
-
* True if an element gets the scope attribute. In a build, only elements
|
|
10137
|
-
* that a scoped selector could match get it. In development, every
|
|
10138
|
-
* element of a component with styles gets it, so a change to the styles
|
|
10139
|
-
* applies without rendering the page again.
|
|
10140
|
-
*/
|
|
10141
|
-
hasScope(tag, classes) {
|
|
10142
|
-
const { css, targets } = this.plan.styles;
|
|
10143
|
-
if (!css) return false;
|
|
10144
|
-
return !this.plan.hideNames || needsScope(targets, tag, classes);
|
|
10145
|
-
}
|
|
10146
10361
|
/** Renders the children of a component or a dynamic tag, for their export in the browser. */
|
|
10147
10362
|
emitChildrenBody(node, scope) {
|
|
10148
10363
|
this.atTopLevel(() => this.emitNodes(node.children, scope));
|
|
@@ -10150,10 +10365,13 @@ var Emitter = class {
|
|
|
10150
10365
|
/** Runs a callback for markup that renders outside this component's elements, such as children. */
|
|
10151
10366
|
atTopLevel(callback) {
|
|
10152
10367
|
const nesting = this.nesting;
|
|
10368
|
+
const base = this.bodyBase;
|
|
10153
10369
|
const elements = this.elements.splice(0);
|
|
10154
10370
|
this.nesting = 0;
|
|
10371
|
+
this.bodyBase = 0;
|
|
10155
10372
|
callback();
|
|
10156
10373
|
this.nesting = nesting;
|
|
10374
|
+
this.bodyBase = base;
|
|
10157
10375
|
this.elements.push(...elements);
|
|
10158
10376
|
}
|
|
10159
10377
|
/** Renders children into a variable, for a component or a dynamic tag. */
|
|
@@ -10310,7 +10528,7 @@ var Emitter = class {
|
|
|
10310
10528
|
emitDynamic(node, scope) {
|
|
10311
10529
|
const childrenName = this.emitChildren(node, scope);
|
|
10312
10530
|
const extra = [];
|
|
10313
|
-
|
|
10531
|
+
for (const name of this.scopeAttributes(scope, void 0, staticClasses(node.attributes))) extra.push(`${JSON.stringify(name)}: $$b.internal(true)`);
|
|
10314
10532
|
const anchor = this.anchor(scope, node);
|
|
10315
10533
|
if (anchor) extra.push(`"b-b": $$b.internal(\`\${${anchor.scope}}:${anchor.index}\`)`);
|
|
10316
10534
|
const events = [];
|
|
@@ -10324,13 +10542,12 @@ var Emitter = class {
|
|
|
10324
10542
|
}
|
|
10325
10543
|
let attributes = [];
|
|
10326
10544
|
for (const attribute of node.attributes) if (attribute.kind !== "event") attributes.push(attribute);
|
|
10327
|
-
const
|
|
10545
|
+
const variableCode = this.variableValues(scope);
|
|
10328
10546
|
let spreadVariables;
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
if (
|
|
10333
|
-
else if (variables.length > 0 && this.nesting === 0) {
|
|
10547
|
+
const liveScopes = this.liveVariableScopes(scope);
|
|
10548
|
+
if (liveScopes !== void 0) extra.push(`"b-v": $$b.internal(${liveScopes})`);
|
|
10549
|
+
if (variableCode !== void 0 && hasSpread(attributes)) spreadVariables = variableCode;
|
|
10550
|
+
else if (variableCode !== void 0) {
|
|
10334
10551
|
const own = findStyleAttribute(attributes);
|
|
10335
10552
|
let existing = "undefined";
|
|
10336
10553
|
if (own?.kind === "static") existing = own.value === true ? "undefined" : JSON.stringify(own.value);
|
|
@@ -10338,7 +10555,7 @@ var Emitter = class {
|
|
|
10338
10555
|
const rest = [];
|
|
10339
10556
|
for (const attribute of attributes) if (attribute !== own) rest.push(attribute);
|
|
10340
10557
|
attributes = rest;
|
|
10341
|
-
extra.push(`"style": $$b.vars(${
|
|
10558
|
+
extra.push(`"style": $$b.vars(${variableCode}, ${existing})`);
|
|
10342
10559
|
}
|
|
10343
10560
|
const refs = [];
|
|
10344
10561
|
for (const attribute of node.attributes) if (attribute.kind === "ref") refs.push(attribute);
|
|
@@ -10539,12 +10756,17 @@ var Emitter = class {
|
|
|
10539
10756
|
const anchor = fill && this.anchor(scope, block);
|
|
10540
10757
|
if (!fill || !anchor) return false;
|
|
10541
10758
|
let call;
|
|
10759
|
+
const headers = [];
|
|
10542
10760
|
if (fill.kind === "if" && block.kind === "if") {
|
|
10761
|
+
for (const branch of block.branches) headers.push(branch.condition);
|
|
10543
10762
|
let index = block.fallback ? String(block.branches.length) : "-1";
|
|
10544
10763
|
for (let at = block.branches.length - 1; at >= 0; at--) index = `${this.expression(block.branches[at].condition)} ? ${at} : ${index}`;
|
|
10545
10764
|
call = `$$b.fillBranch($$m, ${anchor.scope}, ${anchor.index}, ${index}, [${fill.renders.join(", ")}])`;
|
|
10546
|
-
} else if (fill.kind === "for" && block.kind === "for")
|
|
10547
|
-
|
|
10765
|
+
} else if (fill.kind === "for" && block.kind === "for") {
|
|
10766
|
+
headers.push(block.list);
|
|
10767
|
+
call = `$$b.fillList($$m, ${anchor.scope}, ${anchor.index}, $$b.toList(${this.expression(block.list)}), ${fill.render})`;
|
|
10768
|
+
} else return false;
|
|
10769
|
+
if (this.settledMemos(headers, scope)?.pend) call = `$$b.fillPend(${anchor.scope}, () => { ${call}; })`;
|
|
10548
10770
|
this.open(scope, block, fill.kind === "if" ? "-1" : void 0);
|
|
10549
10771
|
this.end(block);
|
|
10550
10772
|
this.fills.set(`${anchor.scope}:${anchor.index}`, call);
|
|
@@ -12343,9 +12565,12 @@ var ClientGenerator = class {
|
|
|
12343
12565
|
}
|
|
12344
12566
|
if (site.kind === "style") {
|
|
12345
12567
|
let variable;
|
|
12346
|
-
for (const
|
|
12347
|
-
|
|
12348
|
-
|
|
12568
|
+
for (const block of this.plan.styles.blocks) {
|
|
12569
|
+
for (const item of block.variables) if (item.expression.ast === site.node) {
|
|
12570
|
+
variable = item;
|
|
12571
|
+
break;
|
|
12572
|
+
}
|
|
12573
|
+
if (variable) break;
|
|
12349
12574
|
}
|
|
12350
12575
|
if (variable) this.emit(`export function ${name("u")}($$s) {\n $$b.setVar($$s, ${JSON.stringify(variable.name)}, ${variableValue(variable, expression())});\n}`);
|
|
12351
12576
|
return;
|
|
@@ -12375,7 +12600,7 @@ var ClientGenerator = class {
|
|
|
12375
12600
|
if (attribute.kind === "spread" || attribute.kind === "computed") {
|
|
12376
12601
|
const own = [];
|
|
12377
12602
|
for (const item of owner.attributes) if (item.kind === "static" || item.kind === "value") own.push(item.name);
|
|
12378
|
-
|
|
12603
|
+
for (const block of this.plan.styles.bodies.get(site.scope.body ?? fileBody(this.file))?.attributes ?? []) own.push(block.attribute);
|
|
12379
12604
|
const spreads = this.spreadCode(owner, attribute);
|
|
12380
12605
|
for (const item of owner.attributes) {
|
|
12381
12606
|
if (item.kind !== "computed") continue;
|
|
@@ -12922,9 +13147,11 @@ var ClientGenerator = class {
|
|
|
12922
13147
|
function isInside(scope) {
|
|
12923
13148
|
return isWithinAny(scope, inside);
|
|
12924
13149
|
}
|
|
13150
|
+
const styled = /* @__PURE__ */ new Set();
|
|
13151
|
+
for (const scope of inside) for (const block of this.plan.styles.bodies.get(scope.body ?? fileBody(this.file))?.variables ?? []) styled.add(block.body);
|
|
12925
13152
|
const declarations = /* @__PURE__ */ new Set();
|
|
12926
13153
|
for (const site of this.model.sites) {
|
|
12927
|
-
if (!(isInside(site.scope) || site.kind === "style") || DEFERRED_SITES.has(site.kind)) continue;
|
|
13154
|
+
if (!(isInside(site.scope) || site.kind === "style" && (!site.scope.body || styled.has(site.scope.body))) || DEFERRED_SITES.has(site.kind)) continue;
|
|
12928
13155
|
for (const read of site.reads) if (!isInside(read.declaration.scope)) declarations.add(read.declaration);
|
|
12929
13156
|
}
|
|
12930
13157
|
const lines = [];
|
|
@@ -13497,6 +13724,6 @@ function inspect(source, options = {}) {
|
|
|
13497
13724
|
};
|
|
13498
13725
|
}
|
|
13499
13726
|
//#endregion
|
|
13500
|
-
export {
|
|
13727
|
+
export { analyzeProjectProps as A, isWithin as B, resolveFromDisk as C, entryClasses as D, unmarked as E, parse$1 as F, bridgeModuleId as G, resolveMacros as H, buildGraph as I, nameBridges as J, hasBridge as K, blockBodies as L, importedComponents as M, resolveRelative as N, refreshedNames as O, summarize as P, getLocation as Q, forEachNode as R, isReactiveModule as S, originalPosition as T, walk as U, lookup as V, BRIDGE_EXPORT as W, getPatternNames as X, scriptBridges as Y, BrumateError as Z, getComponentName as _, scopeLabel as a, generateShared as b, DEFAULT_MERGE as c, generateServer as d, instanceScope as f, functionId as g, createPlan as h, report as i, importSource as j, analyzeProject as k, generateClient as l, clientState as m, formatReport as n, CompileError as o, slotIndex as p, mayHaveBridge as q, inspect as r, compile as s, anchorLabel as t, generateRender as u, hash as v, builtin as w, sharedSites as x, SHARED_QUERY as y, analyze$1 as z };
|
|
13501
13728
|
|
|
13502
|
-
//# sourceMappingURL=inspect-
|
|
13729
|
+
//# sourceMappingURL=inspect-B5AoHh5O.js.map
|