houdini-react 1.2.12 → 1.2.14
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/codegen/render.d.ts +5 -2
- package/build/plugin/vite.d.ts +8 -10
- package/build/plugin-cjs/index.js +267 -528
- package/build/plugin-esm/index.js +265 -526
- package/build/runtime/client.d.ts +1 -1
- package/build/runtime/index.d.ts +2 -9
- package/build/runtime/manifest.d.ts +1 -1
- package/build/runtime/routing/{components/Router.d.ts → Router.d.ts} +5 -9
- package/build/runtime/routing/index.d.ts +2 -3
- package/build/runtime-cjs/client.d.ts +1 -1
- package/build/runtime-cjs/client.js +2 -1
- package/build/runtime-cjs/hooks/useDocumentHandle.js +1 -1
- package/build/runtime-cjs/hooks/useDocumentSubscription.js +1 -1
- package/build/runtime-cjs/hooks/useFragment.js +5 -3
- package/build/runtime-cjs/hooks/useMutation.js +1 -1
- package/build/runtime-cjs/index.d.ts +2 -9
- package/build/runtime-cjs/index.js +7 -20
- package/build/runtime-cjs/manifest.d.ts +1 -1
- package/build/runtime-cjs/routing/{components/Router.d.ts → Router.d.ts} +5 -9
- package/build/runtime-cjs/routing/{components/Router.js → Router.js} +3 -17
- package/build/runtime-cjs/routing/index.d.ts +2 -3
- package/build/runtime-cjs/routing/index.js +2 -2
- package/build/runtime-esm/client.d.ts +1 -1
- package/build/runtime-esm/client.js +2 -1
- package/build/runtime-esm/hooks/useDocumentHandle.js +1 -1
- package/build/runtime-esm/hooks/useDocumentSubscription.js +1 -1
- package/build/runtime-esm/hooks/useFragment.js +4 -2
- package/build/runtime-esm/hooks/useMutation.js +1 -1
- package/build/runtime-esm/index.d.ts +2 -9
- package/build/runtime-esm/index.js +7 -16
- package/build/runtime-esm/manifest.d.ts +1 -1
- package/build/runtime-esm/routing/{components/Router.d.ts → Router.d.ts} +5 -9
- package/build/runtime-esm/routing/{components/Router.js → Router.js} +3 -17
- package/build/runtime-esm/routing/index.d.ts +2 -3
- package/build/runtime-esm/routing/index.js +2 -2
- package/package.json +3 -2
- package/build/runtime/routing/components/index.d.ts +0 -1
- package/build/runtime/routing/lib/match.d.ts +0 -38
- package/build/runtime/routing/lib/types.d.ts +0 -19
- package/build/runtime-cjs/routing/components/index.d.ts +0 -1
- package/build/runtime-cjs/routing/components/index.js +0 -34
- package/build/runtime-cjs/routing/lib/match.d.ts +0 -38
- package/build/runtime-cjs/routing/lib/match.js +0 -149
- package/build/runtime-cjs/routing/lib/types.d.ts +0 -19
- package/build/runtime-cjs/routing/lib/types.js +0 -16
- package/build/runtime-esm/routing/components/index.d.ts +0 -1
- package/build/runtime-esm/routing/components/index.js +0 -7
- package/build/runtime-esm/routing/lib/match.d.ts +0 -38
- package/build/runtime-esm/routing/lib/match.js +0 -122
- package/build/runtime-esm/routing/lib/types.d.ts +0 -19
- package/build/runtime-esm/routing/lib/types.js +0 -0
- /package/build/runtime/routing/{lib/cache.d.ts → cache.d.ts} +0 -0
- /package/build/runtime-cjs/routing/{lib/cache.d.ts → cache.d.ts} +0 -0
- /package/build/runtime-cjs/routing/{lib/cache.js → cache.js} +0 -0
- /package/build/runtime-esm/routing/{lib/cache.d.ts → cache.d.ts} +0 -0
- /package/build/runtime-esm/routing/{lib/cache.js → cache.js} +0 -0
|
@@ -16410,7 +16410,6 @@ import { deprecate as deprecate2 } from "node:util";
|
|
|
16410
16410
|
import * as graphql3 from "graphql";
|
|
16411
16411
|
import * as graphql4 from "graphql";
|
|
16412
16412
|
import * as graphql5 from "graphql";
|
|
16413
|
-
import { build } from "vite";
|
|
16414
16413
|
var require2 = conflict_free(import.meta.url);
|
|
16415
16414
|
var __create2 = Object.create;
|
|
16416
16415
|
var __defProp2 = Object.defineProperty;
|
|
@@ -74884,8 +74883,8 @@ function computeID(configFile, type, data) {
|
|
|
74884
74883
|
return id.slice(0, -2);
|
|
74885
74884
|
}
|
|
74886
74885
|
var _configFile = null;
|
|
74887
|
-
function
|
|
74888
|
-
return configFile.router?.
|
|
74886
|
+
function localApiEndpoint(configFile) {
|
|
74887
|
+
return configFile.router?.apiEndpoint ?? "/_api";
|
|
74889
74888
|
}
|
|
74890
74889
|
function getCurrentConfig() {
|
|
74891
74890
|
const mockConfig2 = getMockConfig();
|
|
@@ -75577,10 +75576,10 @@ var validateHeaderValue = typeof http.validateHeaderValue === "function" ? http.
|
|
|
75577
75576
|
throw error;
|
|
75578
75577
|
}
|
|
75579
75578
|
};
|
|
75580
|
-
var
|
|
75579
|
+
var Headers = class extends URLSearchParams {
|
|
75581
75580
|
constructor(init) {
|
|
75582
75581
|
let result = [];
|
|
75583
|
-
if (init instanceof
|
|
75582
|
+
if (init instanceof Headers) {
|
|
75584
75583
|
const raw = init.raw();
|
|
75585
75584
|
for (const [name, values] of Object.entries(raw)) {
|
|
75586
75585
|
result.push(...values.map((value) => [name, value]));
|
|
@@ -75704,7 +75703,7 @@ var Headers2 = class extends URLSearchParams {
|
|
|
75704
75703
|
}
|
|
75705
75704
|
};
|
|
75706
75705
|
Object.defineProperties(
|
|
75707
|
-
|
|
75706
|
+
Headers.prototype,
|
|
75708
75707
|
["get", "entries", "forEach", "values"].reduce((result, property) => {
|
|
75709
75708
|
result[property] = { enumerable: true };
|
|
75710
75709
|
return result;
|
|
@@ -75719,7 +75718,7 @@ var Response2 = class extends Body {
|
|
|
75719
75718
|
constructor(body = null, options = {}) {
|
|
75720
75719
|
super(body, options);
|
|
75721
75720
|
const status = options.status != null ? options.status : 200;
|
|
75722
|
-
const headers = new
|
|
75721
|
+
const headers = new Headers(options.headers);
|
|
75723
75722
|
if (body !== null && !headers.has("Content-Type")) {
|
|
75724
75723
|
const contentType = extractContentType(body, this);
|
|
75725
75724
|
if (contentType) {
|
|
@@ -75794,7 +75793,7 @@ var Response2 = class extends Body {
|
|
|
75794
75793
|
if (body === void 0) {
|
|
75795
75794
|
throw new TypeError("data is not JSON serializable");
|
|
75796
75795
|
}
|
|
75797
|
-
const headers = new
|
|
75796
|
+
const headers = new Headers(init && init.headers);
|
|
75798
75797
|
if (!headers.has("content-type")) {
|
|
75799
75798
|
headers.set("content-type", "application/json");
|
|
75800
75799
|
}
|
|
@@ -75870,7 +75869,7 @@ var Request2 = class extends Body {
|
|
|
75870
75869
|
super(inputBody, {
|
|
75871
75870
|
size: init.size || input.size || 0
|
|
75872
75871
|
});
|
|
75873
|
-
const headers = new
|
|
75872
|
+
const headers = new Headers(init.headers || input.headers || {});
|
|
75874
75873
|
if (inputBody !== null && !headers.has("Content-Type")) {
|
|
75875
75874
|
const contentType = extractContentType(inputBody, this);
|
|
75876
75875
|
if (contentType) {
|
|
@@ -78229,7 +78228,7 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
78229
78228
|
}
|
|
78230
78229
|
};
|
|
78231
78230
|
});
|
|
78232
|
-
var currentDir =
|
|
78231
|
+
var currentDir = dirname(fileURLToPath(import.meta.url));
|
|
78233
78232
|
var DEFAULT_CONFIG_PATH = join2(process.cwd(), "houdini.config.js");
|
|
78234
78233
|
var emptySchema = graphql2.buildSchema("type Query { hello: String }");
|
|
78235
78234
|
var defaultDirectives = emptySchema.getDirectives().map((dir) => dir.name);
|
|
@@ -78311,6 +78310,122 @@ function ensureImports({
|
|
|
78311
78310
|
}
|
|
78312
78311
|
return Array.isArray(importID) ? toImport : toImport[0];
|
|
78313
78312
|
}
|
|
78313
|
+
var param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
|
|
78314
|
+
function find_match(manifest3, current, allowNull = true) {
|
|
78315
|
+
let match = null;
|
|
78316
|
+
let matchVariables = null;
|
|
78317
|
+
for (const page of Object.values(manifest3.pages)) {
|
|
78318
|
+
const urlMatch = current.match(page.pattern);
|
|
78319
|
+
if (!urlMatch) {
|
|
78320
|
+
continue;
|
|
78321
|
+
}
|
|
78322
|
+
match = page;
|
|
78323
|
+
matchVariables = exec(urlMatch, page.params) || {};
|
|
78324
|
+
break;
|
|
78325
|
+
}
|
|
78326
|
+
if (!match && !allowNull) {
|
|
78327
|
+
throw new Error("404");
|
|
78328
|
+
}
|
|
78329
|
+
return [match, matchVariables];
|
|
78330
|
+
}
|
|
78331
|
+
function parse_page_pattern(id) {
|
|
78332
|
+
const params = [];
|
|
78333
|
+
const pattern = id === "/" ? /^\/$/ : new RegExp(
|
|
78334
|
+
`^${get_route_segments(id).map((segment) => {
|
|
78335
|
+
const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
|
|
78336
|
+
if (rest_match) {
|
|
78337
|
+
params.push({
|
|
78338
|
+
name: rest_match[1],
|
|
78339
|
+
matcher: rest_match[2],
|
|
78340
|
+
optional: false,
|
|
78341
|
+
rest: true,
|
|
78342
|
+
chained: true
|
|
78343
|
+
});
|
|
78344
|
+
return "(?:/(.*))?";
|
|
78345
|
+
}
|
|
78346
|
+
const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment);
|
|
78347
|
+
if (optional_match) {
|
|
78348
|
+
params.push({
|
|
78349
|
+
name: optional_match[1],
|
|
78350
|
+
matcher: optional_match[2],
|
|
78351
|
+
optional: true,
|
|
78352
|
+
rest: false,
|
|
78353
|
+
chained: true
|
|
78354
|
+
});
|
|
78355
|
+
return "(?:/([^/]+))?";
|
|
78356
|
+
}
|
|
78357
|
+
if (!segment) {
|
|
78358
|
+
return;
|
|
78359
|
+
}
|
|
78360
|
+
const parts = segment.split(/\[(.+?)\](?!\])/);
|
|
78361
|
+
const result = parts.map((content, i2) => {
|
|
78362
|
+
if (i2 % 2) {
|
|
78363
|
+
if (content.startsWith("x+")) {
|
|
78364
|
+
return escape2(
|
|
78365
|
+
String.fromCharCode(parseInt(content.slice(2), 16))
|
|
78366
|
+
);
|
|
78367
|
+
}
|
|
78368
|
+
if (content.startsWith("u+")) {
|
|
78369
|
+
return escape2(
|
|
78370
|
+
String.fromCharCode(
|
|
78371
|
+
...content.slice(2).split("-").map((code) => parseInt(code, 16))
|
|
78372
|
+
)
|
|
78373
|
+
);
|
|
78374
|
+
}
|
|
78375
|
+
const match = param_pattern.exec(content);
|
|
78376
|
+
if (!match) {
|
|
78377
|
+
throw new Error(
|
|
78378
|
+
`Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
|
|
78379
|
+
);
|
|
78380
|
+
}
|
|
78381
|
+
const [, is_optional, is_rest, name, matcher] = match;
|
|
78382
|
+
params.push({
|
|
78383
|
+
name,
|
|
78384
|
+
matcher,
|
|
78385
|
+
optional: !!is_optional,
|
|
78386
|
+
rest: !!is_rest,
|
|
78387
|
+
chained: is_rest ? i2 === 1 && parts[0] === "" : false
|
|
78388
|
+
});
|
|
78389
|
+
return is_rest ? "(.*?)" : is_optional ? "([^/]*)?" : "([^/]+?)";
|
|
78390
|
+
}
|
|
78391
|
+
return escape2(content);
|
|
78392
|
+
}).join("");
|
|
78393
|
+
return "/" + result;
|
|
78394
|
+
}).join("")}/?$`
|
|
78395
|
+
);
|
|
78396
|
+
return { pattern, params, page_id: id };
|
|
78397
|
+
}
|
|
78398
|
+
function affects_path(segment) {
|
|
78399
|
+
return !/^\([^)]+\)$/.test(segment);
|
|
78400
|
+
}
|
|
78401
|
+
function get_route_segments(route) {
|
|
78402
|
+
return route.slice(1).split("/").filter(affects_path);
|
|
78403
|
+
}
|
|
78404
|
+
function exec(match, params) {
|
|
78405
|
+
const result = {};
|
|
78406
|
+
const values = match.slice(1);
|
|
78407
|
+
let buffered = "";
|
|
78408
|
+
for (let i2 = 0; i2 < params.length; i2 += 1) {
|
|
78409
|
+
const param = params[i2];
|
|
78410
|
+
let value = values[i2];
|
|
78411
|
+
if (param.chained && param.rest && buffered) {
|
|
78412
|
+
value = value ? buffered + "/" + value : buffered;
|
|
78413
|
+
}
|
|
78414
|
+
buffered = "";
|
|
78415
|
+
if (value === void 0) {
|
|
78416
|
+
if (param.rest)
|
|
78417
|
+
result[param.name] = "";
|
|
78418
|
+
} else {
|
|
78419
|
+
result[param.name] = value;
|
|
78420
|
+
}
|
|
78421
|
+
}
|
|
78422
|
+
if (buffered)
|
|
78423
|
+
return;
|
|
78424
|
+
return result;
|
|
78425
|
+
}
|
|
78426
|
+
function escape2(str) {
|
|
78427
|
+
return str.normalize().replace(/[[\]]/g, "\\$&").replace(/%/g, "%25").replace(/\//g, "%2[Ff]").replace(/\?/g, "%3[Ff]").replace(/#/g, "%23").replace(/[.*+?^${}()|\\]/g, "\\$&");
|
|
78428
|
+
}
|
|
78314
78429
|
var WalkerBase = class {
|
|
78315
78430
|
constructor() {
|
|
78316
78431
|
this.should_skip = false;
|
|
@@ -78488,6 +78603,7 @@ async function find_graphql(config2, parsedScript, walker) {
|
|
|
78488
78603
|
}
|
|
78489
78604
|
var conventions_exports = {};
|
|
78490
78605
|
__export(conventions_exports, {
|
|
78606
|
+
adapter_config_path: () => adapter_config_path,
|
|
78491
78607
|
fallback_unit_path: () => fallback_unit_path,
|
|
78492
78608
|
is_layout: () => is_layout,
|
|
78493
78609
|
layout_unit_path: () => layout_unit_path,
|
|
@@ -78499,13 +78615,10 @@ __export(conventions_exports, {
|
|
|
78499
78615
|
read_layoutView: () => read_layoutView,
|
|
78500
78616
|
read_pageQuery: () => read_pageQuery,
|
|
78501
78617
|
read_pageView: () => read_pageView,
|
|
78502
|
-
render_app_path: () => render_app_path,
|
|
78503
|
-
render_client_path: () => render_client_path,
|
|
78504
|
-
render_server_path: () => render_server_path,
|
|
78505
|
-
render_yoga_path: () => render_yoga_path,
|
|
78506
78618
|
router_index_path: () => router_index_path,
|
|
78507
78619
|
router_path: () => router_path,
|
|
78508
|
-
serialized_manifest_path: () => serialized_manifest_path
|
|
78620
|
+
serialized_manifest_path: () => serialized_manifest_path,
|
|
78621
|
+
server_adapter_path: () => server_adapter_path
|
|
78509
78622
|
});
|
|
78510
78623
|
function router_path(config2) {
|
|
78511
78624
|
return path_exports.join(base_dir(config2), "Router.jsx");
|
|
@@ -78513,17 +78626,11 @@ function router_path(config2) {
|
|
|
78513
78626
|
function page_entry_path(config2, id, base) {
|
|
78514
78627
|
return path_exports.join(page_entries_dir(config2, base), `${id}.jsx`);
|
|
78515
78628
|
}
|
|
78516
|
-
function
|
|
78517
|
-
return path_exports.join(units_dir(config2, base), "render", "client.jsx");
|
|
78518
|
-
}
|
|
78519
|
-
function render_server_path(config2, base) {
|
|
78629
|
+
function server_adapter_path(config2, base) {
|
|
78520
78630
|
return path_exports.join(units_dir(config2, base), "render", "server.js");
|
|
78521
78631
|
}
|
|
78522
|
-
function
|
|
78523
|
-
return path_exports.join(units_dir(config2, base), "render", "
|
|
78524
|
-
}
|
|
78525
|
-
function render_app_path(config2, base) {
|
|
78526
|
-
return path_exports.join(units_dir(config2, base), "render", "App.jsx");
|
|
78632
|
+
function adapter_config_path(config2, base) {
|
|
78633
|
+
return path_exports.join(units_dir(config2, base), "render", "config.js");
|
|
78527
78634
|
}
|
|
78528
78635
|
function page_unit_path(config2, id, base) {
|
|
78529
78636
|
return path_exports.join(page_units_dir(config2, base), `${id}.jsx`);
|
|
@@ -78829,248 +78936,9 @@ async function extractQueries(source) {
|
|
|
78829
78936
|
}
|
|
78830
78937
|
return props.filter((p) => p !== "children");
|
|
78831
78938
|
}
|
|
78832
|
-
function
|
|
78939
|
+
function isSecondaryBuild() {
|
|
78833
78940
|
return process.env.HOUDINI_SCHEMA_BUILD === "true";
|
|
78834
78941
|
}
|
|
78835
|
-
function parse6(str, options) {
|
|
78836
|
-
if (typeof str !== "string") {
|
|
78837
|
-
throw new TypeError("argument str must be a string");
|
|
78838
|
-
}
|
|
78839
|
-
let obj = {};
|
|
78840
|
-
let opt = options || {};
|
|
78841
|
-
let dec = opt.decode || decode;
|
|
78842
|
-
let index = 0;
|
|
78843
|
-
while (index < str.length) {
|
|
78844
|
-
let eqIdx = str.indexOf("=", index);
|
|
78845
|
-
if (eqIdx === -1) {
|
|
78846
|
-
break;
|
|
78847
|
-
}
|
|
78848
|
-
let endIdx = str.indexOf(";", index);
|
|
78849
|
-
if (endIdx === -1) {
|
|
78850
|
-
endIdx = str.length;
|
|
78851
|
-
} else if (endIdx < eqIdx) {
|
|
78852
|
-
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
78853
|
-
continue;
|
|
78854
|
-
}
|
|
78855
|
-
let key = str.slice(index, eqIdx).trim();
|
|
78856
|
-
if (void 0 === obj[key]) {
|
|
78857
|
-
let val = str.slice(eqIdx + 1, endIdx).trim();
|
|
78858
|
-
if (val.charCodeAt(0) === 34) {
|
|
78859
|
-
val = val.slice(1, -1);
|
|
78860
|
-
}
|
|
78861
|
-
obj[key] = tryDecode(val, dec);
|
|
78862
|
-
}
|
|
78863
|
-
index = endIdx + 1;
|
|
78864
|
-
}
|
|
78865
|
-
return obj;
|
|
78866
|
-
}
|
|
78867
|
-
function decode(str) {
|
|
78868
|
-
return str.indexOf("%") !== -1 ? decodeURIComponent(str) : str;
|
|
78869
|
-
}
|
|
78870
|
-
function tryDecode(str, decode3) {
|
|
78871
|
-
try {
|
|
78872
|
-
return decode3(str);
|
|
78873
|
-
} catch (e2) {
|
|
78874
|
-
return str;
|
|
78875
|
-
}
|
|
78876
|
-
}
|
|
78877
|
-
function base64UrlParse(s2) {
|
|
78878
|
-
return new Uint8Array(
|
|
78879
|
-
Array.prototype.map.call(
|
|
78880
|
-
atob(s2.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "")),
|
|
78881
|
-
(c) => c.charCodeAt(0)
|
|
78882
|
-
)
|
|
78883
|
-
);
|
|
78884
|
-
}
|
|
78885
|
-
function base64UrlStringify(a) {
|
|
78886
|
-
return btoa(String.fromCharCode.apply(0, a)).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
|
|
78887
|
-
}
|
|
78888
|
-
var algorithms = {
|
|
78889
|
-
ES256: { name: "ECDSA", namedCurve: "P-256", hash: { name: "SHA-256" } },
|
|
78890
|
-
ES384: { name: "ECDSA", namedCurve: "P-384", hash: { name: "SHA-384" } },
|
|
78891
|
-
ES512: { name: "ECDSA", namedCurve: "P-521", hash: { name: "SHA-512" } },
|
|
78892
|
-
HS256: { name: "HMAC", hash: { name: "SHA-256" } },
|
|
78893
|
-
HS384: { name: "HMAC", hash: { name: "SHA-384" } },
|
|
78894
|
-
HS512: { name: "HMAC", hash: { name: "SHA-512" } },
|
|
78895
|
-
RS256: { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-256" } },
|
|
78896
|
-
RS384: { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-384" } },
|
|
78897
|
-
RS512: { name: "RSASSA-PKCS1-v1_5", hash: { name: "SHA-512" } }
|
|
78898
|
-
};
|
|
78899
|
-
function _utf8ToUint8Array(str) {
|
|
78900
|
-
return base64UrlParse(btoa(unescape(encodeURIComponent(str))));
|
|
78901
|
-
}
|
|
78902
|
-
function _str2ab(str) {
|
|
78903
|
-
str = atob(str);
|
|
78904
|
-
const buf = new ArrayBuffer(str.length);
|
|
78905
|
-
const bufView = new Uint8Array(buf);
|
|
78906
|
-
for (let i2 = 0, strLen = str.length; i2 < strLen; i2++) {
|
|
78907
|
-
bufView[i2] = str.charCodeAt(i2);
|
|
78908
|
-
}
|
|
78909
|
-
return buf;
|
|
78910
|
-
}
|
|
78911
|
-
function _decodePayload(raw) {
|
|
78912
|
-
switch (raw.length % 4) {
|
|
78913
|
-
case 0:
|
|
78914
|
-
break;
|
|
78915
|
-
case 2:
|
|
78916
|
-
raw += "==";
|
|
78917
|
-
break;
|
|
78918
|
-
case 3:
|
|
78919
|
-
raw += "=";
|
|
78920
|
-
break;
|
|
78921
|
-
default:
|
|
78922
|
-
throw new Error("Illegal base64url string!");
|
|
78923
|
-
}
|
|
78924
|
-
try {
|
|
78925
|
-
return JSON.parse(decodeURIComponent(escape(atob(raw))));
|
|
78926
|
-
} catch {
|
|
78927
|
-
return null;
|
|
78928
|
-
}
|
|
78929
|
-
}
|
|
78930
|
-
async function encode(payload, secret, options = { algorithm: "HS256", header: { typ: "JWT" } }) {
|
|
78931
|
-
if (typeof options === "string")
|
|
78932
|
-
options = { algorithm: options, header: { typ: "JWT" } };
|
|
78933
|
-
options = { algorithm: "HS256", header: { typ: "JWT" }, ...options };
|
|
78934
|
-
if (payload === null || typeof payload !== "object")
|
|
78935
|
-
throw new Error("payload must be an object");
|
|
78936
|
-
if (typeof secret !== "string" && typeof secret !== "object")
|
|
78937
|
-
throw new Error("secret must be a string or a JWK object");
|
|
78938
|
-
if (typeof options.algorithm !== "string")
|
|
78939
|
-
throw new Error("options.algorithm must be a string");
|
|
78940
|
-
const algorithm = algorithms[options.algorithm];
|
|
78941
|
-
if (!algorithm)
|
|
78942
|
-
throw new Error("algorithm not found");
|
|
78943
|
-
if (!payload.iat)
|
|
78944
|
-
payload.iat = Math.floor(Date.now() / 1e3);
|
|
78945
|
-
const payloadAsJSON = JSON.stringify(payload);
|
|
78946
|
-
const partialToken = `${base64UrlStringify(
|
|
78947
|
-
_utf8ToUint8Array(JSON.stringify({ ...options.header, alg: options.algorithm }))
|
|
78948
|
-
)}.${base64UrlStringify(_utf8ToUint8Array(payloadAsJSON))}`;
|
|
78949
|
-
let keyFormat = "raw";
|
|
78950
|
-
let keyData;
|
|
78951
|
-
if (typeof secret === "object") {
|
|
78952
|
-
keyFormat = "jwk";
|
|
78953
|
-
keyData = secret;
|
|
78954
|
-
} else if (typeof secret === "string" && secret.startsWith("-----BEGIN")) {
|
|
78955
|
-
keyFormat = "pkcs8";
|
|
78956
|
-
keyData = _str2ab(
|
|
78957
|
-
secret.replace(/-----BEGIN.*?-----/g, "").replace(/-----END.*?-----/g, "").replace(/\s/g, "")
|
|
78958
|
-
);
|
|
78959
|
-
} else
|
|
78960
|
-
keyData = _utf8ToUint8Array(secret);
|
|
78961
|
-
const key = await crypto.subtle.importKey(keyFormat, keyData, algorithm, false, ["sign"]);
|
|
78962
|
-
const signature = await crypto.subtle.sign(algorithm, key, _utf8ToUint8Array(partialToken));
|
|
78963
|
-
return `${partialToken}.${base64UrlStringify(new Uint8Array(signature))}`;
|
|
78964
|
-
}
|
|
78965
|
-
async function verify(token, secret, options = { algorithm: "HS256", throwError: false }) {
|
|
78966
|
-
if (typeof options === "string")
|
|
78967
|
-
options = { algorithm: options, throwError: false };
|
|
78968
|
-
options = { algorithm: "HS256", throwError: false, ...options };
|
|
78969
|
-
if (typeof token !== "string")
|
|
78970
|
-
throw new Error("token must be a string");
|
|
78971
|
-
if (typeof secret !== "string" && typeof secret !== "object")
|
|
78972
|
-
throw new Error("secret must be a string or a JWK object");
|
|
78973
|
-
if (typeof options.algorithm !== "string")
|
|
78974
|
-
throw new Error("options.algorithm must be a string");
|
|
78975
|
-
const tokenParts = token.split(".");
|
|
78976
|
-
if (tokenParts.length !== 3)
|
|
78977
|
-
throw new Error("token must consist of 3 parts");
|
|
78978
|
-
const algorithm = algorithms[options.algorithm];
|
|
78979
|
-
if (!algorithm)
|
|
78980
|
-
throw new Error("algorithm not found");
|
|
78981
|
-
const { payload } = decode2(token);
|
|
78982
|
-
if (!payload) {
|
|
78983
|
-
if (options.throwError)
|
|
78984
|
-
throw "PARSE_ERROR";
|
|
78985
|
-
return false;
|
|
78986
|
-
}
|
|
78987
|
-
if (payload.nbf && payload.nbf > Math.floor(Date.now() / 1e3)) {
|
|
78988
|
-
if (options.throwError)
|
|
78989
|
-
throw "NOT_YET_VALID";
|
|
78990
|
-
return false;
|
|
78991
|
-
}
|
|
78992
|
-
if (payload.exp && payload.exp <= Math.floor(Date.now() / 1e3)) {
|
|
78993
|
-
if (options.throwError)
|
|
78994
|
-
throw "EXPIRED";
|
|
78995
|
-
return false;
|
|
78996
|
-
}
|
|
78997
|
-
let keyFormat = "raw";
|
|
78998
|
-
let keyData;
|
|
78999
|
-
if (typeof secret === "object") {
|
|
79000
|
-
keyFormat = "jwk";
|
|
79001
|
-
keyData = secret;
|
|
79002
|
-
} else if (typeof secret === "string" && secret.startsWith("-----BEGIN")) {
|
|
79003
|
-
keyFormat = "spki";
|
|
79004
|
-
keyData = _str2ab(
|
|
79005
|
-
secret.replace(/-----BEGIN.*?-----/g, "").replace(/-----END.*?-----/g, "").replace(/\s/g, "")
|
|
79006
|
-
);
|
|
79007
|
-
} else
|
|
79008
|
-
keyData = _utf8ToUint8Array(secret);
|
|
79009
|
-
const key = await crypto.subtle.importKey(keyFormat, keyData, algorithm, false, ["verify"]);
|
|
79010
|
-
return await crypto.subtle.verify(
|
|
79011
|
-
algorithm,
|
|
79012
|
-
key,
|
|
79013
|
-
base64UrlParse(tokenParts[2]),
|
|
79014
|
-
_utf8ToUint8Array(`${tokenParts[0]}.${tokenParts[1]}`)
|
|
79015
|
-
);
|
|
79016
|
-
}
|
|
79017
|
-
function decode2(token) {
|
|
79018
|
-
return {
|
|
79019
|
-
header: _decodePayload(
|
|
79020
|
-
token.split(".")[0].replace(/-/g, "+").replace(/_/g, "/")
|
|
79021
|
-
),
|
|
79022
|
-
payload: _decodePayload(
|
|
79023
|
-
token.split(".")[1].replace(/-/g, "+").replace(/_/g, "/")
|
|
79024
|
-
)
|
|
79025
|
-
};
|
|
79026
|
-
}
|
|
79027
|
-
async function handle_request(args) {
|
|
79028
|
-
const plugin_config = args.config.router ?? {};
|
|
79029
|
-
if (plugin_config.auth && "redirect" in plugin_config.auth && args.url.startsWith(plugin_config.auth.redirect)) {
|
|
79030
|
-
return await redirect_auth(args);
|
|
79031
|
-
}
|
|
79032
|
-
args.next();
|
|
79033
|
-
}
|
|
79034
|
-
async function redirect_auth(args) {
|
|
79035
|
-
const { searchParams } = new URL(args.url, `http://${args.get_header("host")}`);
|
|
79036
|
-
const { redirectTo, ...session } = Object.fromEntries(searchParams.entries());
|
|
79037
|
-
await set_session(args, session);
|
|
79038
|
-
if (redirectTo) {
|
|
79039
|
-
return args.redirect(302, redirectTo);
|
|
79040
|
-
}
|
|
79041
|
-
args.next();
|
|
79042
|
-
}
|
|
79043
|
-
var session_cookie_name = "__houdini__";
|
|
79044
|
-
async function set_session(req, value) {
|
|
79045
|
-
const today = new Date();
|
|
79046
|
-
const expires = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1e3);
|
|
79047
|
-
const serialized = await encode(value, req.session_keys[0]);
|
|
79048
|
-
req.set_header(
|
|
79049
|
-
"Set-Cookie",
|
|
79050
|
-
`${session_cookie_name}=${serialized}; Path=/; HttpOnly; Secure; SameSite=Lax; Expires=${expires.toUTCString()} `
|
|
79051
|
-
);
|
|
79052
|
-
}
|
|
79053
|
-
async function get_session(req, secrets) {
|
|
79054
|
-
const cookies = req.get("cookie");
|
|
79055
|
-
if (!cookies) {
|
|
79056
|
-
return {};
|
|
79057
|
-
}
|
|
79058
|
-
const cookie = parse6(cookies)[session_cookie_name];
|
|
79059
|
-
if (!cookie) {
|
|
79060
|
-
return {};
|
|
79061
|
-
}
|
|
79062
|
-
for (const secret of secrets) {
|
|
79063
|
-
if (!await verify(cookie, secret)) {
|
|
79064
|
-
continue;
|
|
79065
|
-
}
|
|
79066
|
-
const parsed = decode2(cookie);
|
|
79067
|
-
if (!parsed) {
|
|
79068
|
-
return {};
|
|
79069
|
-
}
|
|
79070
|
-
return parsed.payload;
|
|
79071
|
-
}
|
|
79072
|
-
return {};
|
|
79073
|
-
}
|
|
79074
78942
|
|
|
79075
78943
|
// src/plugin/index.ts
|
|
79076
78944
|
import path2 from "node:path";
|
|
@@ -79107,7 +78975,7 @@ async function generate_routing_units(args) {
|
|
|
79107
78975
|
const relative_path = path_exports.relative(path_exports.dirname(unit_path), page_path);
|
|
79108
78976
|
const component_name = "Component_" + page.id;
|
|
79109
78977
|
let source = [
|
|
79110
|
-
"import { useQueryResult } from '$houdini/plugins/houdini-react/runtime/routing
|
|
78978
|
+
"import { useQueryResult } from '$houdini/plugins/houdini-react/runtime/routing'",
|
|
79111
78979
|
`import ${component_name} from "${relative_path}"`
|
|
79112
78980
|
];
|
|
79113
78981
|
source.push(`export default ({ children }) => {
|
|
@@ -79299,52 +79167,96 @@ async function write_manifest({
|
|
|
79299
79167
|
}
|
|
79300
79168
|
|
|
79301
79169
|
// src/plugin/codegen/render.ts
|
|
79302
|
-
async function generate_renders(
|
|
79303
|
-
|
|
79304
|
-
|
|
79305
|
-
|
|
79306
|
-
|
|
79307
|
-
|
|
79170
|
+
async function generate_renders({
|
|
79171
|
+
config,
|
|
79172
|
+
manifest: manifest3
|
|
79173
|
+
}) {
|
|
79174
|
+
await fs_exports.mkdirp(path_exports.dirname(conventions_exports.server_adapter_path(config)));
|
|
79175
|
+
let adapter_config = `
|
|
79176
|
+
import createAdapter from './server'
|
|
79308
79177
|
|
|
79309
|
-
export
|
|
79310
|
-
|
|
79311
|
-
|
|
79178
|
+
export const endpoint = ${JSON.stringify(localApiEndpoint(config.configFile))}
|
|
79179
|
+
|
|
79180
|
+
${manifest3.local_schema ? `import schema from '../../../../../src/api/+schema'` : " const schema = null"}
|
|
79181
|
+
|
|
79182
|
+
${manifest3.local_yoga ? `import yoga from '.../../../../../src/api/+yoga'` : " const yoga = null"}
|
|
79183
|
+
|
|
79184
|
+
export function createServerAdapter(options) {
|
|
79185
|
+
return createAdapter({
|
|
79186
|
+
schema,
|
|
79187
|
+
yoga,
|
|
79188
|
+
graphqlEndpoint: endpoint,
|
|
79189
|
+
...options,
|
|
79190
|
+
})
|
|
79191
|
+
}
|
|
79192
|
+
`;
|
|
79193
|
+
const server_adapter = `
|
|
79312
79194
|
import React from 'react'
|
|
79313
79195
|
import { renderToStream } from 'react-streaming/server'
|
|
79196
|
+
import { Cache } from '$houdini/runtime/cache/cache'
|
|
79197
|
+
import { serverAdapterFactory } from '$houdini/runtime/router/server'
|
|
79314
79198
|
|
|
79315
|
-
import
|
|
79316
|
-
import
|
|
79199
|
+
import { Router, router_cache } from '../../runtime'
|
|
79200
|
+
import manifest from '../../runtime/manifest'
|
|
79317
79201
|
|
|
79318
|
-
|
|
79319
|
-
|
|
79320
|
-
|
|
79321
|
-
|
|
79322
|
-
|
|
79323
|
-
|
|
79324
|
-
|
|
79325
|
-
|
|
79326
|
-
|
|
79327
|
-
|
|
79328
|
-
|
|
79329
|
-
|
|
79330
|
-
}
|
|
79331
|
-
|
|
79332
|
-
|
|
79333
|
-
|
|
79334
|
-
|
|
79202
|
+
import Shell from '../../../../../src/+index'
|
|
79203
|
+
|
|
79204
|
+
export default (options) => {
|
|
79205
|
+
return serverAdapterFactory({
|
|
79206
|
+
manifest,
|
|
79207
|
+
...options,
|
|
79208
|
+
on_render: async ({url, match, session, pipe , manifest }) => {
|
|
79209
|
+
// instanitate a cache we can use for this request
|
|
79210
|
+
const cache = new Cache({ disabled: false })
|
|
79211
|
+
|
|
79212
|
+
if (!match) {
|
|
79213
|
+
return new Response('not found', { status: 404 })
|
|
79214
|
+
}
|
|
79215
|
+
|
|
79216
|
+
const { readable, injectToStream, pipe: pipeTo } = await renderToStream(
|
|
79217
|
+
React.createElement(Shell, {
|
|
79218
|
+
children: React.createElement(Router, {
|
|
79219
|
+
initialURL: url,
|
|
79220
|
+
cache: cache,
|
|
79221
|
+
session: session,
|
|
79222
|
+
assetPrefix: options.assetPrefix,
|
|
79223
|
+
manifest: manifest,
|
|
79224
|
+
...router_cache()
|
|
79225
|
+
})
|
|
79226
|
+
}),
|
|
79227
|
+
{
|
|
79228
|
+
userAgent: 'Vite',
|
|
79229
|
+
}
|
|
79230
|
+
)
|
|
79335
79231
|
|
|
79336
|
-
|
|
79337
|
-
|
|
79338
|
-
|
|
79339
|
-
|
|
79340
|
-
|
|
79232
|
+
// add the initial scripts to the page
|
|
79233
|
+
injectToStream(\`
|
|
79234
|
+
<script>
|
|
79235
|
+
window.__houdini__initial__cache__ = \${cache.serialize()};
|
|
79236
|
+
window.__houdini__initial__session__ = \${JSON.stringify(session)};
|
|
79237
|
+
<\/script>
|
|
79238
|
+
|
|
79239
|
+
<!--
|
|
79240
|
+
add a virtual module that hydrates the client and sets up the initial pending cache.
|
|
79241
|
+
the dynamic extension is to support dev which sees the raw jsx, and production which sees the bundled asset
|
|
79242
|
+
-->
|
|
79243
|
+
<script type="module" src="\${options.assetPrefix}/pages/\${match.id}.\${options.production ? 'js' : 'jsx'}" async=""><\/script>
|
|
79244
|
+
\`)
|
|
79245
|
+
|
|
79246
|
+
if (pipe && pipeTo) {
|
|
79247
|
+
// pipe the response to the client
|
|
79248
|
+
pipeTo(pipe)
|
|
79249
|
+
} else {
|
|
79250
|
+
// and deliver our Response while that's running.
|
|
79251
|
+
return new Response(readable)
|
|
79252
|
+
}
|
|
79253
|
+
},
|
|
79341
79254
|
})
|
|
79342
79255
|
}
|
|
79343
79256
|
`;
|
|
79344
79257
|
await Promise.all([
|
|
79345
|
-
fs_exports.writeFile(conventions_exports.
|
|
79346
|
-
fs_exports.writeFile(conventions_exports.
|
|
79347
|
-
fs_exports.writeFile(conventions_exports.render_yoga_path(config), create_yoga)
|
|
79258
|
+
fs_exports.writeFile(conventions_exports.server_adapter_path(config), server_adapter),
|
|
79259
|
+
fs_exports.writeFile(conventions_exports.adapter_config_path(config), adapter_config)
|
|
79348
79260
|
]);
|
|
79349
79261
|
}
|
|
79350
79262
|
|
|
@@ -79474,130 +79386,12 @@ async function routerCodegen({
|
|
|
79474
79386
|
}) {
|
|
79475
79387
|
await Promise.all([
|
|
79476
79388
|
generate_entries({ config, manifest: manifest3 }),
|
|
79477
|
-
generate_renders(config),
|
|
79389
|
+
generate_renders({ config, manifest: manifest3 }),
|
|
79478
79390
|
generate_type_root({ config, manifest: manifest3 }),
|
|
79479
79391
|
write_manifest({ config, manifest: manifest3 })
|
|
79480
79392
|
]);
|
|
79481
79393
|
}
|
|
79482
79394
|
|
|
79483
|
-
// src/runtime/routing/lib/match.ts
|
|
79484
|
-
var param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
|
|
79485
|
-
function find_match(manifest3, current, allowNull) {
|
|
79486
|
-
let match = null;
|
|
79487
|
-
let matchVariables = null;
|
|
79488
|
-
for (const page of Object.values(manifest3.pages)) {
|
|
79489
|
-
const urlMatch = current.match(page.pattern);
|
|
79490
|
-
if (!urlMatch) {
|
|
79491
|
-
continue;
|
|
79492
|
-
}
|
|
79493
|
-
match = page;
|
|
79494
|
-
matchVariables = exec(urlMatch, page.params) || {};
|
|
79495
|
-
break;
|
|
79496
|
-
}
|
|
79497
|
-
if (!match && !allowNull) {
|
|
79498
|
-
throw new Error("404");
|
|
79499
|
-
}
|
|
79500
|
-
return [match, matchVariables];
|
|
79501
|
-
}
|
|
79502
|
-
function parse_page_pattern(id) {
|
|
79503
|
-
const params = [];
|
|
79504
|
-
const pattern = id === "/" ? /^\/$/ : new RegExp(
|
|
79505
|
-
`^${get_route_segments(id).map((segment) => {
|
|
79506
|
-
const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
|
|
79507
|
-
if (rest_match) {
|
|
79508
|
-
params.push({
|
|
79509
|
-
name: rest_match[1],
|
|
79510
|
-
matcher: rest_match[2],
|
|
79511
|
-
optional: false,
|
|
79512
|
-
rest: true,
|
|
79513
|
-
chained: true
|
|
79514
|
-
});
|
|
79515
|
-
return "(?:/(.*))?";
|
|
79516
|
-
}
|
|
79517
|
-
const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment);
|
|
79518
|
-
if (optional_match) {
|
|
79519
|
-
params.push({
|
|
79520
|
-
name: optional_match[1],
|
|
79521
|
-
matcher: optional_match[2],
|
|
79522
|
-
optional: true,
|
|
79523
|
-
rest: false,
|
|
79524
|
-
chained: true
|
|
79525
|
-
});
|
|
79526
|
-
return "(?:/([^/]+))?";
|
|
79527
|
-
}
|
|
79528
|
-
if (!segment) {
|
|
79529
|
-
return;
|
|
79530
|
-
}
|
|
79531
|
-
const parts = segment.split(/\[(.+?)\](?!\])/);
|
|
79532
|
-
const result = parts.map((content, i2) => {
|
|
79533
|
-
if (i2 % 2) {
|
|
79534
|
-
if (content.startsWith("x+")) {
|
|
79535
|
-
return escape2(
|
|
79536
|
-
String.fromCharCode(parseInt(content.slice(2), 16))
|
|
79537
|
-
);
|
|
79538
|
-
}
|
|
79539
|
-
if (content.startsWith("u+")) {
|
|
79540
|
-
return escape2(
|
|
79541
|
-
String.fromCharCode(
|
|
79542
|
-
...content.slice(2).split("-").map((code) => parseInt(code, 16))
|
|
79543
|
-
)
|
|
79544
|
-
);
|
|
79545
|
-
}
|
|
79546
|
-
const match = param_pattern.exec(content);
|
|
79547
|
-
if (!match) {
|
|
79548
|
-
throw new Error(
|
|
79549
|
-
`Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
|
|
79550
|
-
);
|
|
79551
|
-
}
|
|
79552
|
-
const [, is_optional, is_rest, name, matcher] = match;
|
|
79553
|
-
params.push({
|
|
79554
|
-
name,
|
|
79555
|
-
matcher,
|
|
79556
|
-
optional: !!is_optional,
|
|
79557
|
-
rest: !!is_rest,
|
|
79558
|
-
chained: is_rest ? i2 === 1 && parts[0] === "" : false
|
|
79559
|
-
});
|
|
79560
|
-
return is_rest ? "(.*?)" : is_optional ? "([^/]*)?" : "([^/]+?)";
|
|
79561
|
-
}
|
|
79562
|
-
return escape2(content);
|
|
79563
|
-
}).join("");
|
|
79564
|
-
return "/" + result;
|
|
79565
|
-
}).join("")}/?$`
|
|
79566
|
-
);
|
|
79567
|
-
return { pattern, params, page_id: id };
|
|
79568
|
-
}
|
|
79569
|
-
function affects_path(segment) {
|
|
79570
|
-
return !/^\([^)]+\)$/.test(segment);
|
|
79571
|
-
}
|
|
79572
|
-
function get_route_segments(route) {
|
|
79573
|
-
return route.slice(1).split("/").filter(affects_path);
|
|
79574
|
-
}
|
|
79575
|
-
function exec(match, params) {
|
|
79576
|
-
const result = {};
|
|
79577
|
-
const values = match.slice(1);
|
|
79578
|
-
let buffered = "";
|
|
79579
|
-
for (let i2 = 0; i2 < params.length; i2 += 1) {
|
|
79580
|
-
const param = params[i2];
|
|
79581
|
-
let value = values[i2];
|
|
79582
|
-
if (param.chained && param.rest && buffered) {
|
|
79583
|
-
value = value ? buffered + "/" + value : buffered;
|
|
79584
|
-
}
|
|
79585
|
-
buffered = "";
|
|
79586
|
-
if (value === void 0) {
|
|
79587
|
-
if (param.rest)
|
|
79588
|
-
result[param.name] = "";
|
|
79589
|
-
} else {
|
|
79590
|
-
result[param.name] = value;
|
|
79591
|
-
}
|
|
79592
|
-
}
|
|
79593
|
-
if (buffered)
|
|
79594
|
-
return;
|
|
79595
|
-
return result;
|
|
79596
|
-
}
|
|
79597
|
-
function escape2(str) {
|
|
79598
|
-
return str.normalize().replace(/[[\]]/g, "\\$&").replace(/%/g, "%25").replace(/\//g, "%2[Ff]").replace(/\?/g, "%3[Ff]").replace(/#/g, "%23").replace(/[.*+?^${}()|\\]/g, "\\$&");
|
|
79599
|
-
}
|
|
79600
|
-
|
|
79601
79395
|
// src/plugin/codegen/router.ts
|
|
79602
79396
|
function format_router_manifest({
|
|
79603
79397
|
config,
|
|
@@ -79744,7 +79538,8 @@ var vite_default = {
|
|
|
79744
79538
|
}
|
|
79745
79539
|
}
|
|
79746
79540
|
};
|
|
79747
|
-
if (!
|
|
79541
|
+
if (!isSecondaryBuild()) {
|
|
79542
|
+
await fs_exports.mkdirp(config.compiledAssetsDir);
|
|
79748
79543
|
rollupConfig.outDir = config.compiledAssetsDir;
|
|
79749
79544
|
rollupConfig.rollupOptions.input = {};
|
|
79750
79545
|
for (const [id, page] of Object.entries(manifest.pages)) {
|
|
@@ -79781,7 +79576,7 @@ var vite_default = {
|
|
|
79781
79576
|
arg = parsedPath.name;
|
|
79782
79577
|
if (which === "pages") {
|
|
79783
79578
|
const [id2, query_names] = arg.split("@");
|
|
79784
|
-
const queries = query_names.split(",");
|
|
79579
|
+
const queries = query_names ? query_names.split(",") : [];
|
|
79785
79580
|
return `
|
|
79786
79581
|
import { hydrateRoot } from 'react-dom/client';
|
|
79787
79582
|
import App from '$houdini/plugins/houdini-react/units/render/App'
|
|
@@ -79790,6 +79585,7 @@ var vite_default = {
|
|
|
79790
79585
|
import client from '$houdini/plugins/houdini-react/runtime/client'
|
|
79791
79586
|
import Component from '$houdini/plugins/houdini-react/units/entries/${id2}.jsx'
|
|
79792
79587
|
|
|
79588
|
+
|
|
79793
79589
|
// if there is pending data (or artifacts) then we should prime the caches
|
|
79794
79590
|
let initialData = {}
|
|
79795
79591
|
let initialArtifacts = {}
|
|
@@ -79797,7 +79593,7 @@ var vite_default = {
|
|
|
79797
79593
|
if (!window.__houdini__cache__) {
|
|
79798
79594
|
window.__houdini__cache__ = new Cache()
|
|
79799
79595
|
window.__houdini__hydration__layer__ = window.__houdini__cache__._internal_unstable.storage.createLayer(true)
|
|
79800
|
-
window.__houdini__client__ = client
|
|
79596
|
+
window.__houdini__client__ = client()
|
|
79801
79597
|
}
|
|
79802
79598
|
|
|
79803
79599
|
// the artifacts are the source of the zip (without them, we can't prime either cache)
|
|
@@ -79808,7 +79604,7 @@ var vite_default = {
|
|
|
79808
79604
|
// if we also have data for the artifact, save it in the initial data cache
|
|
79809
79605
|
if (window.__houdini__pending_data__?.[artifactName]) {
|
|
79810
79606
|
// create the store we'll put in the cache
|
|
79811
|
-
const observer =
|
|
79607
|
+
const observer = window.__houdini__client__.observe({ artifact, cache: window.__houdini__cache__, initialValue: window.__houdini__pending_data__[artifactName] })
|
|
79812
79608
|
|
|
79813
79609
|
// save it in the cache
|
|
79814
79610
|
initialData[artifactName] = observer
|
|
@@ -79851,113 +79647,56 @@ if (window.__houdini__nav_caches__ && window.__houdini__nav_caches__.artifact_ca
|
|
|
79851
79647
|
`;
|
|
79852
79648
|
}
|
|
79853
79649
|
},
|
|
79854
|
-
configureServer(server) {
|
|
79855
|
-
|
|
79856
|
-
|
|
79857
|
-
|
|
79650
|
+
async configureServer(server) {
|
|
79651
|
+
server.middlewares.use(async (req, res, next) => {
|
|
79652
|
+
const { default: router_manifest } = await server.ssrLoadModule(
|
|
79653
|
+
path_exports.join(
|
|
79654
|
+
server.houdiniConfig.pluginRuntimeDirectory("houdini-react"),
|
|
79655
|
+
"manifest.js"
|
|
79656
|
+
)
|
|
79657
|
+
);
|
|
79658
|
+
try {
|
|
79659
|
+
const [match] = find_match(router_manifest, req.url ?? "/");
|
|
79660
|
+
if (!match) {
|
|
79661
|
+
throw new Error();
|
|
79662
|
+
}
|
|
79663
|
+
} catch {
|
|
79664
|
+
if (req.url !== localApiEndpoint(server.houdiniConfig.configFile)) {
|
|
79858
79665
|
return next();
|
|
79859
79666
|
}
|
|
79860
|
-
|
|
79861
|
-
|
|
79862
|
-
|
|
79667
|
+
}
|
|
79668
|
+
const project_manifest = await load_manifest({ config: server.houdiniConfig });
|
|
79669
|
+
let schema = null;
|
|
79670
|
+
if (project_manifest.local_schema) {
|
|
79671
|
+
schema = (await server.ssrLoadModule(
|
|
79672
|
+
path_exports.join(
|
|
79863
79673
|
server.houdiniConfig.localApiDir,
|
|
79864
|
-
"+
|
|
79865
|
-
)
|
|
79866
|
-
|
|
79867
|
-
|
|
79868
|
-
|
|
79869
|
-
|
|
79870
|
-
|
|
79871
|
-
|
|
79872
|
-
|
|
79873
|
-
|
|
79874
|
-
|
|
79875
|
-
|
|
79876
|
-
|
|
79877
|
-
|
|
79878
|
-
|
|
79879
|
-
|
|
79880
|
-
|
|
79881
|
-
|
|
79882
|
-
|
|
79883
|
-
|
|
79884
|
-
|
|
79885
|
-
|
|
79886
|
-
|
|
79887
|
-
server.middlewares.use(render_stream(server));
|
|
79888
|
-
}
|
|
79889
|
-
};
|
|
79890
|
-
var houdini_auth_routes = (server) => {
|
|
79891
|
-
return async (req, res, next) => {
|
|
79892
|
-
if (!req.url) {
|
|
79893
|
-
return next();
|
|
79894
|
-
}
|
|
79895
|
-
handle_request({
|
|
79896
|
-
config: server.houdiniConfig.configFile,
|
|
79897
|
-
session_keys: localApiSessionKeys(server.houdiniConfig.configFile),
|
|
79898
|
-
next,
|
|
79899
|
-
url: req.url,
|
|
79900
|
-
...res,
|
|
79901
|
-
redirect(status = 307, url) {
|
|
79902
|
-
res.statusCode = status;
|
|
79903
|
-
res.setHeader("location", url);
|
|
79904
|
-
res.setHeader("content-length", "0");
|
|
79905
|
-
return res.end();
|
|
79906
|
-
},
|
|
79907
|
-
get_header: res.getHeader.bind(res),
|
|
79908
|
-
set_header: res.setHeader.bind(res)
|
|
79674
|
+
"+schema?t=" + new Date().getTime()
|
|
79675
|
+
)
|
|
79676
|
+
)).default;
|
|
79677
|
+
}
|
|
79678
|
+
const serverAdapter = (await server.ssrLoadModule(
|
|
79679
|
+
conventions_exports.server_adapter_path(server.houdiniConfig) + "?t=" + new Date().getTime()
|
|
79680
|
+
)).default;
|
|
79681
|
+
let yoga = null;
|
|
79682
|
+
if (project_manifest.local_yoga) {
|
|
79683
|
+
const yogaPath = path_exports.join(
|
|
79684
|
+
server.houdiniConfig.localApiDir,
|
|
79685
|
+
"+yoga?t=" + new Date().getTime()
|
|
79686
|
+
);
|
|
79687
|
+
yoga = await server.ssrLoadModule(yogaPath);
|
|
79688
|
+
}
|
|
79689
|
+
await serverAdapter({
|
|
79690
|
+
schema,
|
|
79691
|
+
yoga,
|
|
79692
|
+
assetPrefix: "/virtual:houdini",
|
|
79693
|
+
production: false,
|
|
79694
|
+
manifest: router_manifest,
|
|
79695
|
+
pipe: res
|
|
79696
|
+
})(req, res);
|
|
79909
79697
|
});
|
|
79910
|
-
};
|
|
79911
|
-
};
|
|
79912
|
-
var render_stream = (server) => async (request, response, next) => {
|
|
79913
|
-
if (!request.url) {
|
|
79914
|
-
return next();
|
|
79915
|
-
}
|
|
79916
|
-
const { default: manifest3 } = await server.ssrLoadModule(
|
|
79917
|
-
path_exports.join(server.houdiniConfig.pluginRuntimeDirectory("houdini-react"), "manifest.js")
|
|
79918
|
-
);
|
|
79919
|
-
const [match] = find_match(manifest3, request.url, true);
|
|
79920
|
-
if (!match) {
|
|
79921
|
-
return next();
|
|
79922
79698
|
}
|
|
79923
|
-
const session = get_session(
|
|
79924
|
-
new Headers(request.headers),
|
|
79925
|
-
localApiSessionKeys(server.houdiniConfig.configFile)
|
|
79926
|
-
);
|
|
79927
|
-
const { render_to_stream } = await load_render(server);
|
|
79928
|
-
const cache = new Cache({ disabled: false });
|
|
79929
|
-
const loaded_queries = {};
|
|
79930
|
-
const loaded_artifacts = {};
|
|
79931
|
-
const { pipe, injectToStream } = await render_to_stream({
|
|
79932
|
-
loaded_queries,
|
|
79933
|
-
loaded_artifacts,
|
|
79934
|
-
url: request.url,
|
|
79935
|
-
cache,
|
|
79936
|
-
session,
|
|
79937
|
-
userAgent: "Vite",
|
|
79938
|
-
assetPrefix: "/virtual:houdini"
|
|
79939
|
-
});
|
|
79940
|
-
const pending_queries = Object.keys(match.documents);
|
|
79941
|
-
const pending_query_names = pending_queries.filter((q) => !(q in loaded_queries)).join(",");
|
|
79942
|
-
pipe?.(response);
|
|
79943
|
-
const entry = `/virtual:houdini/pages/${match.id}@${pending_query_names}.jsx`;
|
|
79944
|
-
injectToStream(`
|
|
79945
|
-
<script>
|
|
79946
|
-
window.__houdini__initial__cache__ = ${cache.serialize()};
|
|
79947
|
-
window.__houdini__initial__session__ = ${JSON.stringify(session)};
|
|
79948
|
-
<\/script>
|
|
79949
|
-
|
|
79950
|
-
<script type="module" src="/@vite/client" async=""><\/script>
|
|
79951
|
-
|
|
79952
|
-
<!-- add a virtual module that hydrates the client and sets up the initial pending cache -->
|
|
79953
|
-
<script type="module" src="${entry}" async=""><\/script>
|
|
79954
|
-
`);
|
|
79955
79699
|
};
|
|
79956
|
-
async function load_render(server) {
|
|
79957
|
-
return await server.ssrLoadModule(
|
|
79958
|
-
conventions_exports.render_server_path(server.houdiniConfig) + "?t=" + new Date().getTime()
|
|
79959
|
-
);
|
|
79960
|
-
}
|
|
79961
79700
|
|
|
79962
79701
|
// src/plugin/index.ts
|
|
79963
79702
|
var manifest2;
|
|
@@ -79999,7 +79738,7 @@ var hooks = async () => ({
|
|
|
79999
79738
|
path2.join(config.projectRoot, "src", "+client")
|
|
80000
79739
|
);
|
|
80001
79740
|
return `${importStatement(relativePath, "client")}
|
|
80002
|
-
${exportDefaultStatement("client")}
|
|
79741
|
+
${exportDefaultStatement("() => client")}
|
|
80003
79742
|
`;
|
|
80004
79743
|
},
|
|
80005
79744
|
"manifest.js": ({ config, exportDefaultStatement, importStatement }) => {
|