@bleedingdev/modern-js-plugin-tanstack 3.9.0-ultramodern.6 → 3.9.0-ultramodern.7

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.
@@ -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('normalizes redirect basenames while preserving status and headers', () => {
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(() =>