@cedarjs/vite 5.0.0-canary.2547 → 5.0.0-canary.2549

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.
@@ -1 +1 @@
1
- {"version":3,"file":"apiDevMiddleware.d.ts","sourceRoot":"","sources":["../src/apiDevMiddleware.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,MAAM,CAAA;AA2BrD,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,aAAa,iBAe/D;AA+GD,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,aAAa,CAAC,CAuElE;AA0BD,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,aAAa,GAAG,IAAI,CA0EhE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,KAIrB,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAoEnD;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC;IACrD,UAAU,EAAE,aAAa,CAAA;IACzB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;CACjD,CAAC,CAcD"}
1
+ {"version":3,"file":"apiDevMiddleware.d.ts","sourceRoot":"","sources":["../src/apiDevMiddleware.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAc,aAAa,EAAE,MAAM,MAAM,CAAA;AA2BrD,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,aAAa,iBAe/D;AA+GD,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,aAAa,CAAC,CAuElE;AA0BD,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,aAAa,GAAG,IAAI,CA0EhE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,KAIrB,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAoFnD;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC;IACrD,UAAU,EAAE,aAAa,CAAA;IACzB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,OAAO,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;CACjD,CAAC,CAcD"}
@@ -266,7 +266,14 @@ function createApiFetchHandler() {
266
266
  }
267
267
  const yoga = graphqlYoga;
268
268
  return getAsyncStoreInstance().run(/* @__PURE__ */ new Map(), async () => {
269
- return yoga.handle(request, { request });
269
+ try {
270
+ return await yoga.handle(request, { request });
271
+ } catch (e) {
272
+ if (!!e && typeof e === "object" && "code" in e && e.code === "ERR_STREAM_PREMATURE_CLOSE") {
273
+ return new Response(null, { status: 499 });
274
+ }
275
+ throw e;
276
+ }
270
277
  });
271
278
  }
272
279
  const match = pathname.match(/^\/([^/]+)(?:\/.*)?$/);
@@ -300,7 +300,14 @@ function createApiFetchHandler() {
300
300
  }
301
301
  const yoga = graphqlYoga;
302
302
  return (0, import_store.getAsyncStoreInstance)().run(/* @__PURE__ */ new Map(), async () => {
303
- return yoga.handle(request, { request });
303
+ try {
304
+ return await yoga.handle(request, { request });
305
+ } catch (e) {
306
+ if (!!e && typeof e === "object" && "code" in e && e.code === "ERR_STREAM_PREMATURE_CLOSE") {
307
+ return new Response(null, { status: 499 });
308
+ }
309
+ throw e;
310
+ }
304
311
  });
305
312
  }
306
313
  const match = pathname.match(/^\/([^/]+)(?:\/.*)?$/);
@@ -287,6 +287,15 @@ async function generateGraphQLModule(distPath) {
287
287
  statusText: response.statusText,
288
288
  headers: response.headers,
289
289
  })
290
+ }).catch((e) => {
291
+ if (e?.code === 'ERR_STREAM_PREMATURE_CLOSE') {
292
+ // Client disconnected while the request was being processed (e.g.,
293
+ // page navigation, tab close). Return a 499 so the runtime doesn't
294
+ // treat this as a 500.
295
+ return new Response(null, { status: 499 })
296
+ }
297
+
298
+ throw e
290
299
  })
291
300
  }
292
301
  };
@@ -254,6 +254,15 @@ async function generateGraphQLModule(distPath) {
254
254
  statusText: response.statusText,
255
255
  headers: response.headers,
256
256
  })
257
+ }).catch((e) => {
258
+ if (e?.code === 'ERR_STREAM_PREMATURE_CLOSE') {
259
+ // Client disconnected while the request was being processed (e.g.,
260
+ // page navigation, tab close). Return a 499 so the runtime doesn't
261
+ // treat this as a 500.
262
+ return new Response(null, { status: 499 })
263
+ }
264
+
265
+ throw e
257
266
  })
258
267
  }
259
268
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/vite",
3
- "version": "5.0.0-canary.2547",
3
+ "version": "5.0.0-canary.2549",
4
4
  "description": "Vite configuration package for CedarJS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -70,17 +70,17 @@
70
70
  "@babel/parser": "7.29.7",
71
71
  "@babel/traverse": "7.29.7",
72
72
  "@babel/types": "7.29.7",
73
- "@cedarjs/api": "5.0.0-canary.2547",
74
- "@cedarjs/auth": "5.0.0-canary.2547",
75
- "@cedarjs/babel-config": "5.0.0-canary.2547",
76
- "@cedarjs/context": "5.0.0-canary.2547",
77
- "@cedarjs/cookie-jar": "5.0.0-canary.2547",
78
- "@cedarjs/graphql-server": "5.0.0-canary.2547",
79
- "@cedarjs/internal": "5.0.0-canary.2547",
80
- "@cedarjs/project-config": "5.0.0-canary.2547",
81
- "@cedarjs/server-store": "5.0.0-canary.2547",
82
- "@cedarjs/testing": "5.0.0-canary.2547",
83
- "@cedarjs/web": "5.0.0-canary.2547",
73
+ "@cedarjs/api": "5.0.0-canary.2549",
74
+ "@cedarjs/auth": "5.0.0-canary.2549",
75
+ "@cedarjs/babel-config": "5.0.0-canary.2549",
76
+ "@cedarjs/context": "5.0.0-canary.2549",
77
+ "@cedarjs/cookie-jar": "5.0.0-canary.2549",
78
+ "@cedarjs/graphql-server": "5.0.0-canary.2549",
79
+ "@cedarjs/internal": "5.0.0-canary.2549",
80
+ "@cedarjs/project-config": "5.0.0-canary.2549",
81
+ "@cedarjs/server-store": "5.0.0-canary.2549",
82
+ "@cedarjs/testing": "5.0.0-canary.2549",
83
+ "@cedarjs/web": "5.0.0-canary.2549",
84
84
  "@fastify/url-data": "6.0.3",
85
85
  "@swc/core": "1.15.41",
86
86
  "@universal-deploy/store": "^0.2.1",