Commit f16b690
authored
release: v1.13.1 (#47)
## Summary
- Fix `String.replace` `$&` corruption when inlining JS modules — `$&`,
`` $` ``, `$'`, and `$<digits>` in module content were silently replaced
by special replacement patterns, corrupting bundled JavaScript (#46)
- Fix same corruption pattern in Twine 2 and Twine 1 HTML output
renderers
- All `.replace()` calls with user-controlled replacement strings now
use function replacements to bypass special pattern interpretation
## Changed files
- `src/modules.ts` — `modifyHead()` replacement
- `src/output-twine1.ts` — `toTwine1HTML()` and `tryReplaceComponent()`
replacements
- `src/output-twine2.ts` — `toTwine2HTML()` replacements
- `test/modules.test.ts` — regression tests for `$&`, `` $` ``, and `$'`
patterns
- `CHANGELOG.md` — v1.13.1 entry
## Test plan
- [x] Added regression test: JS module with `$&$&` is preserved verbatim
in output
- [x] Added regression test: JS module with `` $` `` and `$'` is
preserved verbatim
- [x] Verified both tests fail on unaltered code (confirmed `$&` becomes
`</head>`)
- [x] All 1216 tests pass after fix
- [x] Typecheck, format, and build all pass
release-npm
🤖 Generated with [Claude Code](https://claude.com/claude-code)5 files changed
Lines changed: 33 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
8 | 15 | | |
9 | 16 | | |
10 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
47 | | - | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
88 | 89 | | |
89 | 90 | | |
90 | 91 | | |
91 | | - | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
96 | 112 | | |
97 | 113 | | |
98 | 114 | | |
| |||
0 commit comments