@cedarjs/vite 6.0.0-canary.2813 → 6.0.0-canary.2814

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":"AASA,OAAO,KAAK,EAAsB,aAAa,EAAE,MAAM,MAAM,CAAA;AAkE7D,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,aAAa,iBAe/D;AA+GD,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,aAAa,CAAC,CAoMlE;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"}
1
+ {"version":3,"file":"apiDevMiddleware.d.ts","sourceRoot":"","sources":["../src/apiDevMiddleware.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAsB,aAAa,EAAE,MAAM,MAAM,CAAA;AA4E7D,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,aAAa,iBAe/D;AA+GD,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,aAAa,CAAC,CAoMlE;AA0BD,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,aAAa,GAAG,IAAI,CA0EhE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,KAIrB,SAAS,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CAmGnD;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"}
@@ -43,7 +43,7 @@ function resolveWithExtensions(id) {
43
43
  return id;
44
44
  }
45
45
  const LAMBDA_FUNCTIONS = {};
46
- let graphqlYoga = null;
46
+ let loadedGraphqlServer = null;
47
47
  let loadApiFunctionsInFlight = null;
48
48
  let needsReloadAfterInFlight = false;
49
49
  async function loadApiFunctions(viteServer) {
@@ -134,9 +134,9 @@ async function internalLoadApiFunctions(viteServer) {
134
134
  await Promise.all(imports);
135
135
  if (extractedGraphqlOptions) {
136
136
  const { yoga } = await createGraphQLYoga(extractedGraphqlOptions);
137
- graphqlYoga = yoga;
137
+ loadedGraphqlServer = { yoga, options: extractedGraphqlOptions };
138
138
  } else {
139
- graphqlYoga = null;
139
+ loadedGraphqlServer = null;
140
140
  }
141
141
  console.log(
142
142
  ansis.dim.italic("...Done importing in " + (Date.now() - tsImport) + " ms")
@@ -360,16 +360,22 @@ function createApiFetchHandler() {
360
360
  pathname = "/";
361
361
  }
362
362
  if (pathname === "/graphql" || pathname.startsWith("/graphql/")) {
363
- if (!graphqlYoga) {
363
+ const graphqlServer = loadedGraphqlServer;
364
+ if (!graphqlServer) {
364
365
  return new Response(
365
366
  JSON.stringify({ error: "GraphQL Yoga instance not initialized" }),
366
367
  { status: 503, headers: { "Content-Type": "application/json" } }
367
368
  );
368
369
  }
369
- const yoga = graphqlYoga;
370
370
  return getAsyncStoreInstance().run(/* @__PURE__ */ new Map(), async () => {
371
371
  try {
372
- return await yoga.handle(request, { request });
372
+ const cedarContext = await buildCedarContext(request, {
373
+ authDecoder: graphqlServer.options.authDecoder
374
+ });
375
+ return await graphqlServer.yoga.handle(request, {
376
+ request,
377
+ cedarContext
378
+ });
373
379
  } catch (e) {
374
380
  if (!!e && typeof e === "object" && "code" in e && e.code === "ERR_STREAM_PREMATURE_CLOSE") {
375
381
  return new Response(null, { status: 499 });
@@ -190,7 +190,7 @@ async function generateGraphQLModule(distPath) {
190
190
  include: ["__cedar_graphqlOptions"]
191
191
  });
192
192
  return `
193
- import { buildCedarContext, noopAuthDecoder, requestToLegacyEvent } from '@cedarjs/api/runtime';
193
+ import { buildCedarContext, requestToLegacyEvent } from '@cedarjs/api/runtime';
194
194
  import { createGraphQLYoga } from '@cedarjs/graphql-server';
195
195
 
196
196
  // Inlined bundle of ${path.basename(distPath)} (node_modules kept external)
@@ -282,7 +282,7 @@ function createGraphQLFetch(graphqlOptions) {
282
282
  return async function fetch(request) {
283
283
  const { yoga } = await getYoga();
284
284
  const cedarContext = await buildCedarContext(request, {
285
- authDecoder: graphqlOptions?.authDecoder ?? noopAuthDecoder
285
+ authDecoder: graphqlOptions?.authDecoder
286
286
  });
287
287
  const event = await requestToLegacyEvent(request, cedarContext);
288
288
  const { getAsyncStoreInstance } = await import("@cedarjs/context/dist/store");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/vite",
3
- "version": "6.0.0-canary.2813",
3
+ "version": "6.0.0-canary.2814",
4
4
  "description": "Vite configuration package for CedarJS",
5
5
  "repository": {
6
6
  "type": "git",
@@ -52,16 +52,16 @@
52
52
  "@babel/parser": "7.29.7",
53
53
  "@babel/traverse": "7.29.7",
54
54
  "@babel/types": "7.29.7",
55
- "@cedarjs/api": "6.0.0-canary.2813",
56
- "@cedarjs/api-server": "6.0.0-canary.2813",
57
- "@cedarjs/babel-config": "6.0.0-canary.2813",
58
- "@cedarjs/context": "6.0.0-canary.2813",
59
- "@cedarjs/graphql-server": "6.0.0-canary.2813",
60
- "@cedarjs/internal": "6.0.0-canary.2813",
61
- "@cedarjs/project-config": "6.0.0-canary.2813",
62
- "@cedarjs/server-store": "6.0.0-canary.2813",
63
- "@cedarjs/structure": "6.0.0-canary.2813",
64
- "@cedarjs/testing": "6.0.0-canary.2813",
55
+ "@cedarjs/api": "6.0.0-canary.2814",
56
+ "@cedarjs/api-server": "6.0.0-canary.2814",
57
+ "@cedarjs/babel-config": "6.0.0-canary.2814",
58
+ "@cedarjs/context": "6.0.0-canary.2814",
59
+ "@cedarjs/graphql-server": "6.0.0-canary.2814",
60
+ "@cedarjs/internal": "6.0.0-canary.2814",
61
+ "@cedarjs/project-config": "6.0.0-canary.2814",
62
+ "@cedarjs/server-store": "6.0.0-canary.2814",
63
+ "@cedarjs/structure": "6.0.0-canary.2814",
64
+ "@cedarjs/testing": "6.0.0-canary.2814",
65
65
  "@swc/core": "1.15.46",
66
66
  "@universal-deploy/store": "^0.2.1",
67
67
  "@universal-deploy/vite": "^0.1.9",
@@ -92,10 +92,10 @@
92
92
  "yargs-parser": "21.1.1"
93
93
  },
94
94
  "devDependencies": {
95
- "@cedarjs/auth": "6.0.0-canary.2813",
96
- "@cedarjs/framework-tools": "6.0.0-canary.2813",
97
- "@cedarjs/router": "6.0.0-canary.2813",
98
- "@cedarjs/web": "6.0.0-canary.2813",
95
+ "@cedarjs/auth": "6.0.0-canary.2814",
96
+ "@cedarjs/framework-tools": "6.0.0-canary.2814",
97
+ "@cedarjs/router": "6.0.0-canary.2814",
98
+ "@cedarjs/web": "6.0.0-canary.2814",
99
99
  "@dr.pogodin/react-helmet": "2.0.4",
100
100
  "@hyrious/esbuild-plugin-commonjs": "0.2.6",
101
101
  "@jridgewell/trace-mapping": "0.3.31",
@@ -115,9 +115,9 @@
115
115
  "vitest": "4.1.10"
116
116
  },
117
117
  "peerDependencies": {
118
- "@cedarjs/auth": "6.0.0-canary.2813",
119
- "@cedarjs/router": "6.0.0-canary.2813",
120
- "@cedarjs/web": "6.0.0-canary.2813"
118
+ "@cedarjs/auth": "6.0.0-canary.2814",
119
+ "@cedarjs/router": "6.0.0-canary.2814",
120
+ "@cedarjs/web": "6.0.0-canary.2814"
121
121
  },
122
122
  "engines": {
123
123
  "node": ">=24"