Repository navigation
Commit e1b6093
authored
fix(core): a data script in a sub-composition no longer stops every timeline (#5205)
* fix(core): a data script in a sub-composition no longer stops every timeline
A sub-composition's <script type="application/json"> was wrapped and run as
JavaScript, and because the bundle merges every composition script into one,
its parse error stopped every scene's timeline. Data scripts now stay in the
DOM as authored, and a script run that does not parse is left unmerged so a
bad script fails alone.
* fix(core): render and preview keep a broken composition script from stopping the rest
The render path's script merge had the same gap as the bundler: one script
that does not parse stopped every timeline. Both now share one parse check.
A run left unmerged, and every scene-part script, is still escaped, so a
string holding "</script>" can no longer end the script early in preview.
* refactor(core): carry the bundler's script-merge reasons in names, not comments
* fix(core): every composition path runs only the scripts a browser would
A script check now matches the browser (esbuild accepted export and top-level
await), so such a script can no longer stop every timeline. Inline template
compositions keep data scripts and run module and import map scripts as such.
A data script beside the composition root is mounted next to it, a nomodule
script never runs, and the render path merges scripts on a page with no head.
* fix(core): keep inline-template data scripts and run a script with a top-level return alone
- parsesAsScript compiles with vm.Script, so a top-level return or new.target
no longer passes as mergeable and stops every timeline.
- The bundler's inline <template id="X-template"> path asks the shared
assembly plan for its root and mounts the inert scripts authored beside it.
- nomodule only stops classic scripts; type="module" nomodule runs, as in
browsers.
* refactor(core): the inline template path reads its root id from the shared assembly plan
* fix(core): a broken composition script stays apart under Bun as well as Node
parsesAsScript now parses with acorn in script mode instead of vm.Script.
Bun 1.3's vm.Script compiles lazily and accepted any text, so the Studio dev
server merged a broken script with the rest and every timeline stopped.
acorn is already locked for parsers and lint; core now declares it.
* test(core): name the parse-check test for what it pins
* style(core): wrap the data-block comment under the line limit1 parent 5ec2dd2 commit e1b6093
13 files changed
Lines changed: 538 additions & 61 deletions
File tree
- packages
- core
- src
- compiler
- runtime
- producer/src/services
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
902 | 902 | | |
903 | 903 | | |
904 | 904 | | |
| 905 | + | |
905 | 906 | | |
906 | 907 | | |
907 | 908 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
129 | 137 | | |
130 | 138 | | |
131 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
38 | 95 | | |
39 | 96 | | |
40 | 97 | | |
| |||
136 | 193 | | |
137 | 194 | | |
138 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
139 | 199 | | |
140 | 200 | | |
141 | 201 | | |
| |||
159 | 219 | | |
160 | 220 | | |
161 | 221 | | |
162 | | - | |
163 | | - | |
164 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
165 | 225 | | |
166 | 226 | | |
167 | 227 | | |
| |||
177 | 237 | | |
178 | 238 | | |
179 | 239 | | |
| 240 | + | |
180 | 241 | | |
181 | 242 | | |
182 | 243 | | |
| |||
187 | 248 | | |
188 | 249 | | |
189 | 250 | | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
| 251 | + | |
194 | 252 | | |
195 | 253 | | |
196 | 254 | | |
197 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
198 | 260 | | |
199 | 261 | | |
200 | 262 | | |
| |||
0 commit comments