houdini 1.2.21 → 1.2.23-next.0

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,3 +1,3 @@
1
1
  import type { serverAdapterFactory as createAdapter } from '../runtime/router/server';
2
2
  export declare const endpoint: string;
3
- export declare let createServerAdapter: (args: Omit<Parameters<typeof createAdapter>[0], 'on_render' | 'manifest' | 'yoga' | 'schema' | 'graphqlEndpoint'>) => ReturnType<typeof createAdapter>;
3
+ export declare let createServerAdapter: (args: Omit<Parameters<typeof createAdapter>[0], 'on_render' | 'manifest' | 'yoga' | 'schema' | 'graphqlEndpoint' | 'client'>) => ReturnType<typeof createAdapter>;
@@ -69898,7 +69898,23 @@ function withArguments(config2, node) {
69898
69898
  if (!withDirectives || withDirectives.length === 0) {
69899
69899
  return [];
69900
69900
  }
69901
- return withDirectives.flatMap((directive) => directive.arguments || []);
69901
+ return withDirectives.flatMap((directive) => removeLocKey(directive.arguments) || []);
69902
+ }
69903
+ function removeLocKey(value) {
69904
+ if (typeof value !== "object" || value === null) {
69905
+ return value;
69906
+ }
69907
+ if (Array.isArray(value)) {
69908
+ return value.map(removeLocKey);
69909
+ }
69910
+ return Object.fromEntries(
69911
+ Object.entries(value).map(([key, fieldValue]) => {
69912
+ if (key === "loc") {
69913
+ return [];
69914
+ }
69915
+ return [key, removeLocKey(fieldValue)];
69916
+ })
69917
+ );
69902
69918
  }
69903
69919
  function fragmentArguments(config2, filepath, definition) {
69904
69920
  const directives = definition.directives?.filter(
@@ -69989,6 +70005,7 @@ function collectWithArguments(config2, filepath, node, scope = {}) {
69989
70005
  }
69990
70006
  value = scope[value.name.value];
69991
70007
  }
70008
+ value.loc = void 0;
69992
70009
  args[arg.name.value] = {
69993
70010
  ...value,
69994
70011
  loc: void 0
@@ -70109,9 +70126,7 @@ function serializeValue(value) {
70109
70126
  }
70110
70127
  if (typeof value === "object" && value !== null) {
70111
70128
  return AST4.objectExpression(
70112
- Object.entries(value).filter(
70113
- ([key, value2]) => typeof value2 !== "undefined" && key !== "prev" && key !== "next"
70114
- ).map(([key, val]) => {
70129
+ Object.entries(value).filter(([key, value2]) => typeof value2 !== "undefined").map(([key, val]) => {
70115
70130
  return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
70116
70131
  })
70117
70132
  );
@@ -76161,12 +76176,12 @@ async function packageJSON(targetPath, frameworkInfo) {
76161
76176
  }
76162
76177
  packageJSON2.devDependencies = {
76163
76178
  ...packageJSON2.devDependencies,
76164
- houdini: "^1.2.21"
76179
+ houdini: "^1.2.23-next.0"
76165
76180
  };
76166
76181
  if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
76167
76182
  packageJSON2.devDependencies = {
76168
76183
  ...packageJSON2.devDependencies,
76169
- "houdini-svelte": "^1.2.21"
76184
+ "houdini-svelte": "^1.2.23-next.0"
76170
76185
  };
76171
76186
  } else {
76172
76187
  throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
@@ -69903,7 +69903,23 @@ function withArguments(config2, node) {
69903
69903
  if (!withDirectives || withDirectives.length === 0) {
69904
69904
  return [];
69905
69905
  }
69906
- return withDirectives.flatMap((directive) => directive.arguments || []);
69906
+ return withDirectives.flatMap((directive) => removeLocKey(directive.arguments) || []);
69907
+ }
69908
+ function removeLocKey(value) {
69909
+ if (typeof value !== "object" || value === null) {
69910
+ return value;
69911
+ }
69912
+ if (Array.isArray(value)) {
69913
+ return value.map(removeLocKey);
69914
+ }
69915
+ return Object.fromEntries(
69916
+ Object.entries(value).map(([key, fieldValue]) => {
69917
+ if (key === "loc") {
69918
+ return [];
69919
+ }
69920
+ return [key, removeLocKey(fieldValue)];
69921
+ })
69922
+ );
69907
69923
  }
69908
69924
  function fragmentArguments(config2, filepath, definition) {
69909
69925
  const directives = definition.directives?.filter(
@@ -69994,6 +70010,7 @@ function collectWithArguments(config2, filepath, node, scope = {}) {
69994
70010
  }
69995
70011
  value = scope[value.name.value];
69996
70012
  }
70013
+ value.loc = void 0;
69997
70014
  args[arg.name.value] = {
69998
70015
  ...value,
69999
70016
  loc: void 0
@@ -70114,9 +70131,7 @@ function serializeValue(value) {
70114
70131
  }
70115
70132
  if (typeof value === "object" && value !== null) {
70116
70133
  return AST4.objectExpression(
70117
- Object.entries(value).filter(
70118
- ([key, value2]) => typeof value2 !== "undefined" && key !== "prev" && key !== "next"
70119
- ).map(([key, val]) => {
70134
+ Object.entries(value).filter(([key, value2]) => typeof value2 !== "undefined").map(([key, val]) => {
70120
70135
  return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
70121
70136
  })
70122
70137
  );
@@ -76166,12 +76181,12 @@ async function packageJSON(targetPath, frameworkInfo) {
76166
76181
  }
76167
76182
  packageJSON2.devDependencies = {
76168
76183
  ...packageJSON2.devDependencies,
76169
- houdini: "^1.2.21"
76184
+ houdini: "^1.2.23-next.0"
76170
76185
  };
76171
76186
  if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
76172
76187
  packageJSON2.devDependencies = {
76173
76188
  ...packageJSON2.devDependencies,
76174
- "houdini-svelte": "^1.2.21"
76189
+ "houdini-svelte": "^1.2.23-next.0"
76175
76190
  };
76176
76191
  } else {
76177
76192
  throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
@@ -1,5 +1,5 @@
1
1
  import * as graphql from 'graphql';
2
- import type { Config, Document, ValueMap } from '../../lib';
2
+ import { type Config, type Document, type ValueMap } from '../../lib';
3
3
  export default function fragmentVariables(config: Config, documents: Document[]): Promise<void>;
4
4
  export declare function withArguments(config: Config, node: graphql.FragmentSpreadNode): graphql.ArgumentNode[];
5
5
  export type FragmentArgument = {
@@ -58339,7 +58339,23 @@ function withArguments(config2, node) {
58339
58339
  if (!withDirectives || withDirectives.length === 0) {
58340
58340
  return [];
58341
58341
  }
58342
- return withDirectives.flatMap((directive) => directive.arguments || []);
58342
+ return withDirectives.flatMap((directive) => removeLocKey(directive.arguments) || []);
58343
+ }
58344
+ function removeLocKey(value) {
58345
+ if (typeof value !== "object" || value === null) {
58346
+ return value;
58347
+ }
58348
+ if (Array.isArray(value)) {
58349
+ return value.map(removeLocKey);
58350
+ }
58351
+ return Object.fromEntries(
58352
+ Object.entries(value).map(([key, fieldValue]) => {
58353
+ if (key === "loc") {
58354
+ return [];
58355
+ }
58356
+ return [key, removeLocKey(fieldValue)];
58357
+ })
58358
+ );
58343
58359
  }
58344
58360
  function fragmentArguments(config2, filepath, definition) {
58345
58361
  const directives = definition.directives?.filter(
@@ -58430,6 +58446,7 @@ function collectWithArguments(config2, filepath, node, scope = {}) {
58430
58446
  }
58431
58447
  value = scope[value.name.value];
58432
58448
  }
58449
+ value.loc = void 0;
58433
58450
  args[arg.name.value] = {
58434
58451
  ...value,
58435
58452
  loc: void 0
@@ -58550,9 +58567,7 @@ function serializeValue(value) {
58550
58567
  }
58551
58568
  if (typeof value === "object" && value !== null) {
58552
58569
  return AST4.objectExpression(
58553
- Object.entries(value).filter(
58554
- ([key, value2]) => typeof value2 !== "undefined" && key !== "prev" && key !== "next"
58555
- ).map(([key, val]) => {
58570
+ Object.entries(value).filter(([key, value2]) => typeof value2 !== "undefined").map(([key, val]) => {
58556
58571
  return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
58557
58572
  })
58558
58573
  );
@@ -58338,7 +58338,23 @@ function withArguments(config2, node) {
58338
58338
  if (!withDirectives || withDirectives.length === 0) {
58339
58339
  return [];
58340
58340
  }
58341
- return withDirectives.flatMap((directive) => directive.arguments || []);
58341
+ return withDirectives.flatMap((directive) => removeLocKey(directive.arguments) || []);
58342
+ }
58343
+ function removeLocKey(value) {
58344
+ if (typeof value !== "object" || value === null) {
58345
+ return value;
58346
+ }
58347
+ if (Array.isArray(value)) {
58348
+ return value.map(removeLocKey);
58349
+ }
58350
+ return Object.fromEntries(
58351
+ Object.entries(value).map(([key, fieldValue]) => {
58352
+ if (key === "loc") {
58353
+ return [];
58354
+ }
58355
+ return [key, removeLocKey(fieldValue)];
58356
+ })
58357
+ );
58342
58358
  }
58343
58359
  function fragmentArguments(config2, filepath, definition) {
58344
58360
  const directives = definition.directives?.filter(
@@ -58429,6 +58445,7 @@ function collectWithArguments(config2, filepath, node, scope = {}) {
58429
58445
  }
58430
58446
  value = scope[value.name.value];
58431
58447
  }
58448
+ value.loc = void 0;
58432
58449
  args[arg.name.value] = {
58433
58450
  ...value,
58434
58451
  loc: void 0
@@ -58549,9 +58566,7 @@ function serializeValue(value) {
58549
58566
  }
58550
58567
  if (typeof value === "object" && value !== null) {
58551
58568
  return AST4.objectExpression(
58552
- Object.entries(value).filter(
58553
- ([key, value2]) => typeof value2 !== "undefined" && key !== "prev" && key !== "next"
58554
- ).map(([key, val]) => {
58569
+ Object.entries(value).filter(([key, value2]) => typeof value2 !== "undefined").map(([key, val]) => {
58555
58570
  return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
58556
58571
  })
58557
58572
  );
@@ -5,6 +5,7 @@ export declare function router_path(config: Config): string;
5
5
  export declare function page_entry_path(config: Config, id: string, base?: string): string;
6
6
  export declare function server_adapter_path(config: Config, base?: string): string;
7
7
  export declare function adapter_config_path(config: Config, base?: string): string;
8
+ export declare function vite_render_path(config: Config, base?: string): string;
8
9
  export declare function app_component_path(config: Config, base?: string): string;
9
10
  export declare function page_unit_path(config: Config, id: string, base?: string): string;
10
11
  export declare function layout_unit_path(config: Config, id: string, base?: string): string;
@@ -1,5 +1,7 @@
1
1
  import type * as graphql from 'graphql';
2
2
  import type { Config } from '../config';
3
+ import { ConfigFile } from '../types';
3
4
  export declare function isSecondaryBuild(): boolean;
5
+ export declare function internalRoutes(config: ConfigFile): string[];
4
6
  export declare function buildLocalSchema(config: Config): Promise<void>;
5
7
  export declare function loadLocalSchema(config: Config): Promise<graphql.GraphQLSchema>;
@@ -58628,6 +58628,7 @@ __export(lib_exports, {
58628
58628
  hashOriginal: () => hashOriginal,
58629
58629
  hashRaw: () => hashRaw,
58630
58630
  houdini_mode: () => houdini_mode,
58631
+ internalRoutes: () => internalRoutes,
58631
58632
  isPending: () => isPending,
58632
58633
  isSecondaryBuild: () => isSecondaryBuild,
58633
58634
  keyFieldsForType: () => keyFieldsForType,
@@ -68373,7 +68374,8 @@ __export(conventions_exports, {
68373
68374
  router_index_path: () => router_index_path,
68374
68375
  router_path: () => router_path,
68375
68376
  serialized_manifest_path: () => serialized_manifest_path,
68376
- server_adapter_path: () => server_adapter_path
68377
+ server_adapter_path: () => server_adapter_path,
68378
+ vite_render_path: () => vite_render_path
68377
68379
  });
68378
68380
  function router_path(config2) {
68379
68381
  return path_exports.join(base_dir(config2), "Router.jsx");
@@ -68387,6 +68389,9 @@ function server_adapter_path(config2, base) {
68387
68389
  function adapter_config_path(config2, base) {
68388
68390
  return path_exports.join(units_dir(config2, base), "render", "config.js");
68389
68391
  }
68392
+ function vite_render_path(config2, base) {
68393
+ return path_exports.join(units_dir(config2, base), "render", "vite.js");
68394
+ }
68390
68395
  function app_component_path(config2, base) {
68391
68396
  return path_exports.join(units_dir(config2, base), "render", "App.jsx");
68392
68397
  }
@@ -68703,6 +68708,13 @@ var import_node_path2 = __toESM(require("node:path"), 1);
68703
68708
  function isSecondaryBuild() {
68704
68709
  return process.env.HOUDINI_SCHEMA_BUILD === "true";
68705
68710
  }
68711
+ function internalRoutes(config2) {
68712
+ const routes = [localApiEndpoint(config2)];
68713
+ if (config2.router?.auth && "redirect" in config2.router.auth) {
68714
+ routes.push(config2.router.auth.redirect);
68715
+ }
68716
+ return routes;
68717
+ }
68706
68718
  async function buildLocalSchema(config2) {
68707
68719
  const { build } = await import("vite");
68708
68720
  process.env.HOUDINI_SCHEMA_BUILD = "true";
@@ -69028,6 +69040,7 @@ async function get_session(req, secrets) {
69028
69040
  hashOriginal,
69029
69041
  hashRaw,
69030
69042
  houdini_mode,
69043
+ internalRoutes,
69031
69044
  isPending,
69032
69045
  isSecondaryBuild,
69033
69046
  keyFieldsForType,
@@ -68296,7 +68296,8 @@ __export(conventions_exports, {
68296
68296
  router_index_path: () => router_index_path,
68297
68297
  router_path: () => router_path,
68298
68298
  serialized_manifest_path: () => serialized_manifest_path,
68299
- server_adapter_path: () => server_adapter_path
68299
+ server_adapter_path: () => server_adapter_path,
68300
+ vite_render_path: () => vite_render_path
68300
68301
  });
68301
68302
  function router_path(config2) {
68302
68303
  return path_exports.join(base_dir(config2), "Router.jsx");
@@ -68310,6 +68311,9 @@ function server_adapter_path(config2, base) {
68310
68311
  function adapter_config_path(config2, base) {
68311
68312
  return path_exports.join(units_dir(config2, base), "render", "config.js");
68312
68313
  }
68314
+ function vite_render_path(config2, base) {
68315
+ return path_exports.join(units_dir(config2, base), "render", "vite.js");
68316
+ }
68313
68317
  function app_component_path(config2, base) {
68314
68318
  return path_exports.join(units_dir(config2, base), "render", "App.jsx");
68315
68319
  }
@@ -68626,6 +68630,13 @@ import path2 from "node:path";
68626
68630
  function isSecondaryBuild() {
68627
68631
  return process.env.HOUDINI_SCHEMA_BUILD === "true";
68628
68632
  }
68633
+ function internalRoutes(config2) {
68634
+ const routes = [localApiEndpoint(config2)];
68635
+ if (config2.router?.auth && "redirect" in config2.router.auth) {
68636
+ routes.push(config2.router.auth.redirect);
68637
+ }
68638
+ return routes;
68639
+ }
68629
68640
  async function buildLocalSchema(config2) {
68630
68641
  const { build } = await import("vite");
68631
68642
  process.env.HOUDINI_SCHEMA_BUILD = "true";
@@ -68950,6 +68961,7 @@ export {
68950
68961
  hashOriginal,
68951
68962
  hashRaw,
68952
68963
  houdini_mode,
68964
+ internalRoutes,
68953
68965
  isPending,
68954
68966
  isSecondaryBuild,
68955
68967
  keyFieldsForType,
@@ -1,22 +1,22 @@
1
- /// <reference types="node" />
2
1
  import { createServerAdapter as createAdapter } from '@whatwg-node/server';
3
2
  import { type GraphQLSchema } from 'graphql';
4
3
  import { createYoga } from 'graphql-yoga';
5
- import type { IncomingMessage, ServerResponse } from 'node:http';
4
+ import type { HoudiniClient } from '../client';
6
5
  import type { RouterManifest, RouterPageManifest, YogaServerOptions } from './types';
7
- export declare const serverAdapterFactory: <ComponentType>({ schema, yoga, production, manifest, on_render, pipe, assetPrefix, }: {
8
- schema?: GraphQLSchema | null | undefined;
9
- yoga?: import("graphql-yoga").YogaServerInstance<Record<string, any>, Record<string, any>> | null | undefined;
6
+ export declare function _serverHandler<ComponentType = unknown>({ schema, yoga, client, production, manifest, graphqlEndpoint, on_render, }: {
7
+ schema?: GraphQLSchema | null;
8
+ yoga?: ReturnType<typeof createYoga> | null;
9
+ client: HoudiniClient;
10
+ production: boolean;
11
+ manifest: RouterManifest<ComponentType> | null;
10
12
  assetPrefix: string;
11
- production?: boolean | undefined;
12
- pipe?: ServerResponse<IncomingMessage> | undefined;
13
+ graphqlEndpoint: string;
13
14
  on_render: (args: {
14
15
  url: string;
15
16
  match: RouterPageManifest<ComponentType> | null;
16
- manifest: RouterManifest<unknown>;
17
+ manifest: RouterManifest<ComponentType>;
17
18
  session: App.Session;
18
- pipe?: ServerResponse<IncomingMessage> | undefined;
19
- }) => Response | Promise<Response>;
20
- manifest: RouterManifest<ComponentType> | null;
21
- } & Omit<import("graphql-yoga").YogaServerOptions<Record<string, any>, Record<string, any>>, "schema">) => ReturnType<typeof createAdapter>;
19
+ }) => Response | Promise<Response | undefined> | undefined;
20
+ } & Omit<YogaServerOptions, 'schema'>): (request: Request) => Promise<Response>;
21
+ export declare const serverAdapterFactory: (args: Parameters<typeof _serverHandler>[0]) => ReturnType<typeof createAdapter>;
22
22
  export type ServerAdapterFactory = typeof serverAdapterFactory;
@@ -1,22 +1,22 @@
1
- /// <reference types="node" />
2
1
  import { createServerAdapter as createAdapter } from '@whatwg-node/server';
3
2
  import { type GraphQLSchema } from 'graphql';
4
3
  import { createYoga } from 'graphql-yoga';
5
- import type { IncomingMessage, ServerResponse } from 'node:http';
4
+ import type { HoudiniClient } from '../client';
6
5
  import type { RouterManifest, RouterPageManifest, YogaServerOptions } from './types';
7
- export declare const serverAdapterFactory: <ComponentType>({ schema, yoga, production, manifest, on_render, pipe, assetPrefix, }: {
8
- schema?: GraphQLSchema | null | undefined;
9
- yoga?: import("graphql-yoga").YogaServerInstance<Record<string, any>, Record<string, any>> | null | undefined;
6
+ export declare function _serverHandler<ComponentType = unknown>({ schema, yoga, client, production, manifest, graphqlEndpoint, on_render, }: {
7
+ schema?: GraphQLSchema | null;
8
+ yoga?: ReturnType<typeof createYoga> | null;
9
+ client: HoudiniClient;
10
+ production: boolean;
11
+ manifest: RouterManifest<ComponentType> | null;
10
12
  assetPrefix: string;
11
- production?: boolean | undefined;
12
- pipe?: ServerResponse<IncomingMessage> | undefined;
13
+ graphqlEndpoint: string;
13
14
  on_render: (args: {
14
15
  url: string;
15
16
  match: RouterPageManifest<ComponentType> | null;
16
- manifest: RouterManifest<unknown>;
17
+ manifest: RouterManifest<ComponentType>;
17
18
  session: App.Session;
18
- pipe?: ServerResponse<IncomingMessage> | undefined;
19
- }) => Response | Promise<Response>;
20
- manifest: RouterManifest<ComponentType> | null;
21
- } & Omit<import("graphql-yoga").YogaServerOptions<Record<string, any>, Record<string, any>>, "schema">) => ReturnType<typeof createAdapter>;
19
+ }) => Response | Promise<Response | undefined> | undefined;
20
+ } & Omit<YogaServerOptions, 'schema'>): (request: Request) => Promise<Response>;
21
+ export declare const serverAdapterFactory: (args: Parameters<typeof _serverHandler>[0]) => ReturnType<typeof createAdapter>;
22
22
  export type ServerAdapterFactory = typeof serverAdapterFactory;
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,35 +15,30 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
19
  var server_exports = {};
26
20
  __export(server_exports, {
21
+ _serverHandler: () => _serverHandler,
27
22
  serverAdapterFactory: () => serverAdapterFactory
28
23
  });
29
24
  module.exports = __toCommonJS(server_exports);
30
25
  var import_server = require("@whatwg-node/server");
31
26
  var import_graphql = require("graphql");
32
27
  var import_graphql_yoga = require("graphql-yoga");
33
- var import_client = __toESM(require("../../../src/+client"), 1);
34
28
  var import_config = require("../lib/config");
35
29
  var import_match = require("./match");
36
30
  var import_session = require("./session");
37
31
  const config_file = (0, import_config.getCurrentConfig)();
38
32
  const session_keys = (0, import_config.localApiSessionKeys)(config_file);
39
- const graphqlEndpoint = (0, import_config.localApiEndpoint)(config_file);
40
- const serverAdapterFactory = ({
33
+ function _serverHandler({
41
34
  schema,
42
35
  yoga,
36
+ client,
43
37
  production,
44
38
  manifest,
45
- on_render,
46
- pipe,
47
- assetPrefix
48
- }) => {
39
+ graphqlEndpoint,
40
+ on_render
41
+ }) {
49
42
  if (schema && !yoga) {
50
43
  yoga = (0, import_graphql_yoga.createYoga)({
51
44
  schema,
@@ -54,12 +47,12 @@ const serverAdapterFactory = ({
54
47
  });
55
48
  }
56
49
  if (schema) {
57
- import_client.default.registerProxy(graphqlEndpoint, async ({ query, variables, session }) => {
50
+ client.registerProxy(graphqlEndpoint, async ({ query, variables, session }) => {
58
51
  const parsed = (0, import_graphql.parse)(query);
59
52
  return await (0, import_graphql.execute)(schema, parsed, null, session, variables);
60
53
  });
61
54
  }
62
- return (0, import_server.createServerAdapter)(async (request) => {
55
+ return async (request) => {
63
56
  if (!manifest) {
64
57
  return new Response(
65
58
  "Adapter did not provide the project's manifest. Please open an issue on github.",
@@ -84,16 +77,19 @@ const serverAdapterFactory = ({
84
77
  url,
85
78
  match,
86
79
  session: await (0, import_session.get_session)(request.headers, session_keys),
87
- manifest,
88
- pipe
80
+ manifest
89
81
  });
90
82
  if (rendered) {
91
83
  return rendered;
92
84
  }
93
85
  return new Response("404", { status: 404 });
94
- });
86
+ };
87
+ }
88
+ const serverAdapterFactory = (args) => {
89
+ return (0, import_server.createServerAdapter)(_serverHandler(args));
95
90
  };
96
91
  // Annotate the CommonJS export names for ESM import in node:
97
92
  0 && (module.exports = {
93
+ _serverHandler,
98
94
  serverAdapterFactory
99
95
  });
@@ -1,22 +1,22 @@
1
- /// <reference types="node" />
2
1
  import { createServerAdapter as createAdapter } from '@whatwg-node/server';
3
2
  import { type GraphQLSchema } from 'graphql';
4
3
  import { createYoga } from 'graphql-yoga';
5
- import type { IncomingMessage, ServerResponse } from 'node:http';
4
+ import type { HoudiniClient } from '../client';
6
5
  import type { RouterManifest, RouterPageManifest, YogaServerOptions } from './types';
7
- export declare const serverAdapterFactory: <ComponentType>({ schema, yoga, production, manifest, on_render, pipe, assetPrefix, }: {
8
- schema?: GraphQLSchema | null | undefined;
9
- yoga?: import("graphql-yoga").YogaServerInstance<Record<string, any>, Record<string, any>> | null | undefined;
6
+ export declare function _serverHandler<ComponentType = unknown>({ schema, yoga, client, production, manifest, graphqlEndpoint, on_render, }: {
7
+ schema?: GraphQLSchema | null;
8
+ yoga?: ReturnType<typeof createYoga> | null;
9
+ client: HoudiniClient;
10
+ production: boolean;
11
+ manifest: RouterManifest<ComponentType> | null;
10
12
  assetPrefix: string;
11
- production?: boolean | undefined;
12
- pipe?: ServerResponse<IncomingMessage> | undefined;
13
+ graphqlEndpoint: string;
13
14
  on_render: (args: {
14
15
  url: string;
15
16
  match: RouterPageManifest<ComponentType> | null;
16
- manifest: RouterManifest<unknown>;
17
+ manifest: RouterManifest<ComponentType>;
17
18
  session: App.Session;
18
- pipe?: ServerResponse<IncomingMessage> | undefined;
19
- }) => Response | Promise<Response>;
20
- manifest: RouterManifest<ComponentType> | null;
21
- } & Omit<import("graphql-yoga").YogaServerOptions<Record<string, any>, Record<string, any>>, "schema">) => ReturnType<typeof createAdapter>;
19
+ }) => Response | Promise<Response | undefined> | undefined;
20
+ } & Omit<YogaServerOptions, 'schema'>): (request: Request) => Promise<Response>;
21
+ export declare const serverAdapterFactory: (args: Parameters<typeof _serverHandler>[0]) => ReturnType<typeof createAdapter>;
22
22
  export type ServerAdapterFactory = typeof serverAdapterFactory;
@@ -1,22 +1,20 @@
1
1
  import { createServerAdapter as createAdapter } from "@whatwg-node/server";
2
2
  import { parse, execute } from "graphql";
3
3
  import { createYoga } from "graphql-yoga";
4
- import client from "../../../src/+client";
5
4
  import { localApiSessionKeys, localApiEndpoint, getCurrentConfig } from "../lib/config";
6
5
  import { find_match } from "./match";
7
6
  import { get_session, handle_request } from "./session";
8
7
  const config_file = getCurrentConfig();
9
8
  const session_keys = localApiSessionKeys(config_file);
10
- const graphqlEndpoint = localApiEndpoint(config_file);
11
- const serverAdapterFactory = ({
9
+ function _serverHandler({
12
10
  schema,
13
11
  yoga,
12
+ client,
14
13
  production,
15
14
  manifest,
16
- on_render,
17
- pipe,
18
- assetPrefix
19
- }) => {
15
+ graphqlEndpoint,
16
+ on_render
17
+ }) {
20
18
  if (schema && !yoga) {
21
19
  yoga = createYoga({
22
20
  schema,
@@ -30,7 +28,7 @@ const serverAdapterFactory = ({
30
28
  return await execute(schema, parsed, null, session, variables);
31
29
  });
32
30
  }
33
- return createAdapter(async (request) => {
31
+ return async (request) => {
34
32
  if (!manifest) {
35
33
  return new Response(
36
34
  "Adapter did not provide the project's manifest. Please open an issue on github.",
@@ -55,15 +53,18 @@ const serverAdapterFactory = ({
55
53
  url,
56
54
  match,
57
55
  session: await get_session(request.headers, session_keys),
58
- manifest,
59
- pipe
56
+ manifest
60
57
  });
61
58
  if (rendered) {
62
59
  return rendered;
63
60
  }
64
61
  return new Response("404", { status: 404 });
65
- });
62
+ };
63
+ }
64
+ const serverAdapterFactory = (args) => {
65
+ return createAdapter(_serverHandler(args));
66
66
  };
67
67
  export {
68
+ _serverHandler,
68
69
  serverAdapterFactory
69
70
  };
@@ -58775,7 +58775,23 @@ function withArguments(config2, node) {
58775
58775
  if (!withDirectives || withDirectives.length === 0) {
58776
58776
  return [];
58777
58777
  }
58778
- return withDirectives.flatMap((directive) => directive.arguments || []);
58778
+ return withDirectives.flatMap((directive) => removeLocKey(directive.arguments) || []);
58779
+ }
58780
+ function removeLocKey(value) {
58781
+ if (typeof value !== "object" || value === null) {
58782
+ return value;
58783
+ }
58784
+ if (Array.isArray(value)) {
58785
+ return value.map(removeLocKey);
58786
+ }
58787
+ return Object.fromEntries(
58788
+ Object.entries(value).map(([key, fieldValue]) => {
58789
+ if (key === "loc") {
58790
+ return [];
58791
+ }
58792
+ return [key, removeLocKey(fieldValue)];
58793
+ })
58794
+ );
58779
58795
  }
58780
58796
  function fragmentArguments(config2, filepath, definition) {
58781
58797
  const directives = definition.directives?.filter(
@@ -58866,6 +58882,7 @@ function collectWithArguments(config2, filepath, node, scope = {}) {
58866
58882
  }
58867
58883
  value = scope[value.name.value];
58868
58884
  }
58885
+ value.loc = void 0;
58869
58886
  args[arg.name.value] = {
58870
58887
  ...value,
58871
58888
  loc: void 0
@@ -58986,9 +59003,7 @@ function serializeValue(value) {
58986
59003
  }
58987
59004
  if (typeof value === "object" && value !== null) {
58988
59005
  return AST4.objectExpression(
58989
- Object.entries(value).filter(
58990
- ([key, value2]) => typeof value2 !== "undefined" && key !== "prev" && key !== "next"
58991
- ).map(([key, val]) => {
59006
+ Object.entries(value).filter(([key, value2]) => typeof value2 !== "undefined").map(([key, val]) => {
58992
59007
  return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
58993
59008
  })
58994
59009
  );
@@ -58771,7 +58771,23 @@ function withArguments(config2, node) {
58771
58771
  if (!withDirectives || withDirectives.length === 0) {
58772
58772
  return [];
58773
58773
  }
58774
- return withDirectives.flatMap((directive) => directive.arguments || []);
58774
+ return withDirectives.flatMap((directive) => removeLocKey(directive.arguments) || []);
58775
+ }
58776
+ function removeLocKey(value) {
58777
+ if (typeof value !== "object" || value === null) {
58778
+ return value;
58779
+ }
58780
+ if (Array.isArray(value)) {
58781
+ return value.map(removeLocKey);
58782
+ }
58783
+ return Object.fromEntries(
58784
+ Object.entries(value).map(([key, fieldValue]) => {
58785
+ if (key === "loc") {
58786
+ return [];
58787
+ }
58788
+ return [key, removeLocKey(fieldValue)];
58789
+ })
58790
+ );
58775
58791
  }
58776
58792
  function fragmentArguments(config2, filepath, definition) {
58777
58793
  const directives = definition.directives?.filter(
@@ -58862,6 +58878,7 @@ function collectWithArguments(config2, filepath, node, scope = {}) {
58862
58878
  }
58863
58879
  value = scope[value.name.value];
58864
58880
  }
58881
+ value.loc = void 0;
58865
58882
  args[arg.name.value] = {
58866
58883
  ...value,
58867
58884
  loc: void 0
@@ -58982,9 +58999,7 @@ function serializeValue(value) {
58982
58999
  }
58983
59000
  if (typeof value === "object" && value !== null) {
58984
59001
  return AST4.objectExpression(
58985
- Object.entries(value).filter(
58986
- ([key, value2]) => typeof value2 !== "undefined" && key !== "prev" && key !== "next"
58987
- ).map(([key, val]) => {
59002
+ Object.entries(value).filter(([key, value2]) => typeof value2 !== "undefined").map(([key, val]) => {
58988
59003
  return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
58989
59004
  })
58990
59005
  );
@@ -70806,7 +70806,8 @@ __export(conventions_exports, {
70806
70806
  router_index_path: () => router_index_path,
70807
70807
  router_path: () => router_path,
70808
70808
  serialized_manifest_path: () => serialized_manifest_path,
70809
- server_adapter_path: () => server_adapter_path
70809
+ server_adapter_path: () => server_adapter_path,
70810
+ vite_render_path: () => vite_render_path
70810
70811
  });
70811
70812
  function router_path(config4) {
70812
70813
  return path_exports.join(base_dir(config4), "Router.jsx");
@@ -70820,6 +70821,9 @@ function server_adapter_path(config4, base) {
70820
70821
  function adapter_config_path(config4, base) {
70821
70822
  return path_exports.join(units_dir(config4, base), "render", "config.js");
70822
70823
  }
70824
+ function vite_render_path(config4, base) {
70825
+ return path_exports.join(units_dir(config4, base), "render", "vite.js");
70826
+ }
70823
70827
  function app_component_path(config4, base) {
70824
70828
  return path_exports.join(units_dir(config4, base), "render", "App.jsx");
70825
70829
  }
@@ -71963,7 +71967,23 @@ function withArguments(config4, node) {
71963
71967
  if (!withDirectives || withDirectives.length === 0) {
71964
71968
  return [];
71965
71969
  }
71966
- return withDirectives.flatMap((directive) => directive.arguments || []);
71970
+ return withDirectives.flatMap((directive) => removeLocKey(directive.arguments) || []);
71971
+ }
71972
+ function removeLocKey(value) {
71973
+ if (typeof value !== "object" || value === null) {
71974
+ return value;
71975
+ }
71976
+ if (Array.isArray(value)) {
71977
+ return value.map(removeLocKey);
71978
+ }
71979
+ return Object.fromEntries(
71980
+ Object.entries(value).map(([key, fieldValue]) => {
71981
+ if (key === "loc") {
71982
+ return [];
71983
+ }
71984
+ return [key, removeLocKey(fieldValue)];
71985
+ })
71986
+ );
71967
71987
  }
71968
71988
  function fragmentArguments(config4, filepath, definition) {
71969
71989
  const directives = definition.directives?.filter(
@@ -72054,6 +72074,7 @@ function collectWithArguments(config4, filepath, node, scope = {}) {
72054
72074
  }
72055
72075
  value = scope[value.name.value];
72056
72076
  }
72077
+ value.loc = void 0;
72057
72078
  args[arg.name.value] = {
72058
72079
  ...value,
72059
72080
  loc: void 0
@@ -72174,9 +72195,7 @@ function serializeValue(value) {
72174
72195
  }
72175
72196
  if (typeof value === "object" && value !== null) {
72176
72197
  return AST4.objectExpression(
72177
- Object.entries(value).filter(
72178
- ([key, value2]) => typeof value2 !== "undefined" && key !== "prev" && key !== "next"
72179
- ).map(([key, val]) => {
72198
+ Object.entries(value).filter(([key, value2]) => typeof value2 !== "undefined").map(([key, val]) => {
72180
72199
  return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
72181
72200
  })
72182
72201
  );
@@ -77198,6 +77217,7 @@ function logStyled(kind, stat3, logLevel, plugin2) {
77198
77217
  var config3;
77199
77218
  var viteConfig;
77200
77219
  var viteEnv;
77220
+ var devServer = false;
77201
77221
  function Plugin(opts = {}) {
77202
77222
  return {
77203
77223
  name: "houdini",
@@ -77251,7 +77271,7 @@ function Plugin(opts = {}) {
77251
77271
  }
77252
77272
  await plugin2.vite.closeBundle.call(this);
77253
77273
  }
77254
- if (!opts.adapter) {
77274
+ if (!opts.adapter || devServer) {
77255
77275
  return;
77256
77276
  }
77257
77277
  console.log("\u{1F3A9} Generating Deployment Assets...");
@@ -77271,7 +77291,7 @@ function Plugin(opts = {}) {
77271
77291
  publicBase: viteConfig.base,
77272
77292
  outDir: config3.routerBuildDirectory,
77273
77293
  manifest,
77274
- adapterPath: "../$houdini/plugins/houdini-react/units/render/config.js"
77294
+ adapterPath: "../$houdini/plugins/houdini-react/units/render/server.js"
77275
77295
  });
77276
77296
  if (fs_exports.existsSync(path_exports.join(config3.projectRoot, "public"))) {
77277
77297
  await fs_exports.recursiveCopy(
@@ -77317,6 +77337,7 @@ function Plugin(opts = {}) {
77317
77337
  );
77318
77338
  },
77319
77339
  async configureServer(server) {
77340
+ devServer = true;
77320
77341
  for (const plugin2 of config3.plugins) {
77321
77342
  if (typeof plugin2.vite?.configureServer !== "function") {
77322
77343
  continue;
@@ -70801,7 +70801,8 @@ __export(conventions_exports, {
70801
70801
  router_index_path: () => router_index_path,
70802
70802
  router_path: () => router_path,
70803
70803
  serialized_manifest_path: () => serialized_manifest_path,
70804
- server_adapter_path: () => server_adapter_path
70804
+ server_adapter_path: () => server_adapter_path,
70805
+ vite_render_path: () => vite_render_path
70805
70806
  });
70806
70807
  function router_path(config4) {
70807
70808
  return path_exports.join(base_dir(config4), "Router.jsx");
@@ -70815,6 +70816,9 @@ function server_adapter_path(config4, base) {
70815
70816
  function adapter_config_path(config4, base) {
70816
70817
  return path_exports.join(units_dir(config4, base), "render", "config.js");
70817
70818
  }
70819
+ function vite_render_path(config4, base) {
70820
+ return path_exports.join(units_dir(config4, base), "render", "vite.js");
70821
+ }
70818
70822
  function app_component_path(config4, base) {
70819
70823
  return path_exports.join(units_dir(config4, base), "render", "App.jsx");
70820
70824
  }
@@ -71958,7 +71962,23 @@ function withArguments(config4, node) {
71958
71962
  if (!withDirectives || withDirectives.length === 0) {
71959
71963
  return [];
71960
71964
  }
71961
- return withDirectives.flatMap((directive) => directive.arguments || []);
71965
+ return withDirectives.flatMap((directive) => removeLocKey(directive.arguments) || []);
71966
+ }
71967
+ function removeLocKey(value) {
71968
+ if (typeof value !== "object" || value === null) {
71969
+ return value;
71970
+ }
71971
+ if (Array.isArray(value)) {
71972
+ return value.map(removeLocKey);
71973
+ }
71974
+ return Object.fromEntries(
71975
+ Object.entries(value).map(([key, fieldValue]) => {
71976
+ if (key === "loc") {
71977
+ return [];
71978
+ }
71979
+ return [key, removeLocKey(fieldValue)];
71980
+ })
71981
+ );
71962
71982
  }
71963
71983
  function fragmentArguments(config4, filepath, definition) {
71964
71984
  const directives = definition.directives?.filter(
@@ -72049,6 +72069,7 @@ function collectWithArguments(config4, filepath, node, scope = {}) {
72049
72069
  }
72050
72070
  value = scope[value.name.value];
72051
72071
  }
72072
+ value.loc = void 0;
72052
72073
  args[arg.name.value] = {
72053
72074
  ...value,
72054
72075
  loc: void 0
@@ -72169,9 +72190,7 @@ function serializeValue(value) {
72169
72190
  }
72170
72191
  if (typeof value === "object" && value !== null) {
72171
72192
  return AST4.objectExpression(
72172
- Object.entries(value).filter(
72173
- ([key, value2]) => typeof value2 !== "undefined" && key !== "prev" && key !== "next"
72174
- ).map(([key, val]) => {
72193
+ Object.entries(value).filter(([key, value2]) => typeof value2 !== "undefined").map(([key, val]) => {
72175
72194
  return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
72176
72195
  })
72177
72196
  );
@@ -77193,6 +77212,7 @@ function logStyled(kind, stat3, logLevel, plugin2) {
77193
77212
  var config3;
77194
77213
  var viteConfig;
77195
77214
  var viteEnv;
77215
+ var devServer = false;
77196
77216
  function Plugin(opts = {}) {
77197
77217
  return {
77198
77218
  name: "houdini",
@@ -77246,7 +77266,7 @@ function Plugin(opts = {}) {
77246
77266
  }
77247
77267
  await plugin2.vite.closeBundle.call(this);
77248
77268
  }
77249
- if (!opts.adapter) {
77269
+ if (!opts.adapter || devServer) {
77250
77270
  return;
77251
77271
  }
77252
77272
  console.log("\u{1F3A9} Generating Deployment Assets...");
@@ -77266,7 +77286,7 @@ function Plugin(opts = {}) {
77266
77286
  publicBase: viteConfig.base,
77267
77287
  outDir: config3.routerBuildDirectory,
77268
77288
  manifest,
77269
- adapterPath: "../$houdini/plugins/houdini-react/units/render/config.js"
77289
+ adapterPath: "../$houdini/plugins/houdini-react/units/render/server.js"
77270
77290
  });
77271
77291
  if (fs_exports.existsSync(path_exports.join(config3.projectRoot, "public"))) {
77272
77292
  await fs_exports.recursiveCopy(
@@ -77312,6 +77332,7 @@ function Plugin(opts = {}) {
77312
77332
  );
77313
77333
  },
77314
77334
  async configureServer(server) {
77335
+ devServer = true;
77315
77336
  for (const plugin2 of config3.plugins) {
77316
77337
  if (typeof plugin2.vite?.configureServer !== "function") {
77317
77338
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini",
3
- "version": "1.2.21",
3
+ "version": "1.2.23-next.0",
4
4
  "description": "The disappearing GraphQL clients",
5
5
  "keywords": [
6
6
  "typescript",