ripple 0.3.93 → 0.3.95

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # ripple
2
2
 
3
+ ## 0.3.95
4
+
5
+ ## 0.3.94
6
+
7
+ ### Patch Changes
8
+
9
+ - Updated dependencies
10
+ [[`78502e4`](https://github.com/Ripple-TS/ripple/commit/78502e46929df2165d288dbb2483f48e9254ef35)]:
11
+ - @tsrx/core@0.1.38
12
+ - @tsrx/ripple@0.1.39
13
+
3
14
  ## 0.3.93
4
15
 
5
16
  ### Patch Changes
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ripple is an elegant TypeScript UI framework",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.3.93",
6
+ "version": "0.3.95",
7
7
  "type": "module",
8
8
  "module": "src/runtime/index-client.js",
9
9
  "main": "src/runtime/index-client.js",
@@ -73,8 +73,8 @@
73
73
  "clsx": "^2.1.1",
74
74
  "devalue": "^5.8.1",
75
75
  "esm-env": "^1.2.2",
76
- "@tsrx/core": "0.1.37",
77
- "@tsrx/ripple": "0.1.38"
76
+ "@tsrx/core": "0.1.38",
77
+ "@tsrx/ripple": "0.1.39"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@types/estree": "^1.0.8",
@@ -206,6 +206,44 @@ describe('head elements', () => {
206
206
  }
207
207
  });
208
208
 
209
+ it('renders an inline raw-text <script> body as script text content', () => {
210
+ function App() @{
211
+ <head>
212
+ <script>
213
+ const value = 1 < 2 ? 'a' : 'b';
214
+ window.__ripple_script_test = value;
215
+ </script>
216
+ </head>
217
+ }
218
+
219
+ const added: HTMLScriptElement[] = [];
220
+ try {
221
+ render(App);
222
+ flushSync();
223
+
224
+ const inline_scripts = Array.from(
225
+ document.head.querySelectorAll('script:not([src])'),
226
+ ) as HTMLScriptElement[];
227
+
228
+ for (const node of inline_scripts) {
229
+ if (node.textContent?.includes('__ripple_script_test')) {
230
+ added.push(node);
231
+ }
232
+ }
233
+
234
+ expect(added).toHaveLength(1);
235
+ // The body is injected verbatim, including the authored indentation, so
236
+ // assert on the statements rather than the exact whitespace.
237
+ const body = added[0].textContent ?? '';
238
+ expect(body).toContain('const value = 1 < 2 ? \'a\' : \'b\';');
239
+ expect(body).toContain('window.__ripple_script_test = value;');
240
+ } finally {
241
+ for (const node of added) {
242
+ node.remove();
243
+ }
244
+ }
245
+ });
246
+
209
247
  it('renders title with conditional content', () => {
210
248
  function App() @{
211
249
  let &[showPrefix] = track(true);
@@ -113,6 +113,23 @@ describe('head elements', () => {
113
113
  expect(srcs).toEqual(['/a.js', '/b.js']);
114
114
  });
115
115
 
116
+ it('renders an inline raw-text <script> body verbatim', async () => {
117
+ function App() @{
118
+ <head>
119
+ <script>
120
+ const value = 1 < 2 ? 'a' : 'b';
121
+ </script>
122
+ </head>
123
+ }
124
+
125
+ const { head } = await render(App);
126
+
127
+ // The body is emitted verbatim (unescaped), including the authored
128
+ // indentation, so match the statement inside the tags rather than the
129
+ // exact whitespace.
130
+ expect(head).toMatch(/<script>[\s\S]*const value = 1 < 2 \? 'a' : 'b';[\s\S]*<\/script>/);
131
+ });
132
+
116
133
  it('renders title with conditional content', async () => {
117
134
  function App() @{
118
135
  let &[showPrefix] = track(true);