ripple 0.3.72 → 0.3.74
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 +66 -0
- package/package.json +3 -3
- package/src/jsx-runtime.d.ts +2 -8
- package/src/runtime/index-client.js +3 -13
- package/src/runtime/internal/client/blocks.js +3 -25
- package/src/runtime/internal/client/for.js +80 -5
- package/src/runtime/internal/client/index.js +0 -2
- package/src/runtime/internal/client/types.d.ts +0 -10
- package/tests/client/__snapshots__/computed-properties.test.tsrx.snap +8 -0
- package/tests/client/__snapshots__/for.test.tsrx.snap +22 -0
- package/tests/client/__snapshots__/html.test.tsrx.snap +4 -0
- package/tests/client/array/array.copy-within.test.tsrx +19 -19
- package/tests/client/array/array.derived.test.tsrx +97 -109
- package/tests/client/array/array.iteration.test.tsrx +28 -28
- package/tests/client/array/array.mutations.test.tsrx +68 -68
- package/tests/client/array/array.static.test.tsrx +82 -92
- package/tests/client/array/array.to-methods.test.tsrx +15 -15
- package/tests/client/async-suspend.test.tsrx +180 -179
- package/tests/client/basic/__snapshots__/basic.attributes.test.tsrx.snap +2 -0
- package/tests/client/basic/__snapshots__/basic.rendering.test.tsrx.snap +4 -0
- package/tests/client/basic/basic.attributes.test.tsrx +273 -317
- package/tests/client/basic/basic.collections.test.tsrx +55 -61
- package/tests/client/basic/basic.components.test.tsrx +196 -218
- package/tests/client/basic/basic.errors.test.tsrx +70 -76
- package/tests/client/basic/basic.events.test.tsrx +80 -85
- package/tests/client/basic/basic.get-set.test.tsrx +54 -64
- package/tests/client/basic/basic.hmr.test.tsrx +15 -19
- package/tests/client/basic/basic.reactivity.test.tsrx +121 -135
- package/tests/client/basic/basic.rendering.test.tsrx +273 -178
- package/tests/client/basic/basic.utilities.test.tsrx +8 -10
- package/tests/client/boundaries.test.tsrx +18 -18
- package/tests/client/compiler/compiler.assignments.test.tsrx +77 -76
- package/tests/client/compiler/compiler.attributes.test.tsrx +18 -14
- package/tests/client/compiler/compiler.basic.test.tsrx +357 -288
- package/tests/client/compiler/compiler.regex.test.tsrx +40 -44
- package/tests/client/compiler/compiler.tracked-access.test.tsrx +57 -38
- package/tests/client/compiler/compiler.try-in-function.test.tsrx +16 -16
- package/tests/client/compiler/compiler.typescript.test.tsrx +4 -3
- package/tests/client/composite/composite.dynamic-components.test.tsrx +41 -44
- package/tests/client/composite/composite.generics.test.tsrx +165 -167
- package/tests/client/composite/composite.props.test.tsrx +66 -74
- package/tests/client/composite/composite.reactivity.test.tsrx +132 -166
- package/tests/client/composite/composite.render.test.tsrx +92 -101
- package/tests/client/computed-properties.test.tsrx +14 -18
- package/tests/client/context.test.tsrx +14 -18
- package/tests/client/css/global-additional-cases.test.tsrx +491 -437
- package/tests/client/css/global-advanced-selectors.test.tsrx +169 -153
- package/tests/client/css/global-at-rules.test.tsrx +71 -66
- package/tests/client/css/global-basic.test.tsrx +105 -98
- package/tests/client/css/global-classes-ids.test.tsrx +128 -114
- package/tests/client/css/global-combinators.test.tsrx +83 -78
- package/tests/client/css/global-complex-nesting.test.tsrx +134 -120
- package/tests/client/css/global-edge-cases.test.tsrx +138 -120
- package/tests/client/css/global-keyframes.test.tsrx +108 -96
- package/tests/client/css/global-nested.test.tsrx +88 -78
- package/tests/client/css/global-pseudo.test.tsrx +104 -98
- package/tests/client/css/global-scoping.test.tsrx +145 -125
- package/tests/client/css/style-identifier.test.tsrx +62 -69
- package/tests/client/date.test.tsrx +83 -83
- package/tests/client/dynamic-elements.test.tsrx +227 -283
- package/tests/client/events.test.tsrx +252 -266
- package/tests/client/for.test.tsrx +120 -127
- package/tests/client/head.test.tsrx +40 -48
- package/tests/client/html.test.tsrx +37 -49
- package/tests/client/input-value.test.tsrx +1125 -1354
- package/tests/client/lazy-array.test.tsrx +10 -16
- package/tests/client/lazy-destructuring.test.tsrx +169 -221
- package/tests/client/map.test.tsrx +39 -41
- package/tests/client/media-query.test.tsrx +15 -19
- package/tests/client/object.test.tsrx +46 -56
- package/tests/client/portal.test.tsrx +31 -37
- package/tests/client/ref.test.tsrx +173 -193
- package/tests/client/return.test.tsrx +62 -37
- package/tests/client/set.test.tsrx +33 -33
- package/tests/client/svg.test.tsrx +195 -215
- package/tests/client/switch.test.tsrx +201 -191
- package/tests/client/track-async-hydration.test.tsrx +14 -18
- package/tests/client/tracked-index-access.test.tsrx +18 -28
- package/tests/client/try.test.tsrx +494 -619
- package/tests/client/tsx.test.tsrx +286 -292
- package/tests/client/typescript-generics.test.tsrx +121 -129
- package/tests/client/url/url.derived.test.tsrx +21 -25
- package/tests/client/url/url.parsing.test.tsrx +35 -35
- package/tests/client/url/url.partial-removal.test.tsrx +32 -32
- package/tests/client/url/url.reactivity.test.tsrx +68 -72
- package/tests/client/url/url.serialization.test.tsrx +8 -8
- package/tests/client/url-search-params/url-search-params.derived.test.tsrx +21 -27
- package/tests/client/url-search-params/url-search-params.initialization.test.tsrx +16 -16
- package/tests/client/url-search-params/url-search-params.iteration.test.tsrx +37 -37
- package/tests/client/url-search-params/url-search-params.mutation.test.tsrx +56 -60
- package/tests/client/url-search-params/url-search-params.retrieval.test.tsrx +32 -34
- package/tests/client/url-search-params/url-search-params.serialization.test.tsrx +9 -9
- package/tests/client/url-search-params/url-search-params.tracked-url.test.tsrx +10 -10
- package/tests/hydration/compiled/client/basic.js +390 -319
- package/tests/hydration/compiled/client/composite.js +52 -44
- package/tests/hydration/compiled/client/for.js +734 -604
- package/tests/hydration/compiled/client/head.js +183 -103
- package/tests/hydration/compiled/client/html.js +93 -86
- package/tests/hydration/compiled/client/if-children.js +95 -71
- package/tests/hydration/compiled/client/if.js +113 -89
- package/tests/hydration/compiled/client/mixed-control-flow.js +225 -209
- package/tests/hydration/compiled/client/nested-control-flow.js +94 -98
- package/tests/hydration/compiled/client/reactivity.js +26 -24
- package/tests/hydration/compiled/client/return.js +8 -42
- package/tests/hydration/compiled/client/switch.js +208 -173
- package/tests/hydration/compiled/client/track-async-serialization.js +176 -128
- package/tests/hydration/compiled/client/try.js +29 -21
- package/tests/hydration/compiled/server/basic.js +210 -221
- package/tests/hydration/compiled/server/composite.js +13 -14
- package/tests/hydration/compiled/server/for.js +427 -444
- package/tests/hydration/compiled/server/head.js +199 -189
- package/tests/hydration/compiled/server/html.js +33 -41
- package/tests/hydration/compiled/server/if-children.js +114 -117
- package/tests/hydration/compiled/server/if.js +77 -83
- package/tests/hydration/compiled/server/mixed-control-flow.js +145 -150
- package/tests/hydration/compiled/server/nested-control-flow.js +10 -0
- package/tests/hydration/compiled/server/reactivity.js +24 -22
- package/tests/hydration/compiled/server/return.js +6 -18
- package/tests/hydration/compiled/server/switch.js +179 -176
- package/tests/hydration/compiled/server/track-async-serialization.js +88 -70
- package/tests/hydration/compiled/server/try.js +31 -35
- package/tests/hydration/components/basic.tsrx +216 -258
- package/tests/hydration/components/composite.tsrx +32 -42
- package/tests/hydration/components/events.tsrx +81 -101
- package/tests/hydration/components/for.tsrx +270 -336
- package/tests/hydration/components/head.tsrx +43 -39
- package/tests/hydration/components/hmr.tsrx +16 -22
- package/tests/hydration/components/html-in-template.tsrx +15 -21
- package/tests/hydration/components/html.tsrx +442 -526
- package/tests/hydration/components/if-children.tsrx +107 -125
- package/tests/hydration/components/if.tsrx +68 -90
- package/tests/hydration/components/mixed-control-flow.tsrx +65 -72
- package/tests/hydration/components/nested-control-flow.tsrx +202 -216
- package/tests/hydration/components/portal.tsrx +33 -41
- package/tests/hydration/components/reactivity.tsrx +26 -34
- package/tests/hydration/components/return.tsrx +4 -6
- package/tests/hydration/components/switch.tsrx +73 -78
- package/tests/hydration/components/track-async-serialization.tsrx +83 -93
- package/tests/hydration/components/try.tsrx +37 -51
- package/tests/hydration/switch.test.js +8 -8
- package/tests/server/await.test.tsrx +3 -3
- package/tests/server/basic.attributes.test.tsrx +117 -162
- package/tests/server/basic.components.test.tsrx +163 -193
- package/tests/server/basic.test.tsrx +298 -198
- package/tests/server/compiler.test.tsrx +142 -72
- package/tests/server/composite.props.test.tsrx +54 -58
- package/tests/server/composite.test.tsrx +165 -167
- package/tests/server/context.test.tsrx +13 -17
- package/tests/server/dynamic-elements.test.tsrx +103 -135
- package/tests/server/for.test.tsrx +115 -84
- package/tests/server/head.test.tsrx +31 -31
- package/tests/server/html-nesting-validation.test.tsrx +16 -8
- package/tests/server/if.test.tsrx +49 -59
- package/tests/server/lazy-destructuring.test.tsrx +288 -366
- package/tests/server/return.test.tsrx +58 -36
- package/tests/server/streaming-ssr.test.tsrx +4 -4
- package/tests/server/style-identifier.test.tsrx +58 -66
- package/tests/server/switch.test.tsrx +89 -97
- package/tests/server/track-async-serialization.test.tsrx +85 -103
- package/tests/server/try.test.tsrx +275 -360
- package/tests/utils/ref-types.test.js +72 -0
- package/tests/utils/vite-plugin-config.test.js +41 -74
- package/types/index.d.ts +1 -0
- package/src/runtime/internal/client/compat.js +0 -40
- package/tests/utils/compiler-compat-config.test.js +0 -38
|
@@ -5,15 +5,13 @@ const TRACK_ASYNC_PUBLIC_ERROR_MESSAGE = 'An error occurred during async renderi
|
|
|
5
5
|
|
|
6
6
|
describe('trackAsync serialization (server)', () => {
|
|
7
7
|
it('serializes resolved trackAsync data as a script tag in SSR output', async () => {
|
|
8
|
-
function App() {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
</>;
|
|
8
|
+
function App() @{
|
|
9
|
+
@try {
|
|
10
|
+
let &[data] = trackAsync(() => Promise.resolve('hello world'));
|
|
11
|
+
<p class="result">{data}</p>
|
|
12
|
+
} @pending {
|
|
13
|
+
<p class="loading">{'loading...'}</p>
|
|
14
|
+
}
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
const { body } = await render(App);
|
|
@@ -24,15 +22,13 @@ describe('trackAsync serialization (server)', () => {
|
|
|
24
22
|
});
|
|
25
23
|
|
|
26
24
|
it('serializes numeric trackAsync data correctly', async () => {
|
|
27
|
-
function App() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
</>;
|
|
25
|
+
function App() @{
|
|
26
|
+
@try {
|
|
27
|
+
let &[count] = trackAsync(() => Promise.resolve(42));
|
|
28
|
+
<span class="count">{count}</span>
|
|
29
|
+
} @pending {
|
|
30
|
+
<span>{'...'}</span>
|
|
31
|
+
}
|
|
36
32
|
}
|
|
37
33
|
|
|
38
34
|
const { body } = await render(App);
|
|
@@ -41,15 +37,13 @@ describe('trackAsync serialization (server)', () => {
|
|
|
41
37
|
});
|
|
42
38
|
|
|
43
39
|
it('serializes object trackAsync data correctly', async () => {
|
|
44
|
-
function App() {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
</>;
|
|
40
|
+
function App() @{
|
|
41
|
+
@try {
|
|
42
|
+
let &[data] = trackAsync(() => Promise.resolve({ name: 'Alice', age: 30 }));
|
|
43
|
+
<p>{data.name}</p>
|
|
44
|
+
} @pending {
|
|
45
|
+
<p>{'...'}</p>
|
|
46
|
+
}
|
|
53
47
|
}
|
|
54
48
|
|
|
55
49
|
const { body } = await render(App);
|
|
@@ -58,19 +52,17 @@ describe('trackAsync serialization (server)', () => {
|
|
|
58
52
|
});
|
|
59
53
|
|
|
60
54
|
it('serializes array trackAsync data correctly', async () => {
|
|
61
|
-
function App() {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
</>;
|
|
55
|
+
function App() @{
|
|
56
|
+
@try {
|
|
57
|
+
let &[items] = trackAsync(() => Promise.resolve(['a', 'b', 'c']));
|
|
58
|
+
<ul>
|
|
59
|
+
@for (let item of items) {
|
|
60
|
+
<li>{item}</li>
|
|
61
|
+
}
|
|
62
|
+
</ul>
|
|
63
|
+
} @pending {
|
|
64
|
+
<p>{'...'}</p>
|
|
65
|
+
}
|
|
74
66
|
}
|
|
75
67
|
|
|
76
68
|
const { body } = await render(App);
|
|
@@ -79,17 +71,15 @@ describe('trackAsync serialization (server)', () => {
|
|
|
79
71
|
});
|
|
80
72
|
|
|
81
73
|
it('serializes rejected trackAsync as error envelope', async () => {
|
|
82
|
-
function App() {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
</>;
|
|
74
|
+
function App() @{
|
|
75
|
+
@try {
|
|
76
|
+
let &[data] = trackAsync(() => Promise.reject(new Error('fetch failed')));
|
|
77
|
+
<p class="result">{data}</p>
|
|
78
|
+
} @pending {
|
|
79
|
+
<p class="loading">{'loading...'}</p>
|
|
80
|
+
} @catch (e) {
|
|
81
|
+
<p class="error">{(e as Error).message}</p>
|
|
82
|
+
}
|
|
93
83
|
}
|
|
94
84
|
|
|
95
85
|
const { body } = await render(App);
|
|
@@ -101,25 +91,21 @@ describe('trackAsync serialization (server)', () => {
|
|
|
101
91
|
});
|
|
102
92
|
|
|
103
93
|
it('serializes error when child component error bubbles to parent catch', async () => {
|
|
104
|
-
function Child() {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
</>;
|
|
94
|
+
function Child() @{
|
|
95
|
+
@try {
|
|
96
|
+
let &[data] = trackAsync(() => Promise.reject(new Error('child error')));
|
|
97
|
+
<p class="result">{data}</p>
|
|
98
|
+
} @pending {
|
|
99
|
+
<p class="pending">{'loading...'}</p>
|
|
100
|
+
}
|
|
113
101
|
}
|
|
114
102
|
|
|
115
|
-
function Parent() {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
</>;
|
|
103
|
+
function Parent() @{
|
|
104
|
+
@try {
|
|
105
|
+
<Child />
|
|
106
|
+
} @catch (e) {
|
|
107
|
+
<p class="parent-error">{(e as Error).message}</p>
|
|
108
|
+
}
|
|
123
109
|
}
|
|
124
110
|
|
|
125
111
|
const { body } = await render(Parent);
|
|
@@ -131,19 +117,17 @@ describe('trackAsync serialization (server)', () => {
|
|
|
131
117
|
});
|
|
132
118
|
|
|
133
119
|
it('serializes sync trackAsync throw using original cause message', async () => {
|
|
134
|
-
function App() {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
</>;
|
|
120
|
+
function App() @{
|
|
121
|
+
@try {
|
|
122
|
+
let &[data] = trackAsync(() => {
|
|
123
|
+
throw new Error('sync failure');
|
|
124
|
+
});
|
|
125
|
+
<p class="result">{data}</p>
|
|
126
|
+
} @pending {
|
|
127
|
+
<p class="loading">{'loading...'}</p>
|
|
128
|
+
} @catch (e) {
|
|
129
|
+
<p class="error">{(e as Error).message}</p>
|
|
130
|
+
}
|
|
147
131
|
}
|
|
148
132
|
|
|
149
133
|
const { body } = await render(App);
|
|
@@ -156,19 +140,17 @@ describe('trackAsync serialization (server)', () => {
|
|
|
156
140
|
});
|
|
157
141
|
|
|
158
142
|
it('escapes serialized error payload to keep script tag safe', async () => {
|
|
159
|
-
function App() {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
</>;
|
|
143
|
+
function App() @{
|
|
144
|
+
@try {
|
|
145
|
+
let &[data] = trackAsync(
|
|
146
|
+
() => Promise.reject(new Error('</script><div data-injected="1">boom</div>')),
|
|
147
|
+
);
|
|
148
|
+
<p class="result">{data}</p>
|
|
149
|
+
} @pending {
|
|
150
|
+
<p class="loading">{'loading...'}</p>
|
|
151
|
+
} @catch (e) {
|
|
152
|
+
<p class="error">{(e as Error).message}</p>
|
|
153
|
+
}
|
|
172
154
|
}
|
|
173
155
|
|
|
174
156
|
const { body } = await render(App);
|
|
@@ -182,17 +164,17 @@ describe('trackAsync serialization (server)', () => {
|
|
|
182
164
|
});
|
|
183
165
|
|
|
184
166
|
it('generates unique hashes for multiple trackAsync calls', async () => {
|
|
185
|
-
function App() {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
167
|
+
function App() @{
|
|
168
|
+
@try {
|
|
169
|
+
let &[a] = trackAsync(() => Promise.resolve('first'));
|
|
170
|
+
let &[b] = trackAsync(() => Promise.resolve('second'));
|
|
171
|
+
<>
|
|
190
172
|
<p>{a}</p>
|
|
191
173
|
<p>{b}</p>
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
|
|
174
|
+
</>
|
|
175
|
+
} @pending {
|
|
176
|
+
<p>{'...'}</p>
|
|
177
|
+
}
|
|
196
178
|
}
|
|
197
179
|
|
|
198
180
|
const { body } = await render(App);
|