Skip to content

Commit cec8f95

Browse files
committed
fix(relay): expose bodyLimit option in next, react, and vue adapter types
The relay bodyLimit option was supported end-to-end (transform plugins → RelayControl → env var → Fastify) but missing from the inline relay type definitions in @domscribe/next, @domscribe/react (vite), and @domscribe/vue (vite). Users of these adapters couldn't configure bodyLimit without bypassing TypeScript. Adds bodyLimit to all three inline types and adds test coverage for bodyLimit passthrough in next, nuxt, turbopack loader, and relay-control.
1 parent db6c5ee commit cec8f95

File tree

7 files changed

+30
-5
lines changed

7 files changed

+30
-5
lines changed

packages/domscribe-next/src/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ export interface DomscribeNextOptions {
6262
* @default '127.0.0.1'
6363
*/
6464
host?: string;
65+
66+
/**
67+
* Max request body size in bytes (only used if starting).
68+
*
69+
* @default 10485760 (10 MB)
70+
*/
71+
bodyLimit?: number;
6572
};
6673

6774
/**

packages/domscribe-next/src/with-domscribe.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ describe('withDomscribe', () => {
316316
it('should pass loader options including debug, relay, overlay', () => {
317317
const result = withDomscribe({
318318
debug: true,
319-
relay: { port: 5000, host: '0.0.0.0' },
319+
relay: { port: 5000, host: '0.0.0.0', bodyLimit: 5242880 },
320320
overlay: { initialMode: 'expanded', debug: true },
321321
})({});
322322
const webpackFn = result.webpack as (
@@ -333,7 +333,7 @@ describe('withDomscribe', () => {
333333
expect(loaderEntry.options).toEqual({
334334
debug: true,
335335
enabled: true,
336-
relay: { port: 5000, host: '0.0.0.0' },
336+
relay: { port: 5000, host: '0.0.0.0', bodyLimit: 5242880 },
337337
overlay: { initialMode: 'expanded', debug: true },
338338
autoInitPath: '/resolved/@domscribe/next/auto-init',
339339
});

packages/domscribe-nuxt/src/module.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,18 @@ describe('domscribeModule', () => {
193193
const nuxt = createMockNuxt();
194194

195195
await callSetup(
196-
{ debug: false, relay: { port: 3001, host: '0.0.0.0' } },
196+
{
197+
debug: false,
198+
relay: { port: 3001, host: '0.0.0.0', bodyLimit: 5242880 },
199+
},
197200
nuxt,
198201
);
199202

200203
expect(MockRelayControl).toHaveBeenCalledWith('/test/project');
201204
expect(mockEnsureRunning).toHaveBeenCalledWith({
202205
port: 3001,
203206
host: '0.0.0.0',
207+
bodyLimit: 5242880,
204208
});
205209
});
206210

packages/domscribe-react/src/vite/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ export interface DomscribeReactPluginOptions {
3838
autoStart?: boolean;
3939
port?: number;
4040
host?: string;
41+
/**
42+
* Max request body size in bytes (only used if starting).
43+
*
44+
* @default 10485760 (10 MB)
45+
*/
46+
bodyLimit?: number;
4147
};
4248
overlay?:
4349
| boolean

packages/domscribe-relay/src/lifecycle/relay-control.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ describe('RelayControl', () => {
199199
it('should call child_process.spawn with correct arguments', () => {
200200
const control = new RelayControl('/test/workspace', { debug: true });
201201

202-
control.spawn({ port: 8080, host: '0.0.0.0' });
202+
control.spawn({ port: 8080, host: '0.0.0.0', bodyLimit: 5242880 });
203203

204204
expect(spawn).toHaveBeenCalledWith(
205205
process.execPath,
@@ -212,6 +212,7 @@ describe('RelayControl', () => {
212212
DS_WORKSPACE_ROOT: '/test/workspace',
213213
DS_RELAY_PORT: '8080',
214214
DS_RELAY_HOST: '0.0.0.0',
215+
DS_RELAY_BODY_LIMIT: '5242880',
215216
DS_DEBUG: '1',
216217
}),
217218
}),

packages/domscribe-transform/src/plugins/turbopack/turbopack.loader.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ describe('Turbopack Loader', () => {
288288
// Arrange
289289
const source = 'export function App() { return <div>Hello</div>; }';
290290
const context = createLoaderContext('/test/App.tsx', {
291-
relay: { port: 5000 },
291+
relay: { port: 5000, bodyLimit: 5242880 },
292292
});
293293
const asyncCallback = vi.fn();
294294
context.async = vi.fn(() => asyncCallback);
@@ -304,6 +304,7 @@ describe('Turbopack Loader', () => {
304304
expect(mockRelayControl.ensureRunning).toHaveBeenCalledWith({
305305
port: 5000,
306306
host: undefined,
307+
bodyLimit: 5242880,
307308
});
308309
});
309310

packages/domscribe-vue/src/vite/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ export interface DomscribeVuePluginOptions {
2828
autoStart?: boolean;
2929
port?: number;
3030
host?: string;
31+
/**
32+
* Max request body size in bytes (only used if starting).
33+
*
34+
* @default 10485760 (10 MB)
35+
*/
36+
bodyLimit?: number;
3137
};
3238
overlay?:
3339
| boolean

0 commit comments

Comments
 (0)