houdini-react 2.0.0-next.32 → 2.0.0-next.33

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-react",
3
- "version": "2.0.0-next.32",
3
+ "version": "2.0.0-next.33",
4
4
  "description": "The React plugin for houdini",
5
5
  "keywords": [
6
6
  "typescript",
@@ -81,13 +81,13 @@
81
81
  }
82
82
  },
83
83
  "optionalDependencies": {
84
- "houdini-react-darwin-x64": "2.0.0-next.32",
85
- "houdini-react-darwin-arm64": "2.0.0-next.32",
86
- "houdini-react-linux-x64": "2.0.0-next.32",
87
- "houdini-react-linux-arm64": "2.0.0-next.32",
88
- "houdini-react-win32-x64": "2.0.0-next.32",
89
- "houdini-react-win32-arm64": "2.0.0-next.32",
90
- "houdini-react-wasm": "2.0.0-next.32"
84
+ "houdini-react-darwin-x64": "2.0.0-next.33",
85
+ "houdini-react-darwin-arm64": "2.0.0-next.33",
86
+ "houdini-react-linux-x64": "2.0.0-next.33",
87
+ "houdini-react-linux-arm64": "2.0.0-next.33",
88
+ "houdini-react-win32-x64": "2.0.0-next.33",
89
+ "houdini-react-win32-arm64": "2.0.0-next.33",
90
+ "houdini-react-wasm": "2.0.0-next.33"
91
91
  },
92
92
  "scripts": {
93
93
  "compile": "scripts build-go",
package/postInstall.js CHANGED
@@ -5,7 +5,7 @@ const https = require('https')
5
5
  const child_process = require('child_process')
6
6
 
7
7
  // Adjust the version you want to install. You can also make this dynamic.
8
- const BINARY_DISTRIBUTION_VERSION = '2.0.0-next.32'
8
+ const BINARY_DISTRIBUTION_VERSION = '2.0.0-next.33'
9
9
 
10
10
  // Windows binaries end with .exe so we need to special case them.
11
11
  const binaryName = process.platform === 'win32' ? 'houdini-react.exe' : 'houdini-react'
@@ -5,7 +5,7 @@ import type {
5
5
  GraphQLVariables,
6
6
  } from 'houdini/runtime'
7
7
 
8
- import { useDocumentHandle } from './useDocumentHandle.js'
8
+ import { useDocumentHandle, type DocumentHandle } from './useDocumentHandle.js'
9
9
  import { useDocumentStore } from './useDocumentStore.js'
10
10
  import { fragmentReference, useFragment } from './useFragment.js'
11
11
 
package/vite/index.js CHANGED
@@ -6,6 +6,7 @@ import {
6
6
  client_build_directory
7
7
  } from "houdini/router/conventions";
8
8
  import { load_manifest } from "houdini/router/manifest";
9
+ import { existsSync } from "node:fs";
9
10
  import { createRequire } from "node:module";
10
11
  import { build } from "vite";
11
12
  import { transform_file } from "./transform.js";
@@ -191,11 +192,36 @@ mount_static_app(App, manifest)
191
192
  },
192
193
  async configureServer(server) {
193
194
  devServer = true;
195
+ const onUnhandledRejection = (err) => {
196
+ console.error("\n[houdini] dev server error (server still running):\n", err, "\n");
197
+ };
198
+ process.on("unhandledRejection", onUnhandledRejection);
199
+ server.httpServer?.once(
200
+ "close",
201
+ () => process.off("unhandledRejection", onUnhandledRejection)
202
+ );
203
+ server.httpServer?.once("listening", () => {
204
+ const addr = server.httpServer?.address();
205
+ if (addr && typeof addr === "object") {
206
+ process.env.HOUDINI_PORT = String(addr.port);
207
+ }
208
+ const root = ctx.config.root_dir;
209
+ const entry = ["+index.tsx", "+index.jsx"].map((f) => path.join(root, "src", f)).find((f) => existsSync(f));
210
+ if (entry) {
211
+ server.ssrLoadModule(entry).catch(() => {
212
+ });
213
+ }
214
+ });
194
215
  server.middlewares.use(async (req, res, next) => {
195
216
  if (!req.url) {
196
217
  next();
197
218
  return;
198
219
  }
220
+ const url = req.url.split("?")[0];
221
+ if (url.startsWith("/@") || url.startsWith("/virtual:") || url.startsWith("/node_modules/") || /\.[a-z]+$/i.test(url)) {
222
+ next();
223
+ return;
224
+ }
199
225
  const { default: router_manifest } = await server.ssrLoadModule(
200
226
  path.join(plugin_dir(ctx.config, "houdini-react"), "runtime", "manifest.ts")
201
227
  );
@@ -227,13 +253,23 @@ mount_static_app(App, manifest)
227
253
  }
228
254
  } catch {
229
255
  }
256
+ const cssLinkSet = /* @__PURE__ */ new Set();
257
+ for (const [url2] of server.moduleGraph.urlToModuleMap) {
258
+ const cleanUrl = url2.split("?")[0];
259
+ if (!cleanUrl.includes("node_modules") && cleanUrl.endsWith(".css") && !cleanUrl.endsWith(".module.css")) {
260
+ cssLinkSet.add(cleanUrl);
261
+ }
262
+ }
263
+ const cssLinks = [...cssLinkSet];
264
+ res.setHeader("Content-Type", "text/html; charset=utf-8");
230
265
  try {
231
266
  const result = await createServerAdapter({
232
267
  production: false,
233
268
  manifest: router_manifest,
234
269
  assetPrefix: "/virtual:houdini",
235
270
  pipe: res,
236
- documentPremable
271
+ documentPremable,
272
+ cssLinks
237
273
  })(request);
238
274
  if (result && result.status === 404) {
239
275
  return next();