houdini-react 1.2.22 → 1.2.23
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/build/plugin/vite.d.ts +1 -1
- package/build/plugin-cjs/index.js +229 -116
- package/build/plugin-esm/index.js +227 -114
- package/build/runtime/index.d.ts +2 -19
- package/build/runtime/routing/Router.d.ts +14 -0
- package/build/runtime-cjs/index.d.ts +2 -19
- package/build/runtime-cjs/index.js +4 -43
- package/build/runtime-cjs/routing/Router.d.ts +14 -0
- package/build/runtime-cjs/routing/Router.js +43 -0
- package/build/runtime-esm/index.d.ts +2 -19
- package/build/runtime-esm/index.js +2 -45
- package/build/runtime-esm/routing/Router.d.ts +14 -0
- package/build/runtime-esm/routing/Router.js +42 -0
- package/package.json +2 -2
package/build/plugin/vite.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ declare const _default: {
|
|
|
4
4
|
houdiniConfig: import("houdini").Config;
|
|
5
5
|
}) => void) | undefined;
|
|
6
6
|
buildEnd?: ((this: import("rollup").PluginContext, error?: Error | undefined, houdiniConfig?: import("houdini").Config | undefined) => void | Promise<void>) | undefined;
|
|
7
|
-
closeBundle?: ((this: import("rollup").PluginContext) => void | Promise<void>) | undefined;
|
|
7
|
+
closeBundle?: ((this: import("rollup").PluginContext, config: import("houdini").Config) => void | Promise<void>) | undefined;
|
|
8
8
|
configResolved?: import("rollup").ObjectHook<(this: void, config: Readonly<Omit<import("vite").UserConfig, "plugins" | "assetsInclude" | "optimizeDeps" | "worker"> & {
|
|
9
9
|
configFile: string | undefined;
|
|
10
10
|
configFileDependencies: string[];
|
|
@@ -75587,10 +75587,10 @@ var validateHeaderValue = typeof import_node_http.default.validateHeaderValue ==
|
|
|
75587
75587
|
throw error;
|
|
75588
75588
|
}
|
|
75589
75589
|
};
|
|
75590
|
-
var
|
|
75590
|
+
var Headers2 = class extends URLSearchParams {
|
|
75591
75591
|
constructor(init) {
|
|
75592
75592
|
let result = [];
|
|
75593
|
-
if (init instanceof
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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) {
|
|
@@ -78416,7 +78416,7 @@ function exec(match, params) {
|
|
|
78416
78416
|
const result = {};
|
|
78417
78417
|
const values = match.slice(1);
|
|
78418
78418
|
let buffered = "";
|
|
78419
|
-
for (let i2 = 0; i2 < params.length; i2 += 1) {
|
|
78419
|
+
for (let i2 = 0; i2 < (params || []).length; i2 += 1) {
|
|
78420
78420
|
const param = params[i2];
|
|
78421
78421
|
let value = values[i2];
|
|
78422
78422
|
if (param.chained && param.rest && buffered) {
|
|
@@ -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
|
}
|
|
@@ -78952,12 +78956,19 @@ async function extractQueries(source) {
|
|
|
78952
78956
|
return props.filter((p) => p !== "children");
|
|
78953
78957
|
}
|
|
78954
78958
|
function isSecondaryBuild() {
|
|
78955
|
-
return process.env.
|
|
78959
|
+
return process.env.HOUDINI_SECONDARY_BUILD && process.env.HOUDINI_SECONDARY_BUILD !== "false";
|
|
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;
|
|
78956
78967
|
}
|
|
78957
78968
|
async function buildLocalSchema(config2) {
|
|
78958
|
-
const { build } = await import("vite");
|
|
78959
|
-
process.env.
|
|
78960
|
-
await
|
|
78969
|
+
const { build: build2 } = await import("vite");
|
|
78970
|
+
process.env.HOUDINI_SECONDARY_BUILD = "true";
|
|
78971
|
+
await build2({
|
|
78961
78972
|
logLevel: "silent",
|
|
78962
78973
|
build: {
|
|
78963
78974
|
outDir: import_node_path2.default.join(config2.rootDir, "temp"),
|
|
@@ -78978,7 +78989,7 @@ async function buildLocalSchema(config2) {
|
|
|
78978
78989
|
}
|
|
78979
78990
|
}
|
|
78980
78991
|
});
|
|
78981
|
-
process.env.
|
|
78992
|
+
process.env.HOUDINI_SECONDARY_BUILD = "false";
|
|
78982
78993
|
}
|
|
78983
78994
|
async function loadLocalSchema(config2) {
|
|
78984
78995
|
await buildLocalSchema(config2);
|
|
@@ -78988,7 +78999,7 @@ async function loadLocalSchema(config2) {
|
|
|
78988
78999
|
|
|
78989
79000
|
// src/plugin/index.ts
|
|
78990
79001
|
var import_node_path3 = __toESM(require("node:path"));
|
|
78991
|
-
var
|
|
79002
|
+
var import_vite2 = require("vite");
|
|
78992
79003
|
|
|
78993
79004
|
// src/plugin/codegen/entries.ts
|
|
78994
79005
|
async function generate_entries({
|
|
@@ -79217,16 +79228,103 @@ async function generate_renders({
|
|
|
79217
79228
|
config,
|
|
79218
79229
|
manifest: manifest3
|
|
79219
79230
|
}) {
|
|
79231
|
+
const adapter_path = conventions_exports.server_adapter_path(config);
|
|
79220
79232
|
await fs_exports.mkdirp(path_exports.dirname(conventions_exports.server_adapter_path(config)));
|
|
79221
79233
|
const app_index = `
|
|
79234
|
+
import { Router } from '$houdini/plugins/houdini-react/runtime'
|
|
79222
79235
|
import React from 'react'
|
|
79236
|
+
|
|
79223
79237
|
import Shell from '../../../../../src/+index'
|
|
79224
|
-
import { Router } from '$houdini'
|
|
79225
79238
|
|
|
79226
|
-
export default (props) =>
|
|
79239
|
+
export default (props) => (
|
|
79240
|
+
<Shell>
|
|
79241
|
+
<Router {...props} />
|
|
79242
|
+
</Shell>
|
|
79243
|
+
)
|
|
79244
|
+
`;
|
|
79245
|
+
let renderer = `
|
|
79246
|
+
import { Cache } from '$houdini/runtime/cache/cache'
|
|
79247
|
+
import { serverAdapterFactory, _serverHandler } from '$houdini/runtime/router/server'
|
|
79248
|
+
import { HoudiniClient } from '$houdini/runtime/client'
|
|
79249
|
+
import { renderToStream } from 'react-streaming/server'
|
|
79250
|
+
import React from 'react'
|
|
79251
|
+
|
|
79252
|
+
import { router_cache } from '../../runtime/routing'
|
|
79253
|
+
// @ts-expect-error
|
|
79254
|
+
import client from '../../../../../src/+client'
|
|
79255
|
+
// @ts-expect-error
|
|
79256
|
+
import App from "./App"
|
|
79257
|
+
import router_manifest from '$houdini/plugins/houdini-react/runtime/manifest'
|
|
79258
|
+
|
|
79259
|
+
export const on_render =
|
|
79260
|
+
({ assetPrefix, pipe, production, documentPremable }) =>
|
|
79261
|
+
async ({
|
|
79262
|
+
url,
|
|
79263
|
+
match,
|
|
79264
|
+
session,
|
|
79265
|
+
manifest,
|
|
79266
|
+
}) => {
|
|
79267
|
+
// instanitate a cache we can use for this request
|
|
79268
|
+
const cache = new Cache({ disabled: false })
|
|
79269
|
+
|
|
79270
|
+
if (!match) {
|
|
79271
|
+
return new Response('not found', { status: 404 })
|
|
79272
|
+
}
|
|
79273
|
+
|
|
79274
|
+
const {
|
|
79275
|
+
readable,
|
|
79276
|
+
injectToStream,
|
|
79277
|
+
pipe: pipeTo,
|
|
79278
|
+
} = await renderToStream(
|
|
79279
|
+
React.createElement(App, {
|
|
79280
|
+
initialURL: url,
|
|
79281
|
+
cache: cache,
|
|
79282
|
+
session: session,
|
|
79283
|
+
assetPrefix: assetPrefix,
|
|
79284
|
+
manifest: manifest,
|
|
79285
|
+
...router_cache()
|
|
79286
|
+
}),
|
|
79287
|
+
{
|
|
79288
|
+
userAgent: 'Vite',
|
|
79289
|
+
}
|
|
79290
|
+
)
|
|
79291
|
+
|
|
79292
|
+
// add the initial scripts to the page
|
|
79293
|
+
injectToStream(\`
|
|
79294
|
+
<script>
|
|
79295
|
+
window.__houdini__initial__cache__ = \${cache.serialize()};
|
|
79296
|
+
window.__houdini__initial__session__ = \${JSON.stringify(session)};
|
|
79297
|
+
<\/script>
|
|
79298
|
+
|
|
79299
|
+
\${documentPremable ?? ''}
|
|
79300
|
+
|
|
79301
|
+
<!--
|
|
79302
|
+
add a virtual module that hydrates the client and sets up the initial pending cache.
|
|
79303
|
+
the dynamic extension is to support dev which sees the raw jsx, and production which sees the bundled asset
|
|
79304
|
+
-->
|
|
79305
|
+
<script type="module" src="\${assetPrefix}/pages/\${match.id}.\${production ? 'js' : 'jsx'}" async=""><\/script>
|
|
79306
|
+
\`)
|
|
79307
|
+
|
|
79308
|
+
if (pipeTo && pipe) {
|
|
79309
|
+
pipeTo(pipe)
|
|
79310
|
+
return true
|
|
79311
|
+
} else {
|
|
79312
|
+
return new Response(readable)
|
|
79313
|
+
}
|
|
79314
|
+
}
|
|
79315
|
+
|
|
79316
|
+
export function createServerAdapter(options) {
|
|
79317
|
+
return serverAdapterFactory({
|
|
79318
|
+
client,
|
|
79319
|
+
production: true,
|
|
79320
|
+
manifest: router_manifest,
|
|
79321
|
+
on_render: on_render(options),
|
|
79322
|
+
...options,
|
|
79323
|
+
})
|
|
79324
|
+
}
|
|
79227
79325
|
`;
|
|
79228
79326
|
let adapter_config = `
|
|
79229
|
-
import createAdapter from './server'
|
|
79327
|
+
import { createServerAdapter as createAdapter } from './server'
|
|
79230
79328
|
|
|
79231
79329
|
export const endpoint = ${JSON.stringify(localApiEndpoint(config.configFile))}
|
|
79232
79330
|
|
|
@@ -79243,72 +79341,9 @@ export default (props) => <Shell><Router {...props} /></Shell>
|
|
|
79243
79341
|
})
|
|
79244
79342
|
}
|
|
79245
79343
|
`;
|
|
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
79344
|
await Promise.all([
|
|
79310
|
-
fs_exports.writeFile(conventions_exports.server_adapter_path(config), server_adapter),
|
|
79311
79345
|
fs_exports.writeFile(conventions_exports.adapter_config_path(config), adapter_config),
|
|
79346
|
+
fs_exports.writeFile(adapter_path, renderer),
|
|
79312
79347
|
fs_exports.writeFile(conventions_exports.app_component_path(config), app_index)
|
|
79313
79348
|
]);
|
|
79314
79349
|
}
|
|
@@ -79578,28 +79613,44 @@ async function transformFile(page) {
|
|
|
79578
79613
|
}
|
|
79579
79614
|
|
|
79580
79615
|
// src/plugin/vite.tsx
|
|
79616
|
+
var import_vite = require("vite");
|
|
79581
79617
|
var manifest;
|
|
79618
|
+
var devServer = false;
|
|
79582
79619
|
var vite_default = {
|
|
79583
79620
|
async config(config, env) {
|
|
79584
79621
|
manifest = await load_manifest({ config, includeArtifacts: env.mode === "production" });
|
|
79585
79622
|
setManifest(manifest);
|
|
79586
|
-
let
|
|
79587
|
-
|
|
79588
|
-
|
|
79623
|
+
let conf = {
|
|
79624
|
+
build: {
|
|
79625
|
+
rollupOptions: {}
|
|
79626
|
+
}
|
|
79627
|
+
};
|
|
79628
|
+
if (!isSecondaryBuild() || process.env.HOUDINI_SECONDARY_BUILD === "ssr") {
|
|
79629
|
+
if (!devServer) {
|
|
79630
|
+
conf.base = "/assets";
|
|
79631
|
+
}
|
|
79632
|
+
conf.build = {
|
|
79589
79633
|
rollupOptions: {
|
|
79590
79634
|
output: {
|
|
79591
|
-
|
|
79592
|
-
|
|
79635
|
+
assetFileNames: "assets/[name].js",
|
|
79636
|
+
entryFileNames: "[name].js"
|
|
79637
|
+
},
|
|
79638
|
+
external: ["react-streaming/server"]
|
|
79593
79639
|
}
|
|
79594
79640
|
};
|
|
79595
79641
|
await fs_exports.mkdirp(config.compiledAssetsDir);
|
|
79596
|
-
|
|
79597
|
-
|
|
79642
|
+
conf.build.rollupOptions.input = {
|
|
79643
|
+
"entries/app": conventions_exports.app_component_path(config),
|
|
79644
|
+
"entries/adapter": conventions_exports.adapter_config_path(config)
|
|
79645
|
+
};
|
|
79598
79646
|
for (const [id, page] of Object.entries(manifest.pages)) {
|
|
79599
|
-
|
|
79647
|
+
conf.build.rollupOptions.input[`pages/${id}`] = `virtual:houdini/pages/${page.id}@${page.queries}.jsx`;
|
|
79600
79648
|
}
|
|
79601
79649
|
for (const artifact of manifest.artifacts) {
|
|
79602
|
-
|
|
79650
|
+
conf.build.rollupOptions.input[`artifacts/${artifact}`] = `virtual:houdini/artifacts/${artifact}.js`;
|
|
79651
|
+
}
|
|
79652
|
+
if (process.env.HOUDINI_SECONDARY_BUILD !== "ssr") {
|
|
79653
|
+
conf.build.outDir = config.compiledAssetsDir;
|
|
79603
79654
|
}
|
|
79604
79655
|
}
|
|
79605
79656
|
return {
|
|
@@ -79611,7 +79662,7 @@ var vite_default = {
|
|
|
79611
79662
|
"~/*": path_exports.join(config.projectRoot, "src", "*")
|
|
79612
79663
|
}
|
|
79613
79664
|
},
|
|
79614
|
-
|
|
79665
|
+
...conf
|
|
79615
79666
|
};
|
|
79616
79667
|
},
|
|
79617
79668
|
resolveId(id) {
|
|
@@ -79623,6 +79674,20 @@ var vite_default = {
|
|
|
79623
79674
|
async buildStart({ houdiniConfig }) {
|
|
79624
79675
|
await writeTsconfig(houdiniConfig);
|
|
79625
79676
|
},
|
|
79677
|
+
async closeBundle(config) {
|
|
79678
|
+
if (isSecondaryBuild() || devServer) {
|
|
79679
|
+
return;
|
|
79680
|
+
}
|
|
79681
|
+
console.log("\u{1F3A9} Generating Server Assets...");
|
|
79682
|
+
process.env.HOUDINI_SECONDARY_BUILD = "ssr";
|
|
79683
|
+
await (0, import_vite.build)({
|
|
79684
|
+
build: {
|
|
79685
|
+
ssr: true,
|
|
79686
|
+
outDir: path_exports.join(config.rootDir, "build", "ssr")
|
|
79687
|
+
}
|
|
79688
|
+
});
|
|
79689
|
+
process.env.HOUDINI_SECONDARY_BUILD = "false";
|
|
79690
|
+
},
|
|
79626
79691
|
async load(id, { config }) {
|
|
79627
79692
|
if (!id.startsWith("virtual:houdini")) {
|
|
79628
79693
|
return;
|
|
@@ -79645,7 +79710,6 @@ var vite_default = {
|
|
|
79645
79710
|
// if there is pending data (or artifacts) then we should prime the caches
|
|
79646
79711
|
let initialData = {}
|
|
79647
79712
|
let initialArtifacts = {}
|
|
79648
|
-
|
|
79649
79713
|
if (!window.__houdini__cache__) {
|
|
79650
79714
|
window.__houdini__cache__ = new Cache()
|
|
79651
79715
|
window.__houdini__hydration__layer__ = window.__houdini__cache__._internal_unstable.storage.createLayer(true)
|
|
@@ -79680,16 +79744,24 @@ var vite_default = {
|
|
|
79680
79744
|
})
|
|
79681
79745
|
}
|
|
79682
79746
|
|
|
79683
|
-
|
|
79684
|
-
|
|
79685
79747
|
// hydrate the cache with the information from the initial payload
|
|
79686
79748
|
window.__houdini__cache__?.hydrate(
|
|
79687
79749
|
window.__houdini__initial__cache__,
|
|
79688
79750
|
window.__houdini__hydration__layer__
|
|
79689
79751
|
)
|
|
79690
79752
|
|
|
79753
|
+
// get the initial url from the window
|
|
79754
|
+
const url = window.location.pathname
|
|
79755
|
+
|
|
79756
|
+
const app = <App
|
|
79757
|
+
initialURL={url}
|
|
79758
|
+
cache={window.__houdini__cache__}
|
|
79759
|
+
session={window.__houdini__initial__session__}
|
|
79760
|
+
{...window.__houdini__nav_caches__}
|
|
79761
|
+
/>
|
|
79762
|
+
|
|
79691
79763
|
// hydrate the application for interactivity
|
|
79692
|
-
hydrateRoot(document,
|
|
79764
|
+
hydrateRoot(document, app)
|
|
79693
79765
|
`;
|
|
79694
79766
|
}
|
|
79695
79767
|
if (which === "artifacts") {
|
|
@@ -79704,51 +79776,92 @@ if (window.__houdini__nav_caches__ && window.__houdini__nav_caches__.artifact_ca
|
|
|
79704
79776
|
}
|
|
79705
79777
|
},
|
|
79706
79778
|
async configureServer(server) {
|
|
79779
|
+
devServer = true;
|
|
79707
79780
|
await writeTsconfig(server.houdiniConfig);
|
|
79708
79781
|
server.middlewares.use(async (req, res, next) => {
|
|
79782
|
+
if (!req.url) {
|
|
79783
|
+
next();
|
|
79784
|
+
return;
|
|
79785
|
+
}
|
|
79709
79786
|
const { default: router_manifest } = await server.ssrLoadModule(
|
|
79710
79787
|
path_exports.join(
|
|
79711
79788
|
server.houdiniConfig.pluginRuntimeDirectory("houdini-react"),
|
|
79712
79789
|
"manifest.js"
|
|
79713
79790
|
)
|
|
79714
79791
|
);
|
|
79715
|
-
|
|
79716
|
-
|
|
79717
|
-
|
|
79718
|
-
|
|
79719
|
-
|
|
79720
|
-
|
|
79721
|
-
if (req.url !== localApiEndpoint(server.houdiniConfig.configFile)) {
|
|
79722
|
-
return next();
|
|
79723
|
-
}
|
|
79792
|
+
const [match] = find_match(router_manifest, req.url);
|
|
79793
|
+
if (!match && !internalRoutes(server.houdiniConfig.configFile).find(
|
|
79794
|
+
(route) => req.url?.startsWith(route)
|
|
79795
|
+
)) {
|
|
79796
|
+
next();
|
|
79797
|
+
return;
|
|
79724
79798
|
}
|
|
79725
79799
|
const project_manifest = await load_manifest({ config: server.houdiniConfig });
|
|
79726
79800
|
let schema = null;
|
|
79727
79801
|
if (project_manifest.local_schema) {
|
|
79728
79802
|
schema = await loadLocalSchema(server.houdiniConfig);
|
|
79729
79803
|
}
|
|
79730
|
-
const serverAdapter = (await server.ssrLoadModule(
|
|
79731
|
-
conventions_exports.server_adapter_path(server.houdiniConfig) + "?t=" + new Date().getTime()
|
|
79732
|
-
)).default;
|
|
79733
79804
|
let yoga = null;
|
|
79734
79805
|
if (project_manifest.local_yoga) {
|
|
79735
|
-
const yogaPath = path_exports.join(
|
|
79736
|
-
server.houdiniConfig.localApiDir,
|
|
79737
|
-
"+yoga?t=" + new Date().getTime()
|
|
79738
|
-
);
|
|
79806
|
+
const yogaPath = path_exports.join(server.houdiniConfig.localApiDir, "+yoga");
|
|
79739
79807
|
yoga = await server.ssrLoadModule(yogaPath);
|
|
79740
79808
|
}
|
|
79741
|
-
await
|
|
79809
|
+
const { createServerAdapter } = await server.ssrLoadModule(
|
|
79810
|
+
conventions_exports.server_adapter_path(server.houdiniConfig)
|
|
79811
|
+
);
|
|
79812
|
+
const requestHeaders = new Headers();
|
|
79813
|
+
for (const header of Object.entries(req.headers ?? {})) {
|
|
79814
|
+
requestHeaders.set(header[0], header[1]);
|
|
79815
|
+
}
|
|
79816
|
+
const request = new Request(
|
|
79817
|
+
"https://localhost:5173" + req.url,
|
|
79818
|
+
req.method === "POST" ? {
|
|
79819
|
+
method: req.method,
|
|
79820
|
+
headers: requestHeaders,
|
|
79821
|
+
body: await getBody(req)
|
|
79822
|
+
} : void 0
|
|
79823
|
+
);
|
|
79824
|
+
for (const [key, value] of Object.entries(req.headers)) {
|
|
79825
|
+
request.headers.set(key, value);
|
|
79826
|
+
}
|
|
79827
|
+
const result = await createServerAdapter({
|
|
79742
79828
|
schema,
|
|
79743
79829
|
yoga,
|
|
79744
|
-
assetPrefix: "/virtual:houdini",
|
|
79745
79830
|
production: false,
|
|
79746
79831
|
manifest: router_manifest,
|
|
79747
|
-
|
|
79748
|
-
|
|
79832
|
+
graphqlEndpoint: localApiEndpoint(server.houdiniConfig.configFile),
|
|
79833
|
+
assetPrefix: "/virtual:houdini",
|
|
79834
|
+
pipe: res,
|
|
79835
|
+
documentPremable: `<script type="module" src="/@vite/client" async=""><\/script>`
|
|
79836
|
+
})(request);
|
|
79837
|
+
if (result && result.status === 404) {
|
|
79838
|
+
next();
|
|
79839
|
+
}
|
|
79840
|
+
if (result && typeof result !== "boolean") {
|
|
79841
|
+
if (res.closed) {
|
|
79842
|
+
return;
|
|
79843
|
+
}
|
|
79844
|
+
for (const header of Object.entries(result.headers ?? {})) {
|
|
79845
|
+
res.setHeader(header[0], header[1]);
|
|
79846
|
+
}
|
|
79847
|
+
res.write(await result.text());
|
|
79848
|
+
res.end();
|
|
79849
|
+
}
|
|
79749
79850
|
});
|
|
79750
79851
|
}
|
|
79751
79852
|
};
|
|
79853
|
+
function getBody(request) {
|
|
79854
|
+
return new Promise((resolve2) => {
|
|
79855
|
+
const bodyParts = [];
|
|
79856
|
+
let body;
|
|
79857
|
+
request.on("data", (chunk) => {
|
|
79858
|
+
bodyParts.push(chunk);
|
|
79859
|
+
}).on("end", () => {
|
|
79860
|
+
body = Buffer.concat(bodyParts).toString();
|
|
79861
|
+
resolve2(body);
|
|
79862
|
+
});
|
|
79863
|
+
});
|
|
79864
|
+
}
|
|
79752
79865
|
|
|
79753
79866
|
// src/plugin/index.ts
|
|
79754
79867
|
var manifest2;
|
|
@@ -79897,7 +80010,7 @@ export function useFragmentHandle(reference: { readonly "${fragmentKey}": { ${do
|
|
|
79897
80010
|
if (_env) {
|
|
79898
80011
|
return _env;
|
|
79899
80012
|
}
|
|
79900
|
-
_env = (0,
|
|
80013
|
+
_env = (0, import_vite2.loadEnv)("dev", config.projectRoot || ".", "");
|
|
79901
80014
|
return _env;
|
|
79902
80015
|
}
|
|
79903
80016
|
});
|