houdini-react 1.2.23-next.0 → 1.2.24
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 +74 -48
- package/build/plugin-esm/index.js +72 -46
- 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[];
|
|
@@ -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) {
|
|
@@ -78956,7 +78956,7 @@ async function extractQueries(source) {
|
|
|
78956
78956
|
return props.filter((p) => p !== "children");
|
|
78957
78957
|
}
|
|
78958
78958
|
function isSecondaryBuild() {
|
|
78959
|
-
return process.env.
|
|
78959
|
+
return process.env.HOUDINI_SECONDARY_BUILD && process.env.HOUDINI_SECONDARY_BUILD !== "false";
|
|
78960
78960
|
}
|
|
78961
78961
|
function internalRoutes(config2) {
|
|
78962
78962
|
const routes = [localApiEndpoint(config2)];
|
|
@@ -78966,9 +78966,9 @@ function internalRoutes(config2) {
|
|
|
78966
78966
|
return routes;
|
|
78967
78967
|
}
|
|
78968
78968
|
async function buildLocalSchema(config2) {
|
|
78969
|
-
const { build } = await import("vite");
|
|
78970
|
-
process.env.
|
|
78971
|
-
await
|
|
78969
|
+
const { build: build2 } = await import("vite");
|
|
78970
|
+
process.env.HOUDINI_SECONDARY_BUILD = "true";
|
|
78971
|
+
await build2({
|
|
78972
78972
|
logLevel: "silent",
|
|
78973
78973
|
build: {
|
|
78974
78974
|
outDir: import_node_path2.default.join(config2.rootDir, "temp"),
|
|
@@ -78989,7 +78989,7 @@ async function buildLocalSchema(config2) {
|
|
|
78989
78989
|
}
|
|
78990
78990
|
}
|
|
78991
78991
|
});
|
|
78992
|
-
process.env.
|
|
78992
|
+
process.env.HOUDINI_SECONDARY_BUILD = "false";
|
|
78993
78993
|
}
|
|
78994
78994
|
async function loadLocalSchema(config2) {
|
|
78995
78995
|
await buildLocalSchema(config2);
|
|
@@ -78999,7 +78999,7 @@ async function loadLocalSchema(config2) {
|
|
|
78999
78999
|
|
|
79000
79000
|
// src/plugin/index.ts
|
|
79001
79001
|
var import_node_path3 = __toESM(require("node:path"));
|
|
79002
|
-
var
|
|
79002
|
+
var import_vite2 = require("vite");
|
|
79003
79003
|
|
|
79004
79004
|
// src/plugin/codegen/entries.ts
|
|
79005
79005
|
async function generate_entries({
|
|
@@ -79228,12 +79228,8 @@ async function generate_renders({
|
|
|
79228
79228
|
config,
|
|
79229
79229
|
manifest: manifest3
|
|
79230
79230
|
}) {
|
|
79231
|
+
const adapter_path = conventions_exports.server_adapter_path(config);
|
|
79231
79232
|
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
|
-
`;
|
|
79237
79233
|
const app_index = `
|
|
79238
79234
|
import { Router } from '$houdini/plugins/houdini-react/runtime'
|
|
79239
79235
|
import React from 'react'
|
|
@@ -79257,7 +79253,8 @@ import { router_cache } from '../../runtime/routing'
|
|
|
79257
79253
|
// @ts-expect-error
|
|
79258
79254
|
import client from '../../../../../src/+client'
|
|
79259
79255
|
// @ts-expect-error
|
|
79260
|
-
import App from
|
|
79256
|
+
import App from "./App"
|
|
79257
|
+
import router_manifest from '$houdini/plugins/houdini-react/runtime/manifest'
|
|
79261
79258
|
|
|
79262
79259
|
export const on_render =
|
|
79263
79260
|
({ assetPrefix, pipe, production, documentPremable }) =>
|
|
@@ -79299,7 +79296,7 @@ export const on_render =
|
|
|
79299
79296
|
window.__houdini__initial__session__ = \${JSON.stringify(session)};
|
|
79300
79297
|
<\/script>
|
|
79301
79298
|
|
|
79302
|
-
\${documentPremable}
|
|
79299
|
+
\${documentPremable ?? ''}
|
|
79303
79300
|
|
|
79304
79301
|
<!--
|
|
79305
79302
|
add a virtual module that hydrates the client and sets up the initial pending cache.
|
|
@@ -79316,25 +79313,18 @@ export const on_render =
|
|
|
79316
79313
|
}
|
|
79317
79314
|
}
|
|
79318
79315
|
|
|
79319
|
-
export function
|
|
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) {
|
|
79316
|
+
export function createServerAdapter(options) {
|
|
79328
79317
|
return serverAdapterFactory({
|
|
79329
79318
|
client,
|
|
79330
79319
|
production: true,
|
|
79320
|
+
manifest: router_manifest,
|
|
79321
|
+
on_render: on_render(options),
|
|
79331
79322
|
...options,
|
|
79332
|
-
on_render: on_render({ assetPrefix: options.assetPrefix }),
|
|
79333
79323
|
})
|
|
79334
79324
|
}
|
|
79335
79325
|
`;
|
|
79336
79326
|
let adapter_config = `
|
|
79337
|
-
import createAdapter from './server'
|
|
79327
|
+
import { createServerAdapter as createAdapter } from './server'
|
|
79338
79328
|
|
|
79339
79329
|
export const endpoint = ${JSON.stringify(localApiEndpoint(config.configFile))}
|
|
79340
79330
|
|
|
@@ -79353,9 +79343,8 @@ export default function createServerAdapter(options) {
|
|
|
79353
79343
|
`;
|
|
79354
79344
|
await Promise.all([
|
|
79355
79345
|
fs_exports.writeFile(conventions_exports.adapter_config_path(config), adapter_config),
|
|
79356
|
-
fs_exports.writeFile(
|
|
79357
|
-
fs_exports.writeFile(conventions_exports.app_component_path(config), app_index)
|
|
79358
|
-
fs_exports.writeFile(conventions_exports.vite_render_path(config), vite_render)
|
|
79346
|
+
fs_exports.writeFile(adapter_path, renderer),
|
|
79347
|
+
fs_exports.writeFile(conventions_exports.app_component_path(config), app_index)
|
|
79359
79348
|
]);
|
|
79360
79349
|
}
|
|
79361
79350
|
|
|
@@ -79624,28 +79613,44 @@ async function transformFile(page) {
|
|
|
79624
79613
|
}
|
|
79625
79614
|
|
|
79626
79615
|
// src/plugin/vite.tsx
|
|
79616
|
+
var import_vite = require("vite");
|
|
79627
79617
|
var manifest;
|
|
79618
|
+
var devServer = false;
|
|
79628
79619
|
var vite_default = {
|
|
79629
79620
|
async config(config, env) {
|
|
79630
79621
|
manifest = await load_manifest({ config, includeArtifacts: env.mode === "production" });
|
|
79631
79622
|
setManifest(manifest);
|
|
79632
|
-
let
|
|
79633
|
-
|
|
79634
|
-
|
|
79623
|
+
let conf = {
|
|
79624
|
+
build: {
|
|
79625
|
+
rollupOptions: {}
|
|
79626
|
+
}
|
|
79627
|
+
};
|
|
79628
|
+
if (!isSecondaryBuild() || process.env.HOUDINI_SECONDARY_BUILD === "ssr") {
|
|
79629
|
+
if (env.command === "build") {
|
|
79630
|
+
conf.base = "/assets";
|
|
79631
|
+
}
|
|
79632
|
+
conf.build = {
|
|
79635
79633
|
rollupOptions: {
|
|
79636
79634
|
output: {
|
|
79637
|
-
|
|
79638
|
-
|
|
79635
|
+
assetFileNames: "assets/[name].js",
|
|
79636
|
+
entryFileNames: "[name].js"
|
|
79637
|
+
},
|
|
79638
|
+
external: ["react-streaming/server"]
|
|
79639
79639
|
}
|
|
79640
79640
|
};
|
|
79641
79641
|
await fs_exports.mkdirp(config.compiledAssetsDir);
|
|
79642
|
-
|
|
79643
|
-
|
|
79642
|
+
conf.build.rollupOptions.input = {
|
|
79643
|
+
"entries/app": conventions_exports.app_component_path(config),
|
|
79644
|
+
"entries/adapter": conventions_exports.adapter_config_path(config)
|
|
79645
|
+
};
|
|
79644
79646
|
for (const [id, page] of Object.entries(manifest.pages)) {
|
|
79645
|
-
|
|
79647
|
+
conf.build.rollupOptions.input[`pages/${id}`] = `virtual:houdini/pages/${page.id}@${page.queries}.jsx`;
|
|
79646
79648
|
}
|
|
79647
79649
|
for (const artifact of manifest.artifacts) {
|
|
79648
|
-
|
|
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;
|
|
79649
79654
|
}
|
|
79650
79655
|
}
|
|
79651
79656
|
return {
|
|
@@ -79657,7 +79662,7 @@ var vite_default = {
|
|
|
79657
79662
|
"~/*": path_exports.join(config.projectRoot, "src", "*")
|
|
79658
79663
|
}
|
|
79659
79664
|
},
|
|
79660
|
-
|
|
79665
|
+
...conf
|
|
79661
79666
|
};
|
|
79662
79667
|
},
|
|
79663
79668
|
resolveId(id) {
|
|
@@ -79669,6 +79674,20 @@ var vite_default = {
|
|
|
79669
79674
|
async buildStart({ houdiniConfig }) {
|
|
79670
79675
|
await writeTsconfig(houdiniConfig);
|
|
79671
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
|
+
},
|
|
79672
79691
|
async load(id, { config }) {
|
|
79673
79692
|
if (!id.startsWith("virtual:houdini")) {
|
|
79674
79693
|
return;
|
|
@@ -79691,7 +79710,6 @@ var vite_default = {
|
|
|
79691
79710
|
// if there is pending data (or artifacts) then we should prime the caches
|
|
79692
79711
|
let initialData = {}
|
|
79693
79712
|
let initialArtifacts = {}
|
|
79694
|
-
|
|
79695
79713
|
if (!window.__houdini__cache__) {
|
|
79696
79714
|
window.__houdini__cache__ = new Cache()
|
|
79697
79715
|
window.__houdini__hydration__layer__ = window.__houdini__cache__._internal_unstable.storage.createLayer(true)
|
|
@@ -79732,8 +79750,18 @@ var vite_default = {
|
|
|
79732
79750
|
window.__houdini__hydration__layer__
|
|
79733
79751
|
)
|
|
79734
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
|
+
|
|
79735
79763
|
// hydrate the application for interactivity
|
|
79736
|
-
hydrateRoot(document,
|
|
79764
|
+
hydrateRoot(document, app)
|
|
79737
79765
|
`;
|
|
79738
79766
|
}
|
|
79739
79767
|
if (which === "artifacts") {
|
|
@@ -79748,6 +79776,7 @@ if (window.__houdini__nav_caches__ && window.__houdini__nav_caches__.artifact_ca
|
|
|
79748
79776
|
}
|
|
79749
79777
|
},
|
|
79750
79778
|
async configureServer(server) {
|
|
79779
|
+
devServer = true;
|
|
79751
79780
|
await writeTsconfig(server.houdiniConfig);
|
|
79752
79781
|
server.middlewares.use(async (req, res, next) => {
|
|
79753
79782
|
if (!req.url) {
|
|
@@ -79774,14 +79803,11 @@ if (window.__houdini__nav_caches__ && window.__houdini__nav_caches__.artifact_ca
|
|
|
79774
79803
|
}
|
|
79775
79804
|
let yoga = null;
|
|
79776
79805
|
if (project_manifest.local_yoga) {
|
|
79777
|
-
const yogaPath = path_exports.join(
|
|
79778
|
-
server.houdiniConfig.localApiDir,
|
|
79779
|
-
"+yoga?t=" + new Date().getTime()
|
|
79780
|
-
);
|
|
79806
|
+
const yogaPath = path_exports.join(server.houdiniConfig.localApiDir, "+yoga");
|
|
79781
79807
|
yoga = await server.ssrLoadModule(yogaPath);
|
|
79782
79808
|
}
|
|
79783
|
-
const {
|
|
79784
|
-
conventions_exports.server_adapter_path(server.houdiniConfig)
|
|
79809
|
+
const { createServerAdapter } = await server.ssrLoadModule(
|
|
79810
|
+
conventions_exports.server_adapter_path(server.houdiniConfig)
|
|
79785
79811
|
);
|
|
79786
79812
|
const requestHeaders = new Headers();
|
|
79787
79813
|
for (const header of Object.entries(req.headers ?? {})) {
|
|
@@ -79798,7 +79824,7 @@ if (window.__houdini__nav_caches__ && window.__houdini__nav_caches__.artifact_ca
|
|
|
79798
79824
|
for (const [key, value] of Object.entries(req.headers)) {
|
|
79799
79825
|
request.headers.set(key, value);
|
|
79800
79826
|
}
|
|
79801
|
-
const result = await
|
|
79827
|
+
const result = await createServerAdapter({
|
|
79802
79828
|
schema,
|
|
79803
79829
|
yoga,
|
|
79804
79830
|
production: false,
|
|
@@ -79984,7 +80010,7 @@ export function useFragmentHandle(reference: { readonly "${fragmentKey}": { ${do
|
|
|
79984
80010
|
if (_env) {
|
|
79985
80011
|
return _env;
|
|
79986
80012
|
}
|
|
79987
|
-
_env = (0,
|
|
80013
|
+
_env = (0, import_vite2.loadEnv)("dev", config.projectRoot || ".", "");
|
|
79988
80014
|
return _env;
|
|
79989
80015
|
}
|
|
79990
80016
|
});
|
|
@@ -78406,7 +78406,7 @@ function exec(match, params) {
|
|
|
78406
78406
|
const result = {};
|
|
78407
78407
|
const values = match.slice(1);
|
|
78408
78408
|
let buffered = "";
|
|
78409
|
-
for (let i2 = 0; i2 < params.length; i2 += 1) {
|
|
78409
|
+
for (let i2 = 0; i2 < (params || []).length; i2 += 1) {
|
|
78410
78410
|
const param = params[i2];
|
|
78411
78411
|
let value = values[i2];
|
|
78412
78412
|
if (param.chained && param.rest && buffered) {
|
|
@@ -78946,7 +78946,7 @@ async function extractQueries(source) {
|
|
|
78946
78946
|
return props.filter((p) => p !== "children");
|
|
78947
78947
|
}
|
|
78948
78948
|
function isSecondaryBuild() {
|
|
78949
|
-
return process.env.
|
|
78949
|
+
return process.env.HOUDINI_SECONDARY_BUILD && process.env.HOUDINI_SECONDARY_BUILD !== "false";
|
|
78950
78950
|
}
|
|
78951
78951
|
function internalRoutes(config2) {
|
|
78952
78952
|
const routes = [localApiEndpoint(config2)];
|
|
@@ -78956,9 +78956,9 @@ function internalRoutes(config2) {
|
|
|
78956
78956
|
return routes;
|
|
78957
78957
|
}
|
|
78958
78958
|
async function buildLocalSchema(config2) {
|
|
78959
|
-
const { build } = await import("vite");
|
|
78960
|
-
process.env.
|
|
78961
|
-
await
|
|
78959
|
+
const { build: build2 } = await import("vite");
|
|
78960
|
+
process.env.HOUDINI_SECONDARY_BUILD = "true";
|
|
78961
|
+
await build2({
|
|
78962
78962
|
logLevel: "silent",
|
|
78963
78963
|
build: {
|
|
78964
78964
|
outDir: path2.join(config2.rootDir, "temp"),
|
|
@@ -78979,7 +78979,7 @@ async function buildLocalSchema(config2) {
|
|
|
78979
78979
|
}
|
|
78980
78980
|
}
|
|
78981
78981
|
});
|
|
78982
|
-
process.env.
|
|
78982
|
+
process.env.HOUDINI_SECONDARY_BUILD = "false";
|
|
78983
78983
|
}
|
|
78984
78984
|
async function loadLocalSchema(config2) {
|
|
78985
78985
|
await buildLocalSchema(config2);
|
|
@@ -79218,12 +79218,8 @@ async function generate_renders({
|
|
|
79218
79218
|
config,
|
|
79219
79219
|
manifest: manifest3
|
|
79220
79220
|
}) {
|
|
79221
|
+
const adapter_path = conventions_exports.server_adapter_path(config);
|
|
79221
79222
|
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
|
-
`;
|
|
79227
79223
|
const app_index = `
|
|
79228
79224
|
import { Router } from '$houdini/plugins/houdini-react/runtime'
|
|
79229
79225
|
import React from 'react'
|
|
@@ -79247,7 +79243,8 @@ import { router_cache } from '../../runtime/routing'
|
|
|
79247
79243
|
// @ts-expect-error
|
|
79248
79244
|
import client from '../../../../../src/+client'
|
|
79249
79245
|
// @ts-expect-error
|
|
79250
|
-
import App from
|
|
79246
|
+
import App from "./App"
|
|
79247
|
+
import router_manifest from '$houdini/plugins/houdini-react/runtime/manifest'
|
|
79251
79248
|
|
|
79252
79249
|
export const on_render =
|
|
79253
79250
|
({ assetPrefix, pipe, production, documentPremable }) =>
|
|
@@ -79289,7 +79286,7 @@ export const on_render =
|
|
|
79289
79286
|
window.__houdini__initial__session__ = \${JSON.stringify(session)};
|
|
79290
79287
|
<\/script>
|
|
79291
79288
|
|
|
79292
|
-
\${documentPremable}
|
|
79289
|
+
\${documentPremable ?? ''}
|
|
79293
79290
|
|
|
79294
79291
|
<!--
|
|
79295
79292
|
add a virtual module that hydrates the client and sets up the initial pending cache.
|
|
@@ -79306,25 +79303,18 @@ export const on_render =
|
|
|
79306
79303
|
}
|
|
79307
79304
|
}
|
|
79308
79305
|
|
|
79309
|
-
export function
|
|
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) {
|
|
79306
|
+
export function createServerAdapter(options) {
|
|
79318
79307
|
return serverAdapterFactory({
|
|
79319
79308
|
client,
|
|
79320
79309
|
production: true,
|
|
79310
|
+
manifest: router_manifest,
|
|
79311
|
+
on_render: on_render(options),
|
|
79321
79312
|
...options,
|
|
79322
|
-
on_render: on_render({ assetPrefix: options.assetPrefix }),
|
|
79323
79313
|
})
|
|
79324
79314
|
}
|
|
79325
79315
|
`;
|
|
79326
79316
|
let adapter_config = `
|
|
79327
|
-
import createAdapter from './server'
|
|
79317
|
+
import { createServerAdapter as createAdapter } from './server'
|
|
79328
79318
|
|
|
79329
79319
|
export const endpoint = ${JSON.stringify(localApiEndpoint(config.configFile))}
|
|
79330
79320
|
|
|
@@ -79343,9 +79333,8 @@ export default function createServerAdapter(options) {
|
|
|
79343
79333
|
`;
|
|
79344
79334
|
await Promise.all([
|
|
79345
79335
|
fs_exports.writeFile(conventions_exports.adapter_config_path(config), adapter_config),
|
|
79346
|
-
fs_exports.writeFile(
|
|
79347
|
-
fs_exports.writeFile(conventions_exports.app_component_path(config), app_index)
|
|
79348
|
-
fs_exports.writeFile(conventions_exports.vite_render_path(config), vite_render)
|
|
79336
|
+
fs_exports.writeFile(adapter_path, renderer),
|
|
79337
|
+
fs_exports.writeFile(conventions_exports.app_component_path(config), app_index)
|
|
79349
79338
|
]);
|
|
79350
79339
|
}
|
|
79351
79340
|
|
|
@@ -79614,28 +79603,44 @@ async function transformFile(page) {
|
|
|
79614
79603
|
}
|
|
79615
79604
|
|
|
79616
79605
|
// src/plugin/vite.tsx
|
|
79606
|
+
import { build } from "vite";
|
|
79617
79607
|
var manifest;
|
|
79608
|
+
var devServer = false;
|
|
79618
79609
|
var vite_default = {
|
|
79619
79610
|
async config(config, env) {
|
|
79620
79611
|
manifest = await load_manifest({ config, includeArtifacts: env.mode === "production" });
|
|
79621
79612
|
setManifest(manifest);
|
|
79622
|
-
let
|
|
79623
|
-
|
|
79624
|
-
|
|
79613
|
+
let conf = {
|
|
79614
|
+
build: {
|
|
79615
|
+
rollupOptions: {}
|
|
79616
|
+
}
|
|
79617
|
+
};
|
|
79618
|
+
if (!isSecondaryBuild() || process.env.HOUDINI_SECONDARY_BUILD === "ssr") {
|
|
79619
|
+
if (env.command === "build") {
|
|
79620
|
+
conf.base = "/assets";
|
|
79621
|
+
}
|
|
79622
|
+
conf.build = {
|
|
79625
79623
|
rollupOptions: {
|
|
79626
79624
|
output: {
|
|
79627
|
-
|
|
79628
|
-
|
|
79625
|
+
assetFileNames: "assets/[name].js",
|
|
79626
|
+
entryFileNames: "[name].js"
|
|
79627
|
+
},
|
|
79628
|
+
external: ["react-streaming/server"]
|
|
79629
79629
|
}
|
|
79630
79630
|
};
|
|
79631
79631
|
await fs_exports.mkdirp(config.compiledAssetsDir);
|
|
79632
|
-
|
|
79633
|
-
|
|
79632
|
+
conf.build.rollupOptions.input = {
|
|
79633
|
+
"entries/app": conventions_exports.app_component_path(config),
|
|
79634
|
+
"entries/adapter": conventions_exports.adapter_config_path(config)
|
|
79635
|
+
};
|
|
79634
79636
|
for (const [id, page] of Object.entries(manifest.pages)) {
|
|
79635
|
-
|
|
79637
|
+
conf.build.rollupOptions.input[`pages/${id}`] = `virtual:houdini/pages/${page.id}@${page.queries}.jsx`;
|
|
79636
79638
|
}
|
|
79637
79639
|
for (const artifact of manifest.artifacts) {
|
|
79638
|
-
|
|
79640
|
+
conf.build.rollupOptions.input[`artifacts/${artifact}`] = `virtual:houdini/artifacts/${artifact}.js`;
|
|
79641
|
+
}
|
|
79642
|
+
if (process.env.HOUDINI_SECONDARY_BUILD !== "ssr") {
|
|
79643
|
+
conf.build.outDir = config.compiledAssetsDir;
|
|
79639
79644
|
}
|
|
79640
79645
|
}
|
|
79641
79646
|
return {
|
|
@@ -79647,7 +79652,7 @@ var vite_default = {
|
|
|
79647
79652
|
"~/*": path_exports.join(config.projectRoot, "src", "*")
|
|
79648
79653
|
}
|
|
79649
79654
|
},
|
|
79650
|
-
|
|
79655
|
+
...conf
|
|
79651
79656
|
};
|
|
79652
79657
|
},
|
|
79653
79658
|
resolveId(id) {
|
|
@@ -79659,6 +79664,20 @@ var vite_default = {
|
|
|
79659
79664
|
async buildStart({ houdiniConfig }) {
|
|
79660
79665
|
await writeTsconfig(houdiniConfig);
|
|
79661
79666
|
},
|
|
79667
|
+
async closeBundle(config) {
|
|
79668
|
+
if (isSecondaryBuild() || devServer) {
|
|
79669
|
+
return;
|
|
79670
|
+
}
|
|
79671
|
+
console.log("\u{1F3A9} Generating Server Assets...");
|
|
79672
|
+
process.env.HOUDINI_SECONDARY_BUILD = "ssr";
|
|
79673
|
+
await build({
|
|
79674
|
+
build: {
|
|
79675
|
+
ssr: true,
|
|
79676
|
+
outDir: path_exports.join(config.rootDir, "build", "ssr")
|
|
79677
|
+
}
|
|
79678
|
+
});
|
|
79679
|
+
process.env.HOUDINI_SECONDARY_BUILD = "false";
|
|
79680
|
+
},
|
|
79662
79681
|
async load(id, { config }) {
|
|
79663
79682
|
if (!id.startsWith("virtual:houdini")) {
|
|
79664
79683
|
return;
|
|
@@ -79681,7 +79700,6 @@ var vite_default = {
|
|
|
79681
79700
|
// if there is pending data (or artifacts) then we should prime the caches
|
|
79682
79701
|
let initialData = {}
|
|
79683
79702
|
let initialArtifacts = {}
|
|
79684
|
-
|
|
79685
79703
|
if (!window.__houdini__cache__) {
|
|
79686
79704
|
window.__houdini__cache__ = new Cache()
|
|
79687
79705
|
window.__houdini__hydration__layer__ = window.__houdini__cache__._internal_unstable.storage.createLayer(true)
|
|
@@ -79722,8 +79740,18 @@ var vite_default = {
|
|
|
79722
79740
|
window.__houdini__hydration__layer__
|
|
79723
79741
|
)
|
|
79724
79742
|
|
|
79743
|
+
// get the initial url from the window
|
|
79744
|
+
const url = window.location.pathname
|
|
79745
|
+
|
|
79746
|
+
const app = <App
|
|
79747
|
+
initialURL={url}
|
|
79748
|
+
cache={window.__houdini__cache__}
|
|
79749
|
+
session={window.__houdini__initial__session__}
|
|
79750
|
+
{...window.__houdini__nav_caches__}
|
|
79751
|
+
/>
|
|
79752
|
+
|
|
79725
79753
|
// hydrate the application for interactivity
|
|
79726
|
-
hydrateRoot(document,
|
|
79754
|
+
hydrateRoot(document, app)
|
|
79727
79755
|
`;
|
|
79728
79756
|
}
|
|
79729
79757
|
if (which === "artifacts") {
|
|
@@ -79738,6 +79766,7 @@ if (window.__houdini__nav_caches__ && window.__houdini__nav_caches__.artifact_ca
|
|
|
79738
79766
|
}
|
|
79739
79767
|
},
|
|
79740
79768
|
async configureServer(server) {
|
|
79769
|
+
devServer = true;
|
|
79741
79770
|
await writeTsconfig(server.houdiniConfig);
|
|
79742
79771
|
server.middlewares.use(async (req, res, next) => {
|
|
79743
79772
|
if (!req.url) {
|
|
@@ -79764,14 +79793,11 @@ if (window.__houdini__nav_caches__ && window.__houdini__nav_caches__.artifact_ca
|
|
|
79764
79793
|
}
|
|
79765
79794
|
let yoga = null;
|
|
79766
79795
|
if (project_manifest.local_yoga) {
|
|
79767
|
-
const yogaPath = path_exports.join(
|
|
79768
|
-
server.houdiniConfig.localApiDir,
|
|
79769
|
-
"+yoga?t=" + new Date().getTime()
|
|
79770
|
-
);
|
|
79796
|
+
const yogaPath = path_exports.join(server.houdiniConfig.localApiDir, "+yoga");
|
|
79771
79797
|
yoga = await server.ssrLoadModule(yogaPath);
|
|
79772
79798
|
}
|
|
79773
|
-
const {
|
|
79774
|
-
conventions_exports.server_adapter_path(server.houdiniConfig)
|
|
79799
|
+
const { createServerAdapter } = await server.ssrLoadModule(
|
|
79800
|
+
conventions_exports.server_adapter_path(server.houdiniConfig)
|
|
79775
79801
|
);
|
|
79776
79802
|
const requestHeaders = new Headers();
|
|
79777
79803
|
for (const header of Object.entries(req.headers ?? {})) {
|
|
@@ -79788,7 +79814,7 @@ if (window.__houdini__nav_caches__ && window.__houdini__nav_caches__.artifact_ca
|
|
|
79788
79814
|
for (const [key, value] of Object.entries(req.headers)) {
|
|
79789
79815
|
request.headers.set(key, value);
|
|
79790
79816
|
}
|
|
79791
|
-
const result = await
|
|
79817
|
+
const result = await createServerAdapter({
|
|
79792
79818
|
schema,
|
|
79793
79819
|
yoga,
|
|
79794
79820
|
production: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini-react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.24",
|
|
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.
|
|
45
|
+
"houdini": "^1.2.24"
|
|
46
46
|
},
|
|
47
47
|
"files": [
|
|
48
48
|
"build"
|