ripple 0.3.90 → 0.3.92

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.
@@ -17,7 +17,7 @@ describe('trackAsync serialization (server)', () => {
17
17
  const { body } = await render(App);
18
18
  expect(body).toContain('hello world');
19
19
  // Should contain a serialization script tag
20
- expect(body).toContain('__tsrx_ta_');
20
+ expect(body).toContain('__ripple_ta_');
21
21
  expect(body).toContain('type="application/json"');
22
22
  });
23
23
 
@@ -33,7 +33,7 @@ describe('trackAsync serialization (server)', () => {
33
33
 
34
34
  const { body } = await render(App);
35
35
  expect(body).toContain('42');
36
- expect(body).toContain('__tsrx_ta_');
36
+ expect(body).toContain('__ripple_ta_');
37
37
  });
38
38
 
39
39
  it('serializes object trackAsync data correctly', async () => {
@@ -48,7 +48,7 @@ describe('trackAsync serialization (server)', () => {
48
48
 
49
49
  const { body } = await render(App);
50
50
  expect(body).toContain('Alice');
51
- expect(body).toContain('__tsrx_ta_');
51
+ expect(body).toContain('__ripple_ta_');
52
52
  });
53
53
 
54
54
  it('serializes array trackAsync data correctly', async () => {
@@ -67,7 +67,7 @@ describe('trackAsync serialization (server)', () => {
67
67
 
68
68
  const { body } = await render(App);
69
69
  expect(body).toContain('<li>a</li>');
70
- expect(body).toContain('__tsrx_ta_');
70
+ expect(body).toContain('__ripple_ta_');
71
71
  });
72
72
 
73
73
  it('serializes rejected trackAsync as error envelope', async () => {
@@ -85,7 +85,7 @@ describe('trackAsync serialization (server)', () => {
85
85
  const { body } = await render(App);
86
86
  const public_message = DEV ? 'fetch failed' : TRACK_ASYNC_PUBLIC_ERROR_MESSAGE;
87
87
  expect(body).toContain(`<p class="error">${public_message}</p>`);
88
- expect(body).toContain('__tsrx_ta_');
88
+ expect(body).toContain('__ripple_ta_');
89
89
  expect(body).toContain('"ok":false');
90
90
  expect(body).toContain(`"message":"${public_message}"`);
91
91
  });
@@ -111,7 +111,7 @@ describe('trackAsync serialization (server)', () => {
111
111
  const { body } = await render(Parent);
112
112
  const public_message = DEV ? 'child error' : TRACK_ASYNC_PUBLIC_ERROR_MESSAGE;
113
113
  expect(body).toContain(`<p class="parent-error">${public_message}</p>`);
114
- expect(body).toContain('__tsrx_ta_');
114
+ expect(body).toContain('__ripple_ta_');
115
115
  expect(body).toContain('"ok":false');
116
116
  expect(body).toContain(`"message":"${public_message}"`);
117
117
  });
@@ -133,7 +133,7 @@ describe('trackAsync serialization (server)', () => {
133
133
  const { body } = await render(App);
134
134
  const public_message = DEV ? 'sync failure' : TRACK_ASYNC_PUBLIC_ERROR_MESSAGE;
135
135
  expect(body).toContain(`<p class="error">${public_message}</p>`);
136
- expect(body).toContain('__tsrx_ta_');
136
+ expect(body).toContain('__ripple_ta_');
137
137
  expect(body).toContain('"ok":false');
138
138
  expect(body).toContain(`"message":"${public_message}"`);
139
139
  expect(body).not.toContain('Error thrown during trackAsync execution');
@@ -154,7 +154,7 @@ describe('trackAsync serialization (server)', () => {
154
154
  }
155
155
 
156
156
  const { body } = await render(App);
157
- expect(body).toContain('__tsrx_ta_');
157
+ expect(body).toContain('__ripple_ta_');
158
158
  if (DEV) {
159
159
  expect(body).toContain('\\u003c/script\\u003e');
160
160
  expect(body).not.toContain(
@@ -179,7 +179,7 @@ describe('trackAsync serialization (server)', () => {
179
179
 
180
180
  const { body } = await render(App);
181
181
  // Find all script tag IDs
182
- const matches = [...body.matchAll(/id="(__tsrx_ta_[a-f0-9]+)"/g)];
182
+ const matches = [...body.matchAll(/id="(__ripple_ta_[a-f0-9]+)"/g)];
183
183
  expect(matches.length).toBe(2);
184
184
  // Hashes should be different
185
185
  expect(matches[0][1]).not.toBe(matches[1][1]);
package/types/server.d.ts CHANGED
@@ -43,12 +43,27 @@ export interface Stream {
43
43
  sink: StreamSink;
44
44
  }
45
45
 
46
+ export interface StreamTemplate {
47
+ /** Document prefix, up to (and excluding) where SSR head content belongs. */
48
+ before: string;
49
+ /** From after the SSR head content to where the SSR body belongs. */
50
+ between: string;
51
+ /** Document suffix, pushed right before the stream closes. */
52
+ after: string;
53
+ }
54
+
46
55
  export interface BaseRenderOptions {
47
56
  stream?: StreamSink;
48
57
  // defaults to true
49
58
  // set to false to add more content
50
59
  closeStream?: boolean;
51
60
  rootBoundary?: RootBoundaryOptions;
61
+ /**
62
+ * Streaming only: document scaffold emitted around the shell — `before` +
63
+ * head content + `between` + body precede the streamed chunks, `after` is
64
+ * pushed when the stream closes.
65
+ */
66
+ streamTemplate?: StreamTemplate;
52
67
  }
53
68
 
54
69
  export interface StreamingRenderOptions extends BaseRenderOptions {