@bleedingdev/modern-js-plugin-tanstack 3.9.0-ultramodern.6 → 3.9.0-ultramodern.8
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/package.json +12 -12
- package/rstest.config.mts +0 -3
- package/tests/router/cli.test.ts +85 -860
- package/tests/router/dataMutation.test.tsx +36 -0
- package/tests/router/generateRouteArtifacts.test.ts +11 -11
- package/tests/router/loaderBridge.test.ts +52 -0
- package/tests/router/prefetchLink.test.tsx +0 -16
- package/tests/router/prefetchLinkPreload.test.tsx +12 -25
- package/tests/router/routeTree.test.ts +144 -624
- package/tests/router/rsc.test.tsx +14 -31
- package/tests/router/tanstackTypes.test.ts +92 -616
- package/tests/realm-isolation.test.ts +0 -104
- package/tests/router/fixtures/rscDecoderSecurityChild.cjs +0 -162
- package/tests/router/hooks.test.ts +0 -23
- package/tests/router/rscDecoderSecurity.test.ts +0 -84
|
@@ -130,7 +130,7 @@ describe('tanstack rsc runtime helpers', () => {
|
|
|
130
130
|
).toBeUndefined();
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
-
test('redacts production TanStack RSC server payload errors', () => {
|
|
133
|
+
test('redacts production TanStack RSC server payload errors (Error, RouteErrorResponse, and plain-object)', () => {
|
|
134
134
|
const routeError = new ErrorResponseImpl(
|
|
135
135
|
500,
|
|
136
136
|
'secret status text',
|
|
@@ -165,6 +165,14 @@ describe('tanstack rsc runtime helpers', () => {
|
|
|
165
165
|
},
|
|
166
166
|
routeId: '/products',
|
|
167
167
|
},
|
|
168
|
+
{
|
|
169
|
+
error: { message: 'plain secret', token: 'token secret' },
|
|
170
|
+
params: {},
|
|
171
|
+
pathname: '/plain',
|
|
172
|
+
pathnameBase: '/plain',
|
|
173
|
+
route: { id: '/plain', parentRoute: { id: '__root__' } },
|
|
174
|
+
routeId: '/plain',
|
|
175
|
+
},
|
|
168
176
|
],
|
|
169
177
|
},
|
|
170
178
|
}),
|
|
@@ -182,44 +190,21 @@ describe('tanstack rsc runtime helpers', () => {
|
|
|
182
190
|
data: 'Unexpected Server Error',
|
|
183
191
|
__type: 'RouteErrorResponse',
|
|
184
192
|
},
|
|
185
|
-
});
|
|
186
|
-
expect(JSON.stringify(payload.errors)).not.toContain('server secret');
|
|
187
|
-
expect(JSON.stringify(payload.errors)).not.toContain('route secret');
|
|
188
|
-
expect(JSON.stringify(payload.errors)).not.toContain('secret status text');
|
|
189
|
-
expect(JSON.stringify(payload.errors)).not.toContain('stack secret');
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
test('redacts production TanStack RSC non-Error server payload errors', () => {
|
|
193
|
-
const payload = withNodeEnv('production', () =>
|
|
194
|
-
createTanstackRscServerPayload({
|
|
195
|
-
state: {
|
|
196
|
-
location: { href: '/plain' },
|
|
197
|
-
matches: [
|
|
198
|
-
{
|
|
199
|
-
error: { message: 'plain secret', token: 'token secret' },
|
|
200
|
-
params: {},
|
|
201
|
-
pathname: '/plain',
|
|
202
|
-
pathnameBase: '/plain',
|
|
203
|
-
route: { id: '/plain' },
|
|
204
|
-
routeId: '/plain',
|
|
205
|
-
},
|
|
206
|
-
],
|
|
207
|
-
},
|
|
208
|
-
}),
|
|
209
|
-
);
|
|
210
|
-
|
|
211
|
-
expect(payload.errors).toMatchObject({
|
|
212
193
|
'/plain': {
|
|
213
194
|
message: 'Unexpected Server Error',
|
|
214
195
|
stack: undefined,
|
|
215
196
|
__type: 'Error',
|
|
216
197
|
},
|
|
217
198
|
});
|
|
199
|
+
expect(JSON.stringify(payload.errors)).not.toContain('server secret');
|
|
200
|
+
expect(JSON.stringify(payload.errors)).not.toContain('route secret');
|
|
201
|
+
expect(JSON.stringify(payload.errors)).not.toContain('secret status text');
|
|
202
|
+
expect(JSON.stringify(payload.errors)).not.toContain('stack secret');
|
|
218
203
|
expect(JSON.stringify(payload.errors)).not.toContain('plain secret');
|
|
219
204
|
expect(JSON.stringify(payload.errors)).not.toContain('token secret');
|
|
220
205
|
});
|
|
221
206
|
|
|
222
|
-
test('
|
|
207
|
+
test('preserves RSC redirect response status and headers in TanStack redirects', async () => {
|
|
223
208
|
const scenarios = [
|
|
224
209
|
{ location: '/base', name: 'exact basename', redirect: '/' },
|
|
225
210
|
{
|
|
@@ -252,9 +237,7 @@ describe('tanstack rsc runtime helpers', () => {
|
|
|
252
237
|
);
|
|
253
238
|
expect(response.headers.get('X-Trace')).toBe(scenario.name);
|
|
254
239
|
}
|
|
255
|
-
});
|
|
256
240
|
|
|
257
|
-
test('preserves RSC redirect response status and headers in TanStack redirects', async () => {
|
|
258
241
|
rstest.stubGlobal(
|
|
259
242
|
'fetch',
|
|
260
243
|
rstest.fn(() =>
|