houdini-react 1.2.22 → 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.
@@ -75587,10 +75587,10 @@ var validateHeaderValue = typeof import_node_http.default.validateHeaderValue ==
75587
75587
  throw error;
75588
75588
  }
75589
75589
  };
75590
- var Headers = class extends URLSearchParams {
75590
+ var Headers2 = class extends URLSearchParams {
75591
75591
  constructor(init) {
75592
75592
  let result = [];
75593
- if (init instanceof Headers) {
75593
+ if (init instanceof Headers2) {
75594
75594
  const raw = init.raw();
75595
75595
  for (const [name, values] of Object.entries(raw)) {
75596
75596
  result.push(...values.map((value) => [name, value]));
@@ -75714,7 +75714,7 @@ var Headers = class extends URLSearchParams {
75714
75714
  }
75715
75715
  };
75716
75716
  Object.defineProperties(
75717
- Headers.prototype,
75717
+ Headers2.prototype,
75718
75718
  ["get", "entries", "forEach", "values"].reduce((result, property) => {
75719
75719
  result[property] = { enumerable: true };
75720
75720
  return result;
@@ -75729,7 +75729,7 @@ var Response2 = class extends Body {
75729
75729
  constructor(body = null, options = {}) {
75730
75730
  super(body, options);
75731
75731
  const status = options.status != null ? options.status : 200;
75732
- const headers = new Headers(options.headers);
75732
+ const headers = new Headers2(options.headers);
75733
75733
  if (body !== null && !headers.has("Content-Type")) {
75734
75734
  const contentType = extractContentType(body, this);
75735
75735
  if (contentType) {
@@ -75804,7 +75804,7 @@ var Response2 = class extends Body {
75804
75804
  if (body === void 0) {
75805
75805
  throw new TypeError("data is not JSON serializable");
75806
75806
  }
75807
- const headers = new Headers(init && init.headers);
75807
+ const headers = new Headers2(init && init.headers);
75808
75808
  if (!headers.has("content-type")) {
75809
75809
  headers.set("content-type", "application/json");
75810
75810
  }
@@ -75880,7 +75880,7 @@ var Request2 = class extends Body {
75880
75880
  super(inputBody, {
75881
75881
  size: init.size || input.size || 0
75882
75882
  });
75883
- const headers = new Headers(init.headers || input.headers || {});
75883
+ const headers = new Headers2(init.headers || input.headers || {});
75884
75884
  if (inputBody !== null && !headers.has("Content-Type")) {
75885
75885
  const contentType = extractContentType(inputBody, this);
75886
75886
  if (contentType) {
@@ -78630,7 +78630,8 @@ __export2(conventions_exports, {
78630
78630
  router_index_path: () => router_index_path,
78631
78631
  router_path: () => router_path,
78632
78632
  serialized_manifest_path: () => serialized_manifest_path,
78633
- server_adapter_path: () => server_adapter_path
78633
+ server_adapter_path: () => server_adapter_path,
78634
+ vite_render_path: () => vite_render_path
78634
78635
  });
78635
78636
  function router_path(config2) {
78636
78637
  return path_exports.join(base_dir(config2), "Router.jsx");
@@ -78644,6 +78645,9 @@ function server_adapter_path(config2, base) {
78644
78645
  function adapter_config_path(config2, base) {
78645
78646
  return path_exports.join(units_dir(config2, base), "render", "config.js");
78646
78647
  }
78648
+ function vite_render_path(config2, base) {
78649
+ return path_exports.join(units_dir(config2, base), "render", "vite.js");
78650
+ }
78647
78651
  function app_component_path(config2, base) {
78648
78652
  return path_exports.join(units_dir(config2, base), "render", "App.jsx");
78649
78653
  }
@@ -78954,6 +78958,13 @@ async function extractQueries(source) {
78954
78958
  function isSecondaryBuild() {
78955
78959
  return process.env.HOUDINI_SCHEMA_BUILD === "true";
78956
78960
  }
78961
+ function internalRoutes(config2) {
78962
+ const routes = [localApiEndpoint(config2)];
78963
+ if (config2.router?.auth && "redirect" in config2.router.auth) {
78964
+ routes.push(config2.router.auth.redirect);
78965
+ }
78966
+ return routes;
78967
+ }
78957
78968
  async function buildLocalSchema(config2) {
78958
78969
  const { build } = await import("vite");
78959
78970
  process.env.HOUDINI_SCHEMA_BUILD = "true";
@@ -79218,12 +79229,109 @@ async function generate_renders({
79218
79229
  manifest: manifest3
79219
79230
  }) {
79220
79231
  await fs_exports.mkdirp(path_exports.dirname(conventions_exports.server_adapter_path(config)));
79232
+ const vite_render = `
79233
+ import { renderToStream as render } from 'react-streaming/server'
79234
+
79235
+ export const renderToStream = render
79236
+ `;
79221
79237
  const app_index = `
79238
+ import { Router } from '$houdini/plugins/houdini-react/runtime'
79222
79239
  import React from 'react'
79240
+
79223
79241
  import Shell from '../../../../../src/+index'
79224
- import { Router } from '$houdini'
79225
79242
 
79226
- export default (props) => <Shell><Router {...props} /></Shell>
79243
+ export default (props) => (
79244
+ <Shell>
79245
+ <Router {...props} />
79246
+ </Shell>
79247
+ )
79248
+ `;
79249
+ let renderer = `
79250
+ import { Cache } from '$houdini/runtime/cache/cache'
79251
+ import { serverAdapterFactory, _serverHandler } from '$houdini/runtime/router/server'
79252
+ import { HoudiniClient } from '$houdini/runtime/client'
79253
+ import { renderToStream } from 'react-streaming/server'
79254
+ import React from 'react'
79255
+
79256
+ import { router_cache } from '../../runtime/routing'
79257
+ // @ts-expect-error
79258
+ import client from '../../../../../src/+client'
79259
+ // @ts-expect-error
79260
+ import App from './App'
79261
+
79262
+ export const on_render =
79263
+ ({ assetPrefix, pipe, production, documentPremable }) =>
79264
+ async ({
79265
+ url,
79266
+ match,
79267
+ session,
79268
+ manifest,
79269
+ }) => {
79270
+ // instanitate a cache we can use for this request
79271
+ const cache = new Cache({ disabled: false })
79272
+
79273
+ if (!match) {
79274
+ return new Response('not found', { status: 404 })
79275
+ }
79276
+
79277
+ const {
79278
+ readable,
79279
+ injectToStream,
79280
+ pipe: pipeTo,
79281
+ } = await renderToStream(
79282
+ React.createElement(App, {
79283
+ initialURL: url,
79284
+ cache: cache,
79285
+ session: session,
79286
+ assetPrefix: assetPrefix,
79287
+ manifest: manifest,
79288
+ ...router_cache()
79289
+ }),
79290
+ {
79291
+ userAgent: 'Vite',
79292
+ }
79293
+ )
79294
+
79295
+ // add the initial scripts to the page
79296
+ injectToStream(\`
79297
+ <script>
79298
+ window.__houdini__initial__cache__ = \${cache.serialize()};
79299
+ window.__houdini__initial__session__ = \${JSON.stringify(session)};
79300
+ <\/script>
79301
+
79302
+ \${documentPremable}
79303
+
79304
+ <!--
79305
+ add a virtual module that hydrates the client and sets up the initial pending cache.
79306
+ the dynamic extension is to support dev which sees the raw jsx, and production which sees the bundled asset
79307
+ -->
79308
+ <script type="module" src="\${assetPrefix}/pages/\${match.id}.\${production ? 'js' : 'jsx'}" async=""><\/script>
79309
+ \`)
79310
+
79311
+ if (pipeTo && pipe) {
79312
+ pipeTo(pipe)
79313
+ return true
79314
+ } else {
79315
+ return new Response(readable)
79316
+ }
79317
+ }
79318
+
79319
+ export function reactServerHandler(options) {
79320
+ return _serverHandler({
79321
+ ...options,
79322
+ client,
79323
+ on_render: on_render({ assetPrefix: options.assetPrefix, pipe: options.pipe, documentPremable: options.documentPremable }),
79324
+ })
79325
+ }
79326
+
79327
+ export default function createServerAdapter(options) {
79328
+ return serverAdapterFactory({
79329
+ client,
79330
+ production: true,
79331
+ ...options,
79332
+ on_render: on_render({ assetPrefix: options.assetPrefix }),
79333
+ })
79334
+ }
79227
79335
  `;
79228
79336
  let adapter_config = `
79229
79337
  import createAdapter from './server'
@@ -79243,73 +79351,11 @@ export default (props) => <Shell><Router {...props} /></Shell>
79243
79351
  })
79244
79352
  }
79245
79353
  `;
79246
- const server_adapter = `
79247
- import React from 'react'
79248
- import { renderToStream } from 'react-streaming/server'
79249
- import { Cache } from '$houdini/runtime/cache/cache'
79250
- import { serverAdapterFactory } from '$houdini/runtime/router/server'
79251
-
79252
- import { Router, router_cache } from '../../runtime'
79253
- import manifest from '../../runtime/manifest'
79254
- import App from './App'
79255
-
79256
- import Shell from '../../../../../src/+index'
79257
-
79258
- export default (options) => {
79259
- return serverAdapterFactory({
79260
- manifest,
79261
- ...options,
79262
- on_render: async ({url, match, session, pipe , manifest }) => {
79263
- // instanitate a cache we can use for this request
79264
- const cache = new Cache({ disabled: false })
79265
-
79266
- if (!match) {
79267
- return new Response('not found', { status: 404 })
79268
- }
79269
-
79270
- const { readable, injectToStream, pipe: pipeTo } = await renderToStream(
79271
- React.createElement(App, {
79272
- initialURL: url,
79273
- cache: cache,
79274
- session: session,
79275
- assetPrefix: options.assetPrefix,
79276
- manifest: manifest,
79277
- ...router_cache()
79278
- }),
79279
- {
79280
- userAgent: 'Vite',
79281
- }
79282
- )
79283
-
79284
- // add the initial scripts to the page
79285
- injectToStream(\`
79286
- <script>
79287
- window.__houdini__initial__cache__ = \${cache.serialize()};
79288
- window.__houdini__initial__session__ = \${JSON.stringify(session)};
79289
- <\/script>
79290
-
79291
- <!--
79292
- add a virtual module that hydrates the client and sets up the initial pending cache.
79293
- the dynamic extension is to support dev which sees the raw jsx, and production which sees the bundled asset
79294
- -->
79295
- <script type="module" src="\${options.assetPrefix}/pages/\${match.id}.\${options.production ? 'js' : 'jsx'}" async=""><\/script>
79296
- \`)
79297
-
79298
- if (pipe && pipeTo) {
79299
- // pipe the response to the client
79300
- pipeTo(pipe)
79301
- } else {
79302
- // and deliver our Response while that's running.
79303
- return new Response(readable)
79304
- }
79305
- },
79306
- })
79307
- }
79308
- `;
79309
79354
  await Promise.all([
79310
- fs_exports.writeFile(conventions_exports.server_adapter_path(config), server_adapter),
79311
79355
  fs_exports.writeFile(conventions_exports.adapter_config_path(config), adapter_config),
79312
- fs_exports.writeFile(conventions_exports.app_component_path(config), app_index)
79356
+ fs_exports.writeFile(conventions_exports.server_adapter_path(config), renderer),
79357
+ fs_exports.writeFile(conventions_exports.app_component_path(config), app_index),
79358
+ fs_exports.writeFile(conventions_exports.vite_render_path(config), vite_render)
79313
79359
  ]);
79314
79360
  }
79315
79361
 
@@ -79680,8 +79726,6 @@ var vite_default = {
79680
79726
  })
79681
79727
  }
79682
79728
 
79683
-
79684
-
79685
79729
  // hydrate the cache with the information from the initial payload
79686
79730
  window.__houdini__cache__?.hydrate(
79687
79731
  window.__houdini__initial__cache__,
@@ -79706,30 +79750,28 @@ if (window.__houdini__nav_caches__ && window.__houdini__nav_caches__.artifact_ca
79706
79750
  async configureServer(server) {
79707
79751
  await writeTsconfig(server.houdiniConfig);
79708
79752
  server.middlewares.use(async (req, res, next) => {
79753
+ if (!req.url) {
79754
+ next();
79755
+ return;
79756
+ }
79709
79757
  const { default: router_manifest } = await server.ssrLoadModule(
79710
79758
  path_exports.join(
79711
79759
  server.houdiniConfig.pluginRuntimeDirectory("houdini-react"),
79712
79760
  "manifest.js"
79713
79761
  )
79714
79762
  );
79715
- try {
79716
- const [match] = find_match(router_manifest, req.url ?? "/");
79717
- if (!match) {
79718
- throw new Error();
79719
- }
79720
- } catch {
79721
- if (req.url !== localApiEndpoint(server.houdiniConfig.configFile)) {
79722
- return next();
79723
- }
79763
+ const [match] = find_match(router_manifest, req.url);
79764
+ if (!match && !internalRoutes(server.houdiniConfig.configFile).find(
79765
+ (route) => req.url?.startsWith(route)
79766
+ )) {
79767
+ next();
79768
+ return;
79724
79769
  }
79725
79770
  const project_manifest = await load_manifest({ config: server.houdiniConfig });
79726
79771
  let schema = null;
79727
79772
  if (project_manifest.local_schema) {
79728
79773
  schema = await loadLocalSchema(server.houdiniConfig);
79729
79774
  }
79730
- const serverAdapter = (await server.ssrLoadModule(
79731
- conventions_exports.server_adapter_path(server.houdiniConfig) + "?t=" + new Date().getTime()
79732
- )).default;
79733
79775
  let yoga = null;
79734
79776
  if (project_manifest.local_yoga) {
79735
79777
  const yogaPath = path_exports.join(
@@ -79738,17 +79780,62 @@ if (window.__houdini__nav_caches__ && window.__houdini__nav_caches__.artifact_ca
79738
79780
  );
79739
79781
  yoga = await server.ssrLoadModule(yogaPath);
79740
79782
  }
79741
- await serverAdapter({
79783
+ const { reactServerHandler: serverHandler } = await server.ssrLoadModule(
79784
+ conventions_exports.server_adapter_path(server.houdiniConfig) + "?t=" + new Date().getTime()
79785
+ );
79786
+ const requestHeaders = new Headers();
79787
+ for (const header of Object.entries(req.headers ?? {})) {
79788
+ requestHeaders.set(header[0], header[1]);
79789
+ }
79790
+ const request = new Request(
79791
+ "https://localhost:5173" + req.url,
79792
+ req.method === "POST" ? {
79793
+ method: req.method,
79794
+ headers: requestHeaders,
79795
+ body: await getBody(req)
79796
+ } : void 0
79797
+ );
79798
+ for (const [key, value] of Object.entries(req.headers)) {
79799
+ request.headers.set(key, value);
79800
+ }
79801
+ const result = await serverHandler({
79742
79802
  schema,
79743
79803
  yoga,
79744
- assetPrefix: "/virtual:houdini",
79745
79804
  production: false,
79746
79805
  manifest: router_manifest,
79747
- pipe: res
79748
- })(req, res);
79806
+ graphqlEndpoint: localApiEndpoint(server.houdiniConfig.configFile),
79807
+ assetPrefix: "/virtual:houdini",
79808
+ pipe: res,
79809
+ documentPremable: `<script type="module" src="/@vite/client" async=""><\/script>`
79810
+ })(request);
79811
+ if (result && result.status === 404) {
79812
+ next();
79813
+ }
79814
+ if (result && typeof result !== "boolean") {
79815
+ if (res.closed) {
79816
+ return;
79817
+ }
79818
+ for (const header of Object.entries(result.headers ?? {})) {
79819
+ res.setHeader(header[0], header[1]);
79820
+ }
79821
+ res.write(await result.text());
79822
+ res.end();
79823
+ }
79749
79824
  });
79750
79825
  }
79751
79826
  };
79827
+ function getBody(request) {
79828
+ return new Promise((resolve2) => {
79829
+ const bodyParts = [];
79830
+ let body;
79831
+ request.on("data", (chunk) => {
79832
+ bodyParts.push(chunk);
79833
+ }).on("end", () => {
79834
+ body = Buffer.concat(bodyParts).toString();
79835
+ resolve2(body);
79836
+ });
79837
+ });
79838
+ }
79752
79839
 
79753
79840
  // src/plugin/index.ts
79754
79841
  var manifest2;
@@ -75577,10 +75577,10 @@ var validateHeaderValue = typeof http.validateHeaderValue === "function" ? http.
75577
75577
  throw error;
75578
75578
  }
75579
75579
  };
75580
- var Headers = class extends URLSearchParams {
75580
+ var Headers2 = class extends URLSearchParams {
75581
75581
  constructor(init) {
75582
75582
  let result = [];
75583
- if (init instanceof Headers) {
75583
+ if (init instanceof Headers2) {
75584
75584
  const raw = init.raw();
75585
75585
  for (const [name, values] of Object.entries(raw)) {
75586
75586
  result.push(...values.map((value) => [name, value]));
@@ -75704,7 +75704,7 @@ var Headers = class extends URLSearchParams {
75704
75704
  }
75705
75705
  };
75706
75706
  Object.defineProperties(
75707
- Headers.prototype,
75707
+ Headers2.prototype,
75708
75708
  ["get", "entries", "forEach", "values"].reduce((result, property) => {
75709
75709
  result[property] = { enumerable: true };
75710
75710
  return result;
@@ -75719,7 +75719,7 @@ var Response2 = class extends Body {
75719
75719
  constructor(body = null, options = {}) {
75720
75720
  super(body, options);
75721
75721
  const status = options.status != null ? options.status : 200;
75722
- const headers = new Headers(options.headers);
75722
+ const headers = new Headers2(options.headers);
75723
75723
  if (body !== null && !headers.has("Content-Type")) {
75724
75724
  const contentType = extractContentType(body, this);
75725
75725
  if (contentType) {
@@ -75794,7 +75794,7 @@ var Response2 = class extends Body {
75794
75794
  if (body === void 0) {
75795
75795
  throw new TypeError("data is not JSON serializable");
75796
75796
  }
75797
- const headers = new Headers(init && init.headers);
75797
+ const headers = new Headers2(init && init.headers);
75798
75798
  if (!headers.has("content-type")) {
75799
75799
  headers.set("content-type", "application/json");
75800
75800
  }
@@ -75870,7 +75870,7 @@ var Request2 = class extends Body {
75870
75870
  super(inputBody, {
75871
75871
  size: init.size || input.size || 0
75872
75872
  });
75873
- const headers = new Headers(init.headers || input.headers || {});
75873
+ const headers = new Headers2(init.headers || input.headers || {});
75874
75874
  if (inputBody !== null && !headers.has("Content-Type")) {
75875
75875
  const contentType = extractContentType(inputBody, this);
75876
75876
  if (contentType) {
@@ -78620,7 +78620,8 @@ __export(conventions_exports, {
78620
78620
  router_index_path: () => router_index_path,
78621
78621
  router_path: () => router_path,
78622
78622
  serialized_manifest_path: () => serialized_manifest_path,
78623
- server_adapter_path: () => server_adapter_path
78623
+ server_adapter_path: () => server_adapter_path,
78624
+ vite_render_path: () => vite_render_path
78624
78625
  });
78625
78626
  function router_path(config2) {
78626
78627
  return path_exports.join(base_dir(config2), "Router.jsx");
@@ -78634,6 +78635,9 @@ function server_adapter_path(config2, base) {
78634
78635
  function adapter_config_path(config2, base) {
78635
78636
  return path_exports.join(units_dir(config2, base), "render", "config.js");
78636
78637
  }
78638
+ function vite_render_path(config2, base) {
78639
+ return path_exports.join(units_dir(config2, base), "render", "vite.js");
78640
+ }
78637
78641
  function app_component_path(config2, base) {
78638
78642
  return path_exports.join(units_dir(config2, base), "render", "App.jsx");
78639
78643
  }
@@ -78944,6 +78948,13 @@ async function extractQueries(source) {
78944
78948
  function isSecondaryBuild() {
78945
78949
  return process.env.HOUDINI_SCHEMA_BUILD === "true";
78946
78950
  }
78951
+ function internalRoutes(config2) {
78952
+ const routes = [localApiEndpoint(config2)];
78953
+ if (config2.router?.auth && "redirect" in config2.router.auth) {
78954
+ routes.push(config2.router.auth.redirect);
78955
+ }
78956
+ return routes;
78957
+ }
78947
78958
  async function buildLocalSchema(config2) {
78948
78959
  const { build } = await import("vite");
78949
78960
  process.env.HOUDINI_SCHEMA_BUILD = "true";
@@ -79208,12 +79219,109 @@ async function generate_renders({
79208
79219
  manifest: manifest3
79209
79220
  }) {
79210
79221
  await fs_exports.mkdirp(path_exports.dirname(conventions_exports.server_adapter_path(config)));
79222
+ const vite_render = `
79223
+ import { renderToStream as render } from 'react-streaming/server'
79224
+
79225
+ export const renderToStream = render
79226
+ `;
79211
79227
  const app_index = `
79228
+ import { Router } from '$houdini/plugins/houdini-react/runtime'
79212
79229
  import React from 'react'
79230
+
79213
79231
  import Shell from '../../../../../src/+index'
79214
- import { Router } from '$houdini'
79215
79232
 
79216
- export default (props) => <Shell><Router {...props} /></Shell>
79233
+ export default (props) => (
79234
+ <Shell>
79235
+ <Router {...props} />
79236
+ </Shell>
79237
+ )
79238
+ `;
79239
+ let renderer = `
79240
+ import { Cache } from '$houdini/runtime/cache/cache'
79241
+ import { serverAdapterFactory, _serverHandler } from '$houdini/runtime/router/server'
79242
+ import { HoudiniClient } from '$houdini/runtime/client'
79243
+ import { renderToStream } from 'react-streaming/server'
79244
+ import React from 'react'
79245
+
79246
+ import { router_cache } from '../../runtime/routing'
79247
+ // @ts-expect-error
79248
+ import client from '../../../../../src/+client'
79249
+ // @ts-expect-error
79250
+ import App from './App'
79251
+
79252
+ export const on_render =
79253
+ ({ assetPrefix, pipe, production, documentPremable }) =>
79254
+ async ({
79255
+ url,
79256
+ match,
79257
+ session,
79258
+ manifest,
79259
+ }) => {
79260
+ // instanitate a cache we can use for this request
79261
+ const cache = new Cache({ disabled: false })
79262
+
79263
+ if (!match) {
79264
+ return new Response('not found', { status: 404 })
79265
+ }
79266
+
79267
+ const {
79268
+ readable,
79269
+ injectToStream,
79270
+ pipe: pipeTo,
79271
+ } = await renderToStream(
79272
+ React.createElement(App, {
79273
+ initialURL: url,
79274
+ cache: cache,
79275
+ session: session,
79276
+ assetPrefix: assetPrefix,
79277
+ manifest: manifest,
79278
+ ...router_cache()
79279
+ }),
79280
+ {
79281
+ userAgent: 'Vite',
79282
+ }
79283
+ )
79284
+
79285
+ // add the initial scripts to the page
79286
+ injectToStream(\`
79287
+ <script>
79288
+ window.__houdini__initial__cache__ = \${cache.serialize()};
79289
+ window.__houdini__initial__session__ = \${JSON.stringify(session)};
79290
+ <\/script>
79291
+
79292
+ \${documentPremable}
79293
+
79294
+ <!--
79295
+ add a virtual module that hydrates the client and sets up the initial pending cache.
79296
+ the dynamic extension is to support dev which sees the raw jsx, and production which sees the bundled asset
79297
+ -->
79298
+ <script type="module" src="\${assetPrefix}/pages/\${match.id}.\${production ? 'js' : 'jsx'}" async=""><\/script>
79299
+ \`)
79300
+
79301
+ if (pipeTo && pipe) {
79302
+ pipeTo(pipe)
79303
+ return true
79304
+ } else {
79305
+ return new Response(readable)
79306
+ }
79307
+ }
79308
+
79309
+ export function reactServerHandler(options) {
79310
+ return _serverHandler({
79311
+ ...options,
79312
+ client,
79313
+ on_render: on_render({ assetPrefix: options.assetPrefix, pipe: options.pipe, documentPremable: options.documentPremable }),
79314
+ })
79315
+ }
79316
+
79317
+ export default function createServerAdapter(options) {
79318
+ return serverAdapterFactory({
79319
+ client,
79320
+ production: true,
79321
+ ...options,
79322
+ on_render: on_render({ assetPrefix: options.assetPrefix }),
79323
+ })
79324
+ }
79217
79325
  `;
79218
79326
  let adapter_config = `
79219
79327
  import createAdapter from './server'
@@ -79233,73 +79341,11 @@ export default (props) => <Shell><Router {...props} /></Shell>
79233
79341
  })
79234
79342
  }
79235
79343
  `;
79236
- const server_adapter = `
79237
- import React from 'react'
79238
- import { renderToStream } from 'react-streaming/server'
79239
- import { Cache } from '$houdini/runtime/cache/cache'
79240
- import { serverAdapterFactory } from '$houdini/runtime/router/server'
79241
-
79242
- import { Router, router_cache } from '../../runtime'
79243
- import manifest from '../../runtime/manifest'
79244
- import App from './App'
79245
-
79246
- import Shell from '../../../../../src/+index'
79247
-
79248
- export default (options) => {
79249
- return serverAdapterFactory({
79250
- manifest,
79251
- ...options,
79252
- on_render: async ({url, match, session, pipe , manifest }) => {
79253
- // instanitate a cache we can use for this request
79254
- const cache = new Cache({ disabled: false })
79255
-
79256
- if (!match) {
79257
- return new Response('not found', { status: 404 })
79258
- }
79259
-
79260
- const { readable, injectToStream, pipe: pipeTo } = await renderToStream(
79261
- React.createElement(App, {
79262
- initialURL: url,
79263
- cache: cache,
79264
- session: session,
79265
- assetPrefix: options.assetPrefix,
79266
- manifest: manifest,
79267
- ...router_cache()
79268
- }),
79269
- {
79270
- userAgent: 'Vite',
79271
- }
79272
- )
79273
-
79274
- // add the initial scripts to the page
79275
- injectToStream(\`
79276
- <script>
79277
- window.__houdini__initial__cache__ = \${cache.serialize()};
79278
- window.__houdini__initial__session__ = \${JSON.stringify(session)};
79279
- <\/script>
79280
-
79281
- <!--
79282
- add a virtual module that hydrates the client and sets up the initial pending cache.
79283
- the dynamic extension is to support dev which sees the raw jsx, and production which sees the bundled asset
79284
- -->
79285
- <script type="module" src="\${options.assetPrefix}/pages/\${match.id}.\${options.production ? 'js' : 'jsx'}" async=""><\/script>
79286
- \`)
79287
-
79288
- if (pipe && pipeTo) {
79289
- // pipe the response to the client
79290
- pipeTo(pipe)
79291
- } else {
79292
- // and deliver our Response while that's running.
79293
- return new Response(readable)
79294
- }
79295
- },
79296
- })
79297
- }
79298
- `;
79299
79344
  await Promise.all([
79300
- fs_exports.writeFile(conventions_exports.server_adapter_path(config), server_adapter),
79301
79345
  fs_exports.writeFile(conventions_exports.adapter_config_path(config), adapter_config),
79302
- fs_exports.writeFile(conventions_exports.app_component_path(config), app_index)
79346
+ fs_exports.writeFile(conventions_exports.server_adapter_path(config), renderer),
79347
+ fs_exports.writeFile(conventions_exports.app_component_path(config), app_index),
79348
+ fs_exports.writeFile(conventions_exports.vite_render_path(config), vite_render)
79303
79349
  ]);
79304
79350
  }
79305
79351
 
@@ -79670,8 +79716,6 @@ var vite_default = {
79670
79716
  })
79671
79717
  }
79672
79718
 
79673
-
79674
-
79675
79719
  // hydrate the cache with the information from the initial payload
79676
79720
  window.__houdini__cache__?.hydrate(
79677
79721
  window.__houdini__initial__cache__,
@@ -79696,30 +79740,28 @@ if (window.__houdini__nav_caches__ && window.__houdini__nav_caches__.artifact_ca
79696
79740
  async configureServer(server) {
79697
79741
  await writeTsconfig(server.houdiniConfig);
79698
79742
  server.middlewares.use(async (req, res, next) => {
79743
+ if (!req.url) {
79744
+ next();
79745
+ return;
79746
+ }
79699
79747
  const { default: router_manifest } = await server.ssrLoadModule(
79700
79748
  path_exports.join(
79701
79749
  server.houdiniConfig.pluginRuntimeDirectory("houdini-react"),
79702
79750
  "manifest.js"
79703
79751
  )
79704
79752
  );
79705
- try {
79706
- const [match] = find_match(router_manifest, req.url ?? "/");
79707
- if (!match) {
79708
- throw new Error();
79709
- }
79710
- } catch {
79711
- if (req.url !== localApiEndpoint(server.houdiniConfig.configFile)) {
79712
- return next();
79713
- }
79753
+ const [match] = find_match(router_manifest, req.url);
79754
+ if (!match && !internalRoutes(server.houdiniConfig.configFile).find(
79755
+ (route) => req.url?.startsWith(route)
79756
+ )) {
79757
+ next();
79758
+ return;
79714
79759
  }
79715
79760
  const project_manifest = await load_manifest({ config: server.houdiniConfig });
79716
79761
  let schema = null;
79717
79762
  if (project_manifest.local_schema) {
79718
79763
  schema = await loadLocalSchema(server.houdiniConfig);
79719
79764
  }
79720
- const serverAdapter = (await server.ssrLoadModule(
79721
- conventions_exports.server_adapter_path(server.houdiniConfig) + "?t=" + new Date().getTime()
79722
- )).default;
79723
79765
  let yoga = null;
79724
79766
  if (project_manifest.local_yoga) {
79725
79767
  const yogaPath = path_exports.join(
@@ -79728,17 +79770,62 @@ if (window.__houdini__nav_caches__ && window.__houdini__nav_caches__.artifact_ca
79728
79770
  );
79729
79771
  yoga = await server.ssrLoadModule(yogaPath);
79730
79772
  }
79731
- await serverAdapter({
79773
+ const { reactServerHandler: serverHandler } = await server.ssrLoadModule(
79774
+ conventions_exports.server_adapter_path(server.houdiniConfig) + "?t=" + new Date().getTime()
79775
+ );
79776
+ const requestHeaders = new Headers();
79777
+ for (const header of Object.entries(req.headers ?? {})) {
79778
+ requestHeaders.set(header[0], header[1]);
79779
+ }
79780
+ const request = new Request(
79781
+ "https://localhost:5173" + req.url,
79782
+ req.method === "POST" ? {
79783
+ method: req.method,
79784
+ headers: requestHeaders,
79785
+ body: await getBody(req)
79786
+ } : void 0
79787
+ );
79788
+ for (const [key, value] of Object.entries(req.headers)) {
79789
+ request.headers.set(key, value);
79790
+ }
79791
+ const result = await serverHandler({
79732
79792
  schema,
79733
79793
  yoga,
79734
- assetPrefix: "/virtual:houdini",
79735
79794
  production: false,
79736
79795
  manifest: router_manifest,
79737
- pipe: res
79738
- })(req, res);
79796
+ graphqlEndpoint: localApiEndpoint(server.houdiniConfig.configFile),
79797
+ assetPrefix: "/virtual:houdini",
79798
+ pipe: res,
79799
+ documentPremable: `<script type="module" src="/@vite/client" async=""><\/script>`
79800
+ })(request);
79801
+ if (result && result.status === 404) {
79802
+ next();
79803
+ }
79804
+ if (result && typeof result !== "boolean") {
79805
+ if (res.closed) {
79806
+ return;
79807
+ }
79808
+ for (const header of Object.entries(result.headers ?? {})) {
79809
+ res.setHeader(header[0], header[1]);
79810
+ }
79811
+ res.write(await result.text());
79812
+ res.end();
79813
+ }
79739
79814
  });
79740
79815
  }
79741
79816
  };
79817
+ function getBody(request) {
79818
+ return new Promise((resolve2) => {
79819
+ const bodyParts = [];
79820
+ let body;
79821
+ request.on("data", (chunk) => {
79822
+ bodyParts.push(chunk);
79823
+ }).on("end", () => {
79824
+ body = Buffer.concat(bodyParts).toString();
79825
+ resolve2(body);
79826
+ });
79827
+ });
79828
+ }
79742
79829
 
79743
79830
  // src/plugin/index.ts
79744
79831
  var manifest2;
@@ -1,27 +1,10 @@
1
1
  import type { Cache } from '$houdini/runtime/cache/cache';
2
- import { DocumentStore } from '$houdini/runtime/client';
3
- import { LRUCache } from '$houdini/runtime/lib/lru';
4
- import { GraphQLObject, GraphQLVariables, QueryArtifact } from '$houdini/runtime/lib/types';
5
- import React from 'react';
6
- import { SuspenseCache, type PendingCache } from './routing';
2
+ import { RouterCache } from './routing';
7
3
  export * from './hooks';
4
+ export { router_cache } from './routing';
8
5
  export declare function Router({ cache, initialURL, artifact_cache, component_cache, data_cache, pending_cache, last_variables, session, assetPrefix, }: {
9
6
  initialURL: string;
10
7
  cache: Cache;
11
8
  session?: App.Session;
12
9
  assetPrefix: string;
13
10
  } & RouterCache): JSX.Element;
14
- type RouterCache = {
15
- artifact_cache: SuspenseCache<QueryArtifact>;
16
- component_cache: SuspenseCache<(props: any) => React.ReactElement>;
17
- data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
18
- last_variables: LRUCache<GraphQLVariables>;
19
- pending_cache: PendingCache;
20
- };
21
- export declare function router_cache({ pending_queries, artifacts, components, initialData, initialArtifacts, }?: {
22
- pending_queries?: string[];
23
- artifacts?: Record<string, QueryArtifact>;
24
- components?: Record<string, (props: any) => React.ReactElement>;
25
- initialData?: Record<string, DocumentStore<GraphQLObject, GraphQLVariables>>;
26
- initialArtifacts?: Record<string, QueryArtifact>;
27
- }): RouterCache;
@@ -49,4 +49,18 @@ export declare function updateLocalSession(session: App.Session): void;
49
49
  export declare function useSession(): App.Session;
50
50
  export declare function useCurrentVariables(): GraphQLVariables;
51
51
  export declare function useQueryResult<_Data extends GraphQLObject, _Input extends GraphQLVariables>(name: string): [_Data | null, DocumentStore<_Data, _Input>];
52
+ export type RouterCache = {
53
+ artifact_cache: SuspenseCache<QueryArtifact>;
54
+ component_cache: SuspenseCache<(props: any) => React.ReactElement>;
55
+ data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
56
+ last_variables: LRUCache<GraphQLVariables>;
57
+ pending_cache: PendingCache;
58
+ };
59
+ export declare function router_cache({ pending_queries, artifacts, components, initialData, initialArtifacts, }?: {
60
+ pending_queries?: string[];
61
+ artifacts?: Record<string, QueryArtifact>;
62
+ components?: Record<string, (props: any) => React.ReactElement>;
63
+ initialData?: Record<string, DocumentStore<GraphQLObject, GraphQLVariables>>;
64
+ initialArtifacts?: Record<string, QueryArtifact>;
65
+ }): RouterCache;
52
66
  export {};
@@ -1,27 +1,10 @@
1
1
  import type { Cache } from '$houdini/runtime/cache/cache';
2
- import { DocumentStore } from '$houdini/runtime/client';
3
- import { LRUCache } from '$houdini/runtime/lib/lru';
4
- import { GraphQLObject, GraphQLVariables, QueryArtifact } from '$houdini/runtime/lib/types';
5
- import React from 'react';
6
- import { SuspenseCache, type PendingCache } from './routing';
2
+ import { RouterCache } from './routing';
7
3
  export * from './hooks';
4
+ export { router_cache } from './routing';
8
5
  export declare function Router({ cache, initialURL, artifact_cache, component_cache, data_cache, pending_cache, last_variables, session, assetPrefix, }: {
9
6
  initialURL: string;
10
7
  cache: Cache;
11
8
  session?: App.Session;
12
9
  assetPrefix: string;
13
10
  } & RouterCache): JSX.Element;
14
- type RouterCache = {
15
- artifact_cache: SuspenseCache<QueryArtifact>;
16
- component_cache: SuspenseCache<(props: any) => React.ReactElement>;
17
- data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
18
- last_variables: LRUCache<GraphQLVariables>;
19
- pending_cache: PendingCache;
20
- };
21
- export declare function router_cache({ pending_queries, artifacts, components, initialData, initialArtifacts, }?: {
22
- pending_queries?: string[];
23
- artifacts?: Record<string, QueryArtifact>;
24
- components?: Record<string, (props: any) => React.ReactElement>;
25
- initialData?: Record<string, DocumentStore<GraphQLObject, GraphQLVariables>>;
26
- initialArtifacts?: Record<string, QueryArtifact>;
27
- }): RouterCache;
@@ -26,14 +26,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
26
26
  var runtime_exports = {};
27
27
  __export(runtime_exports, {
28
28
  Router: () => Router,
29
- router_cache: () => router_cache
29
+ router_cache: () => import_routing2.router_cache
30
30
  });
31
31
  module.exports = __toCommonJS(runtime_exports);
32
32
  var import_jsx_runtime = require("react/jsx-runtime");
33
- var import_client2 = __toESM(require("./client"));
33
+ var import_client = __toESM(require("./client"));
34
34
  var import_manifest = __toESM(require("./manifest"));
35
35
  var import_routing = require("./routing");
36
36
  __reExport(runtime_exports, require("./hooks"), module.exports);
37
+ var import_routing2 = require("./routing");
37
38
  function Router({
38
39
  cache,
39
40
  initialURL,
@@ -48,7 +49,7 @@ function Router({
48
49
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
49
50
  import_routing.RouterContextProvider,
50
51
  {
51
- client: (0, import_client2.default)(),
52
+ client: (0, import_client.default)(),
52
53
  cache,
53
54
  artifact_cache,
54
55
  component_cache,
@@ -60,46 +61,6 @@ function Router({
60
61
  }
61
62
  );
62
63
  }
63
- function router_cache({
64
- pending_queries = [],
65
- artifacts = {},
66
- components = {},
67
- initialData = {},
68
- initialArtifacts = {}
69
- } = {}) {
70
- const result = {
71
- artifact_cache: (0, import_routing.suspense_cache)(initialArtifacts),
72
- component_cache: (0, import_routing.suspense_cache)(),
73
- data_cache: (0, import_routing.suspense_cache)(initialData),
74
- pending_cache: (0, import_routing.suspense_cache)(),
75
- last_variables: (0, import_routing.suspense_cache)()
76
- };
77
- for (const query of pending_queries) {
78
- result.pending_cache.set(query, signal_promise());
79
- }
80
- for (const [name, artifact] of Object.entries(artifacts)) {
81
- result.artifact_cache.set(name, artifact);
82
- }
83
- for (const [name, component] of Object.entries(components)) {
84
- result.component_cache.set(name, component);
85
- }
86
- return result;
87
- }
88
- function signal_promise() {
89
- let resolve = () => {
90
- };
91
- let reject = () => {
92
- };
93
- const promise = new Promise((res, rej) => {
94
- resolve = res;
95
- reject = rej;
96
- });
97
- return {
98
- ...promise,
99
- resolve,
100
- reject
101
- };
102
- }
103
64
  // Annotate the CommonJS export names for ESM import in node:
104
65
  0 && (module.exports = {
105
66
  Router,
@@ -49,4 +49,18 @@ export declare function updateLocalSession(session: App.Session): void;
49
49
  export declare function useSession(): App.Session;
50
50
  export declare function useCurrentVariables(): GraphQLVariables;
51
51
  export declare function useQueryResult<_Data extends GraphQLObject, _Input extends GraphQLVariables>(name: string): [_Data | null, DocumentStore<_Data, _Input>];
52
+ export type RouterCache = {
53
+ artifact_cache: SuspenseCache<QueryArtifact>;
54
+ component_cache: SuspenseCache<(props: any) => React.ReactElement>;
55
+ data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
56
+ last_variables: LRUCache<GraphQLVariables>;
57
+ pending_cache: PendingCache;
58
+ };
59
+ export declare function router_cache({ pending_queries, artifacts, components, initialData, initialArtifacts, }?: {
60
+ pending_queries?: string[];
61
+ artifacts?: Record<string, QueryArtifact>;
62
+ components?: Record<string, (props: any) => React.ReactElement>;
63
+ initialData?: Record<string, DocumentStore<GraphQLObject, GraphQLVariables>>;
64
+ initialArtifacts?: Record<string, QueryArtifact>;
65
+ }): RouterCache;
52
66
  export {};
@@ -26,6 +26,7 @@ var Router_exports = {};
26
26
  __export(Router_exports, {
27
27
  Router: () => Router,
28
28
  RouterContextProvider: () => RouterContextProvider,
29
+ router_cache: () => router_cache,
29
30
  updateLocalSession: () => updateLocalSession,
30
31
  useCache: () => useCache,
31
32
  useClient: () => useClient,
@@ -41,6 +42,7 @@ var import_match = require("$houdini/runtime/router/match");
41
42
  var import_react = __toESM(require("react"));
42
43
  var import_react_streaming = require("react-streaming");
43
44
  var import_useDocumentStore = require("../hooks/useDocumentStore");
45
+ var import_cache = require("./cache");
44
46
  const PreloadWhich = {
45
47
  component: "component",
46
48
  data: "data",
@@ -371,10 +373,51 @@ function usePreload({ preload }) {
371
373
  };
372
374
  }, []);
373
375
  }
376
+ function router_cache({
377
+ pending_queries = [],
378
+ artifacts = {},
379
+ components = {},
380
+ initialData = {},
381
+ initialArtifacts = {}
382
+ } = {}) {
383
+ const result = {
384
+ artifact_cache: (0, import_cache.suspense_cache)(initialArtifacts),
385
+ component_cache: (0, import_cache.suspense_cache)(),
386
+ data_cache: (0, import_cache.suspense_cache)(initialData),
387
+ pending_cache: (0, import_cache.suspense_cache)(),
388
+ last_variables: (0, import_cache.suspense_cache)()
389
+ };
390
+ for (const query of pending_queries) {
391
+ result.pending_cache.set(query, signal_promise());
392
+ }
393
+ for (const [name, artifact] of Object.entries(artifacts)) {
394
+ result.artifact_cache.set(name, artifact);
395
+ }
396
+ for (const [name, component] of Object.entries(components)) {
397
+ result.component_cache.set(name, component);
398
+ }
399
+ return result;
400
+ }
401
+ function signal_promise() {
402
+ let resolve = () => {
403
+ };
404
+ let reject = () => {
405
+ };
406
+ const promise = new Promise((res, rej) => {
407
+ resolve = res;
408
+ reject = rej;
409
+ });
410
+ return {
411
+ ...promise,
412
+ resolve,
413
+ reject
414
+ };
415
+ }
374
416
  // Annotate the CommonJS export names for ESM import in node:
375
417
  0 && (module.exports = {
376
418
  Router,
377
419
  RouterContextProvider,
420
+ router_cache,
378
421
  updateLocalSession,
379
422
  useCache,
380
423
  useClient,
@@ -1,27 +1,10 @@
1
1
  import type { Cache } from '$houdini/runtime/cache/cache';
2
- import { DocumentStore } from '$houdini/runtime/client';
3
- import { LRUCache } from '$houdini/runtime/lib/lru';
4
- import { GraphQLObject, GraphQLVariables, QueryArtifact } from '$houdini/runtime/lib/types';
5
- import React from 'react';
6
- import { SuspenseCache, type PendingCache } from './routing';
2
+ import { RouterCache } from './routing';
7
3
  export * from './hooks';
4
+ export { router_cache } from './routing';
8
5
  export declare function Router({ cache, initialURL, artifact_cache, component_cache, data_cache, pending_cache, last_variables, session, assetPrefix, }: {
9
6
  initialURL: string;
10
7
  cache: Cache;
11
8
  session?: App.Session;
12
9
  assetPrefix: string;
13
10
  } & RouterCache): JSX.Element;
14
- type RouterCache = {
15
- artifact_cache: SuspenseCache<QueryArtifact>;
16
- component_cache: SuspenseCache<(props: any) => React.ReactElement>;
17
- data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
18
- last_variables: LRUCache<GraphQLVariables>;
19
- pending_cache: PendingCache;
20
- };
21
- export declare function router_cache({ pending_queries, artifacts, components, initialData, initialArtifacts, }?: {
22
- pending_queries?: string[];
23
- artifacts?: Record<string, QueryArtifact>;
24
- components?: Record<string, (props: any) => React.ReactElement>;
25
- initialData?: Record<string, DocumentStore<GraphQLObject, GraphQLVariables>>;
26
- initialArtifacts?: Record<string, QueryArtifact>;
27
- }): RouterCache;
@@ -1,12 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import client from "./client";
3
3
  import manifest from "./manifest";
4
- import {
5
- suspense_cache,
6
- Router as RouterImpl,
7
- RouterContextProvider
8
- } from "./routing";
4
+ import { Router as RouterImpl, RouterContextProvider } from "./routing";
9
5
  export * from "./hooks";
6
+ import { router_cache } from "./routing";
10
7
  function Router({
11
8
  cache,
12
9
  initialURL,
@@ -33,46 +30,6 @@ function Router({
33
30
  }
34
31
  );
35
32
  }
36
- function router_cache({
37
- pending_queries = [],
38
- artifacts = {},
39
- components = {},
40
- initialData = {},
41
- initialArtifacts = {}
42
- } = {}) {
43
- const result = {
44
- artifact_cache: suspense_cache(initialArtifacts),
45
- component_cache: suspense_cache(),
46
- data_cache: suspense_cache(initialData),
47
- pending_cache: suspense_cache(),
48
- last_variables: suspense_cache()
49
- };
50
- for (const query of pending_queries) {
51
- result.pending_cache.set(query, signal_promise());
52
- }
53
- for (const [name, artifact] of Object.entries(artifacts)) {
54
- result.artifact_cache.set(name, artifact);
55
- }
56
- for (const [name, component] of Object.entries(components)) {
57
- result.component_cache.set(name, component);
58
- }
59
- return result;
60
- }
61
- function signal_promise() {
62
- let resolve = () => {
63
- };
64
- let reject = () => {
65
- };
66
- const promise = new Promise((res, rej) => {
67
- resolve = res;
68
- reject = rej;
69
- });
70
- return {
71
- ...promise,
72
- resolve,
73
- reject
74
- };
75
- }
76
33
  export {
77
34
  Router,
78
35
  router_cache
@@ -49,4 +49,18 @@ export declare function updateLocalSession(session: App.Session): void;
49
49
  export declare function useSession(): App.Session;
50
50
  export declare function useCurrentVariables(): GraphQLVariables;
51
51
  export declare function useQueryResult<_Data extends GraphQLObject, _Input extends GraphQLVariables>(name: string): [_Data | null, DocumentStore<_Data, _Input>];
52
+ export type RouterCache = {
53
+ artifact_cache: SuspenseCache<QueryArtifact>;
54
+ component_cache: SuspenseCache<(props: any) => React.ReactElement>;
55
+ data_cache: SuspenseCache<DocumentStore<GraphQLObject, GraphQLVariables>>;
56
+ last_variables: LRUCache<GraphQLVariables>;
57
+ pending_cache: PendingCache;
58
+ };
59
+ export declare function router_cache({ pending_queries, artifacts, components, initialData, initialArtifacts, }?: {
60
+ pending_queries?: string[];
61
+ artifacts?: Record<string, QueryArtifact>;
62
+ components?: Record<string, (props: any) => React.ReactElement>;
63
+ initialData?: Record<string, DocumentStore<GraphQLObject, GraphQLVariables>>;
64
+ initialArtifacts?: Record<string, QueryArtifact>;
65
+ }): RouterCache;
52
66
  export {};
@@ -4,6 +4,7 @@ import { find_match } from "$houdini/runtime/router/match";
4
4
  import React from "react";
5
5
  import { useStream } from "react-streaming";
6
6
  import { useDocumentStore } from "../hooks/useDocumentStore";
7
+ import { suspense_cache } from "./cache";
7
8
  const PreloadWhich = {
8
9
  component: "component",
9
10
  data: "data",
@@ -334,9 +335,50 @@ function usePreload({ preload }) {
334
335
  };
335
336
  }, []);
336
337
  }
338
+ function router_cache({
339
+ pending_queries = [],
340
+ artifacts = {},
341
+ components = {},
342
+ initialData = {},
343
+ initialArtifacts = {}
344
+ } = {}) {
345
+ const result = {
346
+ artifact_cache: suspense_cache(initialArtifacts),
347
+ component_cache: suspense_cache(),
348
+ data_cache: suspense_cache(initialData),
349
+ pending_cache: suspense_cache(),
350
+ last_variables: suspense_cache()
351
+ };
352
+ for (const query of pending_queries) {
353
+ result.pending_cache.set(query, signal_promise());
354
+ }
355
+ for (const [name, artifact] of Object.entries(artifacts)) {
356
+ result.artifact_cache.set(name, artifact);
357
+ }
358
+ for (const [name, component] of Object.entries(components)) {
359
+ result.component_cache.set(name, component);
360
+ }
361
+ return result;
362
+ }
363
+ function signal_promise() {
364
+ let resolve = () => {
365
+ };
366
+ let reject = () => {
367
+ };
368
+ const promise = new Promise((res, rej) => {
369
+ resolve = res;
370
+ reject = rej;
371
+ });
372
+ return {
373
+ ...promise,
374
+ resolve,
375
+ reject
376
+ };
377
+ }
337
378
  export {
338
379
  Router,
339
380
  RouterContextProvider,
381
+ router_cache,
340
382
  updateLocalSession,
341
383
  useCache,
342
384
  useClient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-react",
3
- "version": "1.2.22",
3
+ "version": "1.2.23-next.0",
4
4
  "description": "The React plugin for houdini",
5
5
  "keywords": [
6
6
  "typescript",
@@ -42,7 +42,7 @@
42
42
  "recast": "^0.23.1",
43
43
  "rollup": "^3.7.4",
44
44
  "use-deep-compare-effect": "^1.8.1",
45
- "houdini": "^1.2.22"
45
+ "houdini": "^1.2.23-next.0"
46
46
  },
47
47
  "files": [
48
48
  "build"