houdini-react 2.0.0-next.32 → 2.0.0-next.34
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 +8 -8
- package/postInstall.js +1 -1
- package/runtime/hooks/useFragmentHandle.ts +1 -1
- package/vite/index.js +48 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini-react",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.34",
|
|
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.
|
|
85
|
-
"houdini-react-darwin-arm64": "2.0.0-next.
|
|
86
|
-
"houdini-react-linux-x64": "2.0.0-next.
|
|
87
|
-
"houdini-react-linux-arm64": "2.0.0-next.
|
|
88
|
-
"houdini-react-win32-x64": "2.0.0-next.
|
|
89
|
-
"houdini-react-win32-arm64": "2.0.0-next.
|
|
90
|
-
"houdini-react-wasm": "2.0.0-next.
|
|
84
|
+
"houdini-react-darwin-x64": "2.0.0-next.34",
|
|
85
|
+
"houdini-react-darwin-arm64": "2.0.0-next.34",
|
|
86
|
+
"houdini-react-linux-x64": "2.0.0-next.34",
|
|
87
|
+
"houdini-react-linux-arm64": "2.0.0-next.34",
|
|
88
|
+
"houdini-react-win32-x64": "2.0.0-next.34",
|
|
89
|
+
"houdini-react-win32-arm64": "2.0.0-next.34",
|
|
90
|
+
"houdini-react-wasm": "2.0.0-next.34"
|
|
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.
|
|
8
|
+
const BINARY_DISTRIBUTION_VERSION = '2.0.0-next.34'
|
|
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";
|
|
@@ -90,6 +91,9 @@ function index_default(ctx) {
|
|
|
90
91
|
}
|
|
91
92
|
return id.substring(id.indexOf("virtual:houdini"));
|
|
92
93
|
},
|
|
94
|
+
hotUpdate() {
|
|
95
|
+
cfCache = null;
|
|
96
|
+
},
|
|
93
97
|
async transform(code, filepath) {
|
|
94
98
|
filepath = path.posixify(filepath);
|
|
95
99
|
if (filepath.startsWith("/src/")) {
|
|
@@ -152,7 +156,14 @@ function index_default(ctx) {
|
|
|
152
156
|
const parsedPath = arg ? path.parse(arg) : "";
|
|
153
157
|
const pageName = parsedPath ? parsedPath.name : "";
|
|
154
158
|
if (which === "pages") {
|
|
155
|
-
|
|
159
|
+
let page = manifest.pages[pageName];
|
|
160
|
+
if (!page) {
|
|
161
|
+
try {
|
|
162
|
+
manifest = await load_manifest({ config: ctx.config });
|
|
163
|
+
page = manifest.pages[pageName];
|
|
164
|
+
} catch {
|
|
165
|
+
}
|
|
166
|
+
}
|
|
156
167
|
if (!page) {
|
|
157
168
|
throw new Error("unknown page" + pageName);
|
|
158
169
|
}
|
|
@@ -191,11 +202,36 @@ mount_static_app(App, manifest)
|
|
|
191
202
|
},
|
|
192
203
|
async configureServer(server) {
|
|
193
204
|
devServer = true;
|
|
205
|
+
const onUnhandledRejection = (err) => {
|
|
206
|
+
console.error("\n[houdini] dev server error (server still running):\n", err, "\n");
|
|
207
|
+
};
|
|
208
|
+
process.on("unhandledRejection", onUnhandledRejection);
|
|
209
|
+
server.httpServer?.once(
|
|
210
|
+
"close",
|
|
211
|
+
() => process.off("unhandledRejection", onUnhandledRejection)
|
|
212
|
+
);
|
|
213
|
+
server.httpServer?.once("listening", () => {
|
|
214
|
+
const addr = server.httpServer?.address();
|
|
215
|
+
if (addr && typeof addr === "object") {
|
|
216
|
+
process.env.HOUDINI_PORT = String(addr.port);
|
|
217
|
+
}
|
|
218
|
+
const root = ctx.config.root_dir;
|
|
219
|
+
const entry = ["+index.tsx", "+index.jsx"].map((f) => path.join(root, "src", f)).find((f) => existsSync(f));
|
|
220
|
+
if (entry) {
|
|
221
|
+
server.ssrLoadModule(entry).catch(() => {
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
});
|
|
194
225
|
server.middlewares.use(async (req, res, next) => {
|
|
195
226
|
if (!req.url) {
|
|
196
227
|
next();
|
|
197
228
|
return;
|
|
198
229
|
}
|
|
230
|
+
const url = req.url.split("?")[0];
|
|
231
|
+
if (url.startsWith("/@") || url.startsWith("/virtual:") || url.startsWith("/node_modules/") || /\.[a-z]+$/i.test(url)) {
|
|
232
|
+
next();
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
199
235
|
const { default: router_manifest } = await server.ssrLoadModule(
|
|
200
236
|
path.join(plugin_dir(ctx.config, "houdini-react"), "runtime", "manifest.ts")
|
|
201
237
|
);
|
|
@@ -227,13 +263,23 @@ mount_static_app(App, manifest)
|
|
|
227
263
|
}
|
|
228
264
|
} catch {
|
|
229
265
|
}
|
|
266
|
+
const cssLinkSet = /* @__PURE__ */ new Set();
|
|
267
|
+
for (const [url2] of server.moduleGraph.urlToModuleMap) {
|
|
268
|
+
const cleanUrl = url2.split("?")[0];
|
|
269
|
+
if (!cleanUrl.includes("node_modules") && cleanUrl.endsWith(".css") && !cleanUrl.endsWith(".module.css")) {
|
|
270
|
+
cssLinkSet.add(cleanUrl);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
const cssLinks = [...cssLinkSet];
|
|
274
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
230
275
|
try {
|
|
231
276
|
const result = await createServerAdapter({
|
|
232
277
|
production: false,
|
|
233
278
|
manifest: router_manifest,
|
|
234
279
|
assetPrefix: "/virtual:houdini",
|
|
235
280
|
pipe: res,
|
|
236
|
-
documentPremable
|
|
281
|
+
documentPremable,
|
|
282
|
+
cssLinks
|
|
237
283
|
})(request);
|
|
238
284
|
if (result && result.status === 404) {
|
|
239
285
|
return next();
|