houdini 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/adapter/index.d.ts +3 -0
- package/build/adapter-cjs/index.js +33 -0
- package/build/adapter-esm/index.js +9 -0
- package/build/cmd/init.d.ts +1 -0
- package/build/cmd-cjs/index.js +53 -48
- package/build/cmd-esm/index.js +51 -46
- package/build/codegen-cjs/index.js +23 -25
- package/build/codegen-esm/index.js +23 -24
- package/build/lib/index.d.ts +3 -1
- package/build/{router → lib/router}/conventions.d.ts +3 -5
- package/build/{router → lib/router}/index.d.ts +1 -1
- package/build/{router → lib/router}/manifest.d.ts +2 -2
- package/build/{router → lib/router}/server.d.ts +2 -2
- package/build/{router → lib/router}/types.d.ts +2 -1
- package/build/lib/types.d.ts +1 -1
- package/build/lib-cjs/index.js +148 -32
- package/build/lib-esm/index.js +142 -29
- package/build/runtime/lib/types.d.ts +1 -1
- package/build/runtime/router/match.d.ts +38 -0
- package/build/runtime/router/server.d.ts +22 -25
- package/build/runtime/router/session.d.ts +22 -0
- package/build/runtime/router/types.d.ts +23 -0
- package/build/runtime-cjs/lib/types.d.ts +1 -1
- package/build/runtime-cjs/lib/types.js +2 -0
- package/build/runtime-cjs/router/match.d.ts +38 -0
- package/build/runtime-cjs/router/match.js +149 -0
- package/build/runtime-cjs/router/server.d.ts +22 -25
- package/build/runtime-cjs/router/server.js +71 -49
- package/build/runtime-cjs/router/session.d.ts +22 -0
- package/build/runtime-cjs/router/session.js +77 -0
- package/build/runtime-cjs/router/types.d.ts +23 -0
- package/build/runtime-cjs/router/types.js +16 -0
- package/build/runtime-esm/lib/types.d.ts +1 -1
- package/build/runtime-esm/lib/types.js +1 -0
- package/build/runtime-esm/router/match.d.ts +38 -0
- package/build/runtime-esm/router/match.js +122 -0
- package/build/runtime-esm/router/server.d.ts +22 -25
- package/build/runtime-esm/router/server.js +64 -47
- package/build/runtime-esm/router/session.d.ts +22 -0
- package/build/runtime-esm/router/session.js +52 -0
- package/build/runtime-esm/router/types.d.ts +23 -0
- package/build/runtime-esm/router/types.js +0 -0
- package/build/test-cjs/index.js +27 -25
- package/build/test-esm/index.js +27 -24
- package/build/vite-cjs/index.js +40 -46
- package/build/vite-esm/index.js +39 -44
- package/package.json +10 -9
- package/build/router-cjs/index.js +0 -57736
- package/build/router-esm/index.js +0 -57726
- /package/build/{router-cjs → adapter-cjs}/package.json +0 -0
- /package/build/{router-esm → adapter-esm}/package.json +0 -0
package/build/lib-cjs/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createRequire as conflict_free } from 'module'; const require = conflict_free(import.meta.url);
|
|
2
1
|
"use strict";
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
@@ -58608,11 +58607,13 @@ __export(lib_exports, {
|
|
|
58608
58607
|
detectTools: () => detectTools,
|
|
58609
58608
|
ensureArtifactImport: () => ensureArtifactImport,
|
|
58610
58609
|
ensureImports: () => ensureImports,
|
|
58610
|
+
exec: () => exec,
|
|
58611
58611
|
extractHeaders: () => extractHeaders,
|
|
58612
58612
|
extractHeadersStr: () => extractHeadersStr,
|
|
58613
58613
|
extractQueries: () => extractQueries,
|
|
58614
58614
|
fetch: () => fetch2,
|
|
58615
58615
|
find_graphql: () => find_graphql,
|
|
58616
|
+
find_match: () => find_match,
|
|
58616
58617
|
formatErrors: () => formatErrors,
|
|
58617
58618
|
fragmentKey: () => fragmentKey,
|
|
58618
58619
|
fs: () => fs_exports,
|
|
@@ -58620,13 +58621,14 @@ __export(lib_exports, {
|
|
|
58620
58621
|
getCurrentConfig: () => getCurrentConfig,
|
|
58621
58622
|
getMockConfig: () => getMockConfig,
|
|
58622
58623
|
getRootType: () => getRootType,
|
|
58624
|
+
get_route_segments: () => get_route_segments,
|
|
58623
58625
|
get_session: () => get_session,
|
|
58624
58626
|
handle_request: () => handle_request,
|
|
58625
58627
|
hashOriginal: () => hashOriginal,
|
|
58626
58628
|
hashRaw: () => hashRaw,
|
|
58627
58629
|
houdini_mode: () => houdini_mode,
|
|
58628
58630
|
isPending: () => isPending,
|
|
58629
|
-
|
|
58631
|
+
isSecondaryBuild: () => isSecondaryBuild,
|
|
58630
58632
|
keyFieldsForType: () => keyFieldsForType,
|
|
58631
58633
|
loadLocalSchema: () => loadLocalSchema,
|
|
58632
58634
|
load_manifest: () => load_manifest,
|
|
@@ -58639,6 +58641,7 @@ __export(lib_exports, {
|
|
|
58639
58641
|
parentTypeFromAncestors: () => parentTypeFromAncestors,
|
|
58640
58642
|
parseJS: () => parseJS,
|
|
58641
58643
|
parseJSON: () => parseJSON,
|
|
58644
|
+
parse_page_pattern: () => parse_page_pattern,
|
|
58642
58645
|
path: () => path_exports,
|
|
58643
58646
|
plugin: () => plugin,
|
|
58644
58647
|
printJS: () => printJS,
|
|
@@ -66882,7 +66885,7 @@ var LogLevel = {
|
|
|
66882
66885
|
|
|
66883
66886
|
// src/lib/config.ts
|
|
66884
66887
|
var import_meta = {};
|
|
66885
|
-
var currentDir =
|
|
66888
|
+
var currentDir = dirname((0, import_node_url2.fileURLToPath)(import_meta.url));
|
|
66886
66889
|
var Config = class {
|
|
66887
66890
|
filepath;
|
|
66888
66891
|
rootDir;
|
|
@@ -68048,6 +68051,124 @@ async function detectTools(cwd) {
|
|
|
68048
68051
|
};
|
|
68049
68052
|
}
|
|
68050
68053
|
|
|
68054
|
+
// src/runtime/router/match.ts
|
|
68055
|
+
var param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
|
|
68056
|
+
function find_match(manifest, current, allowNull = true) {
|
|
68057
|
+
let match = null;
|
|
68058
|
+
let matchVariables = null;
|
|
68059
|
+
for (const page of Object.values(manifest.pages)) {
|
|
68060
|
+
const urlMatch = current.match(page.pattern);
|
|
68061
|
+
if (!urlMatch) {
|
|
68062
|
+
continue;
|
|
68063
|
+
}
|
|
68064
|
+
match = page;
|
|
68065
|
+
matchVariables = exec(urlMatch, page.params) || {};
|
|
68066
|
+
break;
|
|
68067
|
+
}
|
|
68068
|
+
if (!match && !allowNull) {
|
|
68069
|
+
throw new Error("404");
|
|
68070
|
+
}
|
|
68071
|
+
return [match, matchVariables];
|
|
68072
|
+
}
|
|
68073
|
+
function parse_page_pattern(id) {
|
|
68074
|
+
const params = [];
|
|
68075
|
+
const pattern = id === "/" ? /^\/$/ : new RegExp(
|
|
68076
|
+
`^${get_route_segments(id).map((segment) => {
|
|
68077
|
+
const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
|
|
68078
|
+
if (rest_match) {
|
|
68079
|
+
params.push({
|
|
68080
|
+
name: rest_match[1],
|
|
68081
|
+
matcher: rest_match[2],
|
|
68082
|
+
optional: false,
|
|
68083
|
+
rest: true,
|
|
68084
|
+
chained: true
|
|
68085
|
+
});
|
|
68086
|
+
return "(?:/(.*))?";
|
|
68087
|
+
}
|
|
68088
|
+
const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment);
|
|
68089
|
+
if (optional_match) {
|
|
68090
|
+
params.push({
|
|
68091
|
+
name: optional_match[1],
|
|
68092
|
+
matcher: optional_match[2],
|
|
68093
|
+
optional: true,
|
|
68094
|
+
rest: false,
|
|
68095
|
+
chained: true
|
|
68096
|
+
});
|
|
68097
|
+
return "(?:/([^/]+))?";
|
|
68098
|
+
}
|
|
68099
|
+
if (!segment) {
|
|
68100
|
+
return;
|
|
68101
|
+
}
|
|
68102
|
+
const parts = segment.split(/\[(.+?)\](?!\])/);
|
|
68103
|
+
const result = parts.map((content, i2) => {
|
|
68104
|
+
if (i2 % 2) {
|
|
68105
|
+
if (content.startsWith("x+")) {
|
|
68106
|
+
return escape2(
|
|
68107
|
+
String.fromCharCode(parseInt(content.slice(2), 16))
|
|
68108
|
+
);
|
|
68109
|
+
}
|
|
68110
|
+
if (content.startsWith("u+")) {
|
|
68111
|
+
return escape2(
|
|
68112
|
+
String.fromCharCode(
|
|
68113
|
+
...content.slice(2).split("-").map((code) => parseInt(code, 16))
|
|
68114
|
+
)
|
|
68115
|
+
);
|
|
68116
|
+
}
|
|
68117
|
+
const match = param_pattern.exec(content);
|
|
68118
|
+
if (!match) {
|
|
68119
|
+
throw new Error(
|
|
68120
|
+
`Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
|
|
68121
|
+
);
|
|
68122
|
+
}
|
|
68123
|
+
const [, is_optional, is_rest, name, matcher] = match;
|
|
68124
|
+
params.push({
|
|
68125
|
+
name,
|
|
68126
|
+
matcher,
|
|
68127
|
+
optional: !!is_optional,
|
|
68128
|
+
rest: !!is_rest,
|
|
68129
|
+
chained: is_rest ? i2 === 1 && parts[0] === "" : false
|
|
68130
|
+
});
|
|
68131
|
+
return is_rest ? "(.*?)" : is_optional ? "([^/]*)?" : "([^/]+?)";
|
|
68132
|
+
}
|
|
68133
|
+
return escape2(content);
|
|
68134
|
+
}).join("");
|
|
68135
|
+
return "/" + result;
|
|
68136
|
+
}).join("")}/?$`
|
|
68137
|
+
);
|
|
68138
|
+
return { pattern, params, page_id: id };
|
|
68139
|
+
}
|
|
68140
|
+
function affects_path(segment) {
|
|
68141
|
+
return !/^\([^)]+\)$/.test(segment);
|
|
68142
|
+
}
|
|
68143
|
+
function get_route_segments(route) {
|
|
68144
|
+
return route.slice(1).split("/").filter(affects_path);
|
|
68145
|
+
}
|
|
68146
|
+
function exec(match, params) {
|
|
68147
|
+
const result = {};
|
|
68148
|
+
const values = match.slice(1);
|
|
68149
|
+
let buffered = "";
|
|
68150
|
+
for (let i2 = 0; i2 < params.length; i2 += 1) {
|
|
68151
|
+
const param = params[i2];
|
|
68152
|
+
let value = values[i2];
|
|
68153
|
+
if (param.chained && param.rest && buffered) {
|
|
68154
|
+
value = value ? buffered + "/" + value : buffered;
|
|
68155
|
+
}
|
|
68156
|
+
buffered = "";
|
|
68157
|
+
if (value === void 0) {
|
|
68158
|
+
if (param.rest)
|
|
68159
|
+
result[param.name] = "";
|
|
68160
|
+
} else {
|
|
68161
|
+
result[param.name] = value;
|
|
68162
|
+
}
|
|
68163
|
+
}
|
|
68164
|
+
if (buffered)
|
|
68165
|
+
return;
|
|
68166
|
+
return result;
|
|
68167
|
+
}
|
|
68168
|
+
function escape2(str) {
|
|
68169
|
+
return str.normalize().replace(/[[\]]/g, "\\$&").replace(/%/g, "%25").replace(/\//g, "%2[Ff]").replace(/\?/g, "%3[Ff]").replace(/#/g, "%23").replace(/[.*+?^${}()|\\]/g, "\\$&");
|
|
68170
|
+
}
|
|
68171
|
+
|
|
68051
68172
|
// ../../node_modules/.pnpm/estree-walker@3.0.1/node_modules/estree-walker/src/walker.js
|
|
68052
68173
|
var WalkerBase = class {
|
|
68053
68174
|
constructor() {
|
|
@@ -68232,9 +68353,10 @@ async function find_graphql(config2, parsedScript, walker) {
|
|
|
68232
68353
|
});
|
|
68233
68354
|
}
|
|
68234
68355
|
|
|
68235
|
-
// src/router/conventions.ts
|
|
68356
|
+
// src/lib/router/conventions.ts
|
|
68236
68357
|
var conventions_exports = {};
|
|
68237
68358
|
__export(conventions_exports, {
|
|
68359
|
+
adapter_config_path: () => adapter_config_path,
|
|
68238
68360
|
fallback_unit_path: () => fallback_unit_path,
|
|
68239
68361
|
is_layout: () => is_layout,
|
|
68240
68362
|
layout_unit_path: () => layout_unit_path,
|
|
@@ -68246,13 +68368,10 @@ __export(conventions_exports, {
|
|
|
68246
68368
|
read_layoutView: () => read_layoutView,
|
|
68247
68369
|
read_pageQuery: () => read_pageQuery,
|
|
68248
68370
|
read_pageView: () => read_pageView,
|
|
68249
|
-
render_app_path: () => render_app_path,
|
|
68250
|
-
render_client_path: () => render_client_path,
|
|
68251
|
-
render_server_path: () => render_server_path,
|
|
68252
|
-
render_yoga_path: () => render_yoga_path,
|
|
68253
68371
|
router_index_path: () => router_index_path,
|
|
68254
68372
|
router_path: () => router_path,
|
|
68255
|
-
serialized_manifest_path: () => serialized_manifest_path
|
|
68373
|
+
serialized_manifest_path: () => serialized_manifest_path,
|
|
68374
|
+
server_adapter_path: () => server_adapter_path
|
|
68256
68375
|
});
|
|
68257
68376
|
function router_path(config2) {
|
|
68258
68377
|
return path_exports.join(base_dir(config2), "Router.jsx");
|
|
@@ -68260,17 +68379,11 @@ function router_path(config2) {
|
|
|
68260
68379
|
function page_entry_path(config2, id, base) {
|
|
68261
68380
|
return path_exports.join(page_entries_dir(config2, base), `${id}.jsx`);
|
|
68262
68381
|
}
|
|
68263
|
-
function
|
|
68264
|
-
return path_exports.join(units_dir(config2, base), "render", "client.jsx");
|
|
68265
|
-
}
|
|
68266
|
-
function render_server_path(config2, base) {
|
|
68382
|
+
function server_adapter_path(config2, base) {
|
|
68267
68383
|
return path_exports.join(units_dir(config2, base), "render", "server.js");
|
|
68268
68384
|
}
|
|
68269
|
-
function
|
|
68270
|
-
return path_exports.join(units_dir(config2, base), "render", "
|
|
68271
|
-
}
|
|
68272
|
-
function render_app_path(config2, base) {
|
|
68273
|
-
return path_exports.join(units_dir(config2, base), "render", "App.jsx");
|
|
68385
|
+
function adapter_config_path(config2, base) {
|
|
68386
|
+
return path_exports.join(units_dir(config2, base), "render", "config.js");
|
|
68274
68387
|
}
|
|
68275
68388
|
function page_unit_path(config2, id, base) {
|
|
68276
68389
|
return path_exports.join(page_units_dir(config2, base), `${id}.jsx`);
|
|
@@ -68354,7 +68467,7 @@ function serialized_manifest_path(config2, base = base_dir(config2)) {
|
|
|
68354
68467
|
return path_exports.join(base, "manifest.json");
|
|
68355
68468
|
}
|
|
68356
68469
|
|
|
68357
|
-
// src/router/manifest.ts
|
|
68470
|
+
// src/lib/router/manifest.ts
|
|
68358
68471
|
var t2 = __toESM(require_lib6(), 1);
|
|
68359
68472
|
var graphql5 = __toESM(require("graphql"), 1);
|
|
68360
68473
|
async function load_manifest(args) {
|
|
@@ -68580,15 +68693,15 @@ async function extractQueries(source) {
|
|
|
68580
68693
|
return props.filter((p) => p !== "children");
|
|
68581
68694
|
}
|
|
68582
68695
|
|
|
68583
|
-
// src/router/server.ts
|
|
68696
|
+
// src/lib/router/server.ts
|
|
68584
68697
|
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
68585
|
-
|
|
68586
|
-
function isViteSchemaBuild() {
|
|
68698
|
+
function isSecondaryBuild() {
|
|
68587
68699
|
return process.env.HOUDINI_SCHEMA_BUILD === "true";
|
|
68588
68700
|
}
|
|
68589
68701
|
async function loadLocalSchema(config2) {
|
|
68702
|
+
const { build } = await import("vite");
|
|
68590
68703
|
process.env.HOUDINI_SCHEMA_BUILD = "true";
|
|
68591
|
-
await
|
|
68704
|
+
await build({
|
|
68592
68705
|
logLevel: "silent",
|
|
68593
68706
|
build: {
|
|
68594
68707
|
outDir: import_node_path2.default.join(config2.rootDir, "temp"),
|
|
@@ -68807,29 +68920,28 @@ function decode2(token) {
|
|
|
68807
68920
|
};
|
|
68808
68921
|
}
|
|
68809
68922
|
|
|
68810
|
-
// src/runtime/router/
|
|
68923
|
+
// src/runtime/router/session.ts
|
|
68811
68924
|
async function handle_request(args) {
|
|
68812
68925
|
const plugin_config = args.config.router ?? {};
|
|
68813
68926
|
if (plugin_config.auth && "redirect" in plugin_config.auth && args.url.startsWith(plugin_config.auth.redirect)) {
|
|
68814
68927
|
return await redirect_auth(args);
|
|
68815
68928
|
}
|
|
68816
|
-
args.next();
|
|
68817
68929
|
}
|
|
68818
68930
|
async function redirect_auth(args) {
|
|
68819
|
-
const { searchParams } = new URL(args.url, `http://${args.
|
|
68931
|
+
const { searchParams } = new URL(args.url, `http://${args.headers.get("host")}`);
|
|
68820
68932
|
const { redirectTo, ...session } = Object.fromEntries(searchParams.entries());
|
|
68821
|
-
await set_session(args, session);
|
|
68822
68933
|
if (redirectTo) {
|
|
68823
|
-
|
|
68934
|
+
const response = Response.redirect(redirectTo, 302);
|
|
68935
|
+
await set_session(args, response, session);
|
|
68936
|
+
return response;
|
|
68824
68937
|
}
|
|
68825
|
-
args.next();
|
|
68826
68938
|
}
|
|
68827
68939
|
var session_cookie_name = "__houdini__";
|
|
68828
|
-
async function set_session(req, value) {
|
|
68940
|
+
async function set_session(req, response, value) {
|
|
68829
68941
|
const today = new Date();
|
|
68830
68942
|
const expires = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1e3);
|
|
68831
68943
|
const serialized = await encode(value, req.session_keys[0]);
|
|
68832
|
-
|
|
68944
|
+
response.headers.set(
|
|
68833
68945
|
"Set-Cookie",
|
|
68834
68946
|
`${session_cookie_name}=${serialized}; Path=/; HttpOnly; Secure; SameSite=Lax; Expires=${expires.toUTCString()} `
|
|
68835
68947
|
);
|
|
@@ -68884,11 +68996,13 @@ async function get_session(req, secrets) {
|
|
|
68884
68996
|
detectTools,
|
|
68885
68997
|
ensureArtifactImport,
|
|
68886
68998
|
ensureImports,
|
|
68999
|
+
exec,
|
|
68887
69000
|
extractHeaders,
|
|
68888
69001
|
extractHeadersStr,
|
|
68889
69002
|
extractQueries,
|
|
68890
69003
|
fetch,
|
|
68891
69004
|
find_graphql,
|
|
69005
|
+
find_match,
|
|
68892
69006
|
formatErrors,
|
|
68893
69007
|
fragmentKey,
|
|
68894
69008
|
fs,
|
|
@@ -68896,13 +69010,14 @@ async function get_session(req, secrets) {
|
|
|
68896
69010
|
getCurrentConfig,
|
|
68897
69011
|
getMockConfig,
|
|
68898
69012
|
getRootType,
|
|
69013
|
+
get_route_segments,
|
|
68899
69014
|
get_session,
|
|
68900
69015
|
handle_request,
|
|
68901
69016
|
hashOriginal,
|
|
68902
69017
|
hashRaw,
|
|
68903
69018
|
houdini_mode,
|
|
68904
69019
|
isPending,
|
|
68905
|
-
|
|
69020
|
+
isSecondaryBuild,
|
|
68906
69021
|
keyFieldsForType,
|
|
68907
69022
|
loadLocalSchema,
|
|
68908
69023
|
load_manifest,
|
|
@@ -68915,6 +69030,7 @@ async function get_session(req, secrets) {
|
|
|
68915
69030
|
parentTypeFromAncestors,
|
|
68916
69031
|
parseJS,
|
|
68917
69032
|
parseJSON,
|
|
69033
|
+
parse_page_pattern,
|
|
68918
69034
|
path,
|
|
68919
69035
|
plugin,
|
|
68920
69036
|
printJS,
|
package/build/lib-esm/index.js
CHANGED
|
@@ -66809,7 +66809,7 @@ var LogLevel = {
|
|
|
66809
66809
|
};
|
|
66810
66810
|
|
|
66811
66811
|
// src/lib/config.ts
|
|
66812
|
-
var currentDir =
|
|
66812
|
+
var currentDir = dirname(fileURLToPath(import.meta.url));
|
|
66813
66813
|
var Config = class {
|
|
66814
66814
|
filepath;
|
|
66815
66815
|
rootDir;
|
|
@@ -67975,6 +67975,124 @@ async function detectTools(cwd) {
|
|
|
67975
67975
|
};
|
|
67976
67976
|
}
|
|
67977
67977
|
|
|
67978
|
+
// src/runtime/router/match.ts
|
|
67979
|
+
var param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
|
|
67980
|
+
function find_match(manifest, current, allowNull = true) {
|
|
67981
|
+
let match = null;
|
|
67982
|
+
let matchVariables = null;
|
|
67983
|
+
for (const page of Object.values(manifest.pages)) {
|
|
67984
|
+
const urlMatch = current.match(page.pattern);
|
|
67985
|
+
if (!urlMatch) {
|
|
67986
|
+
continue;
|
|
67987
|
+
}
|
|
67988
|
+
match = page;
|
|
67989
|
+
matchVariables = exec(urlMatch, page.params) || {};
|
|
67990
|
+
break;
|
|
67991
|
+
}
|
|
67992
|
+
if (!match && !allowNull) {
|
|
67993
|
+
throw new Error("404");
|
|
67994
|
+
}
|
|
67995
|
+
return [match, matchVariables];
|
|
67996
|
+
}
|
|
67997
|
+
function parse_page_pattern(id) {
|
|
67998
|
+
const params = [];
|
|
67999
|
+
const pattern = id === "/" ? /^\/$/ : new RegExp(
|
|
68000
|
+
`^${get_route_segments(id).map((segment) => {
|
|
68001
|
+
const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
|
|
68002
|
+
if (rest_match) {
|
|
68003
|
+
params.push({
|
|
68004
|
+
name: rest_match[1],
|
|
68005
|
+
matcher: rest_match[2],
|
|
68006
|
+
optional: false,
|
|
68007
|
+
rest: true,
|
|
68008
|
+
chained: true
|
|
68009
|
+
});
|
|
68010
|
+
return "(?:/(.*))?";
|
|
68011
|
+
}
|
|
68012
|
+
const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment);
|
|
68013
|
+
if (optional_match) {
|
|
68014
|
+
params.push({
|
|
68015
|
+
name: optional_match[1],
|
|
68016
|
+
matcher: optional_match[2],
|
|
68017
|
+
optional: true,
|
|
68018
|
+
rest: false,
|
|
68019
|
+
chained: true
|
|
68020
|
+
});
|
|
68021
|
+
return "(?:/([^/]+))?";
|
|
68022
|
+
}
|
|
68023
|
+
if (!segment) {
|
|
68024
|
+
return;
|
|
68025
|
+
}
|
|
68026
|
+
const parts = segment.split(/\[(.+?)\](?!\])/);
|
|
68027
|
+
const result = parts.map((content, i2) => {
|
|
68028
|
+
if (i2 % 2) {
|
|
68029
|
+
if (content.startsWith("x+")) {
|
|
68030
|
+
return escape2(
|
|
68031
|
+
String.fromCharCode(parseInt(content.slice(2), 16))
|
|
68032
|
+
);
|
|
68033
|
+
}
|
|
68034
|
+
if (content.startsWith("u+")) {
|
|
68035
|
+
return escape2(
|
|
68036
|
+
String.fromCharCode(
|
|
68037
|
+
...content.slice(2).split("-").map((code) => parseInt(code, 16))
|
|
68038
|
+
)
|
|
68039
|
+
);
|
|
68040
|
+
}
|
|
68041
|
+
const match = param_pattern.exec(content);
|
|
68042
|
+
if (!match) {
|
|
68043
|
+
throw new Error(
|
|
68044
|
+
`Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
|
|
68045
|
+
);
|
|
68046
|
+
}
|
|
68047
|
+
const [, is_optional, is_rest, name, matcher] = match;
|
|
68048
|
+
params.push({
|
|
68049
|
+
name,
|
|
68050
|
+
matcher,
|
|
68051
|
+
optional: !!is_optional,
|
|
68052
|
+
rest: !!is_rest,
|
|
68053
|
+
chained: is_rest ? i2 === 1 && parts[0] === "" : false
|
|
68054
|
+
});
|
|
68055
|
+
return is_rest ? "(.*?)" : is_optional ? "([^/]*)?" : "([^/]+?)";
|
|
68056
|
+
}
|
|
68057
|
+
return escape2(content);
|
|
68058
|
+
}).join("");
|
|
68059
|
+
return "/" + result;
|
|
68060
|
+
}).join("")}/?$`
|
|
68061
|
+
);
|
|
68062
|
+
return { pattern, params, page_id: id };
|
|
68063
|
+
}
|
|
68064
|
+
function affects_path(segment) {
|
|
68065
|
+
return !/^\([^)]+\)$/.test(segment);
|
|
68066
|
+
}
|
|
68067
|
+
function get_route_segments(route) {
|
|
68068
|
+
return route.slice(1).split("/").filter(affects_path);
|
|
68069
|
+
}
|
|
68070
|
+
function exec(match, params) {
|
|
68071
|
+
const result = {};
|
|
68072
|
+
const values = match.slice(1);
|
|
68073
|
+
let buffered = "";
|
|
68074
|
+
for (let i2 = 0; i2 < params.length; i2 += 1) {
|
|
68075
|
+
const param = params[i2];
|
|
68076
|
+
let value = values[i2];
|
|
68077
|
+
if (param.chained && param.rest && buffered) {
|
|
68078
|
+
value = value ? buffered + "/" + value : buffered;
|
|
68079
|
+
}
|
|
68080
|
+
buffered = "";
|
|
68081
|
+
if (value === void 0) {
|
|
68082
|
+
if (param.rest)
|
|
68083
|
+
result[param.name] = "";
|
|
68084
|
+
} else {
|
|
68085
|
+
result[param.name] = value;
|
|
68086
|
+
}
|
|
68087
|
+
}
|
|
68088
|
+
if (buffered)
|
|
68089
|
+
return;
|
|
68090
|
+
return result;
|
|
68091
|
+
}
|
|
68092
|
+
function escape2(str) {
|
|
68093
|
+
return str.normalize().replace(/[[\]]/g, "\\$&").replace(/%/g, "%25").replace(/\//g, "%2[Ff]").replace(/\?/g, "%3[Ff]").replace(/#/g, "%23").replace(/[.*+?^${}()|\\]/g, "\\$&");
|
|
68094
|
+
}
|
|
68095
|
+
|
|
67978
68096
|
// ../../node_modules/.pnpm/estree-walker@3.0.1/node_modules/estree-walker/src/walker.js
|
|
67979
68097
|
var WalkerBase = class {
|
|
67980
68098
|
constructor() {
|
|
@@ -68159,9 +68277,10 @@ async function find_graphql(config2, parsedScript, walker) {
|
|
|
68159
68277
|
});
|
|
68160
68278
|
}
|
|
68161
68279
|
|
|
68162
|
-
// src/router/conventions.ts
|
|
68280
|
+
// src/lib/router/conventions.ts
|
|
68163
68281
|
var conventions_exports = {};
|
|
68164
68282
|
__export(conventions_exports, {
|
|
68283
|
+
adapter_config_path: () => adapter_config_path,
|
|
68165
68284
|
fallback_unit_path: () => fallback_unit_path,
|
|
68166
68285
|
is_layout: () => is_layout,
|
|
68167
68286
|
layout_unit_path: () => layout_unit_path,
|
|
@@ -68173,13 +68292,10 @@ __export(conventions_exports, {
|
|
|
68173
68292
|
read_layoutView: () => read_layoutView,
|
|
68174
68293
|
read_pageQuery: () => read_pageQuery,
|
|
68175
68294
|
read_pageView: () => read_pageView,
|
|
68176
|
-
render_app_path: () => render_app_path,
|
|
68177
|
-
render_client_path: () => render_client_path,
|
|
68178
|
-
render_server_path: () => render_server_path,
|
|
68179
|
-
render_yoga_path: () => render_yoga_path,
|
|
68180
68295
|
router_index_path: () => router_index_path,
|
|
68181
68296
|
router_path: () => router_path,
|
|
68182
|
-
serialized_manifest_path: () => serialized_manifest_path
|
|
68297
|
+
serialized_manifest_path: () => serialized_manifest_path,
|
|
68298
|
+
server_adapter_path: () => server_adapter_path
|
|
68183
68299
|
});
|
|
68184
68300
|
function router_path(config2) {
|
|
68185
68301
|
return path_exports.join(base_dir(config2), "Router.jsx");
|
|
@@ -68187,17 +68303,11 @@ function router_path(config2) {
|
|
|
68187
68303
|
function page_entry_path(config2, id, base) {
|
|
68188
68304
|
return path_exports.join(page_entries_dir(config2, base), `${id}.jsx`);
|
|
68189
68305
|
}
|
|
68190
|
-
function
|
|
68191
|
-
return path_exports.join(units_dir(config2, base), "render", "client.jsx");
|
|
68192
|
-
}
|
|
68193
|
-
function render_server_path(config2, base) {
|
|
68306
|
+
function server_adapter_path(config2, base) {
|
|
68194
68307
|
return path_exports.join(units_dir(config2, base), "render", "server.js");
|
|
68195
68308
|
}
|
|
68196
|
-
function
|
|
68197
|
-
return path_exports.join(units_dir(config2, base), "render", "
|
|
68198
|
-
}
|
|
68199
|
-
function render_app_path(config2, base) {
|
|
68200
|
-
return path_exports.join(units_dir(config2, base), "render", "App.jsx");
|
|
68309
|
+
function adapter_config_path(config2, base) {
|
|
68310
|
+
return path_exports.join(units_dir(config2, base), "render", "config.js");
|
|
68201
68311
|
}
|
|
68202
68312
|
function page_unit_path(config2, id, base) {
|
|
68203
68313
|
return path_exports.join(page_units_dir(config2, base), `${id}.jsx`);
|
|
@@ -68281,7 +68391,7 @@ function serialized_manifest_path(config2, base = base_dir(config2)) {
|
|
|
68281
68391
|
return path_exports.join(base, "manifest.json");
|
|
68282
68392
|
}
|
|
68283
68393
|
|
|
68284
|
-
// src/router/manifest.ts
|
|
68394
|
+
// src/lib/router/manifest.ts
|
|
68285
68395
|
var t2 = __toESM(require_lib6(), 1);
|
|
68286
68396
|
import * as graphql5 from "graphql";
|
|
68287
68397
|
async function load_manifest(args) {
|
|
@@ -68507,13 +68617,13 @@ async function extractQueries(source) {
|
|
|
68507
68617
|
return props.filter((p) => p !== "children");
|
|
68508
68618
|
}
|
|
68509
68619
|
|
|
68510
|
-
// src/router/server.ts
|
|
68620
|
+
// src/lib/router/server.ts
|
|
68511
68621
|
import path2 from "node:path";
|
|
68512
|
-
|
|
68513
|
-
function isViteSchemaBuild() {
|
|
68622
|
+
function isSecondaryBuild() {
|
|
68514
68623
|
return process.env.HOUDINI_SCHEMA_BUILD === "true";
|
|
68515
68624
|
}
|
|
68516
68625
|
async function loadLocalSchema(config2) {
|
|
68626
|
+
const { build } = await import("vite");
|
|
68517
68627
|
process.env.HOUDINI_SCHEMA_BUILD = "true";
|
|
68518
68628
|
await build({
|
|
68519
68629
|
logLevel: "silent",
|
|
@@ -68734,29 +68844,28 @@ function decode2(token) {
|
|
|
68734
68844
|
};
|
|
68735
68845
|
}
|
|
68736
68846
|
|
|
68737
|
-
// src/runtime/router/
|
|
68847
|
+
// src/runtime/router/session.ts
|
|
68738
68848
|
async function handle_request(args) {
|
|
68739
68849
|
const plugin_config = args.config.router ?? {};
|
|
68740
68850
|
if (plugin_config.auth && "redirect" in plugin_config.auth && args.url.startsWith(plugin_config.auth.redirect)) {
|
|
68741
68851
|
return await redirect_auth(args);
|
|
68742
68852
|
}
|
|
68743
|
-
args.next();
|
|
68744
68853
|
}
|
|
68745
68854
|
async function redirect_auth(args) {
|
|
68746
|
-
const { searchParams } = new URL(args.url, `http://${args.
|
|
68855
|
+
const { searchParams } = new URL(args.url, `http://${args.headers.get("host")}`);
|
|
68747
68856
|
const { redirectTo, ...session } = Object.fromEntries(searchParams.entries());
|
|
68748
|
-
await set_session(args, session);
|
|
68749
68857
|
if (redirectTo) {
|
|
68750
|
-
|
|
68858
|
+
const response = Response.redirect(redirectTo, 302);
|
|
68859
|
+
await set_session(args, response, session);
|
|
68860
|
+
return response;
|
|
68751
68861
|
}
|
|
68752
|
-
args.next();
|
|
68753
68862
|
}
|
|
68754
68863
|
var session_cookie_name = "__houdini__";
|
|
68755
|
-
async function set_session(req, value) {
|
|
68864
|
+
async function set_session(req, response, value) {
|
|
68756
68865
|
const today = new Date();
|
|
68757
68866
|
const expires = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1e3);
|
|
68758
68867
|
const serialized = await encode(value, req.session_keys[0]);
|
|
68759
|
-
|
|
68868
|
+
response.headers.set(
|
|
68760
68869
|
"Set-Cookie",
|
|
68761
68870
|
`${session_cookie_name}=${serialized}; Path=/; HttpOnly; Secure; SameSite=Lax; Expires=${expires.toUTCString()} `
|
|
68762
68871
|
);
|
|
@@ -68810,11 +68919,13 @@ export {
|
|
|
68810
68919
|
detectTools,
|
|
68811
68920
|
ensureArtifactImport,
|
|
68812
68921
|
ensureImports,
|
|
68922
|
+
exec,
|
|
68813
68923
|
extractHeaders,
|
|
68814
68924
|
extractHeadersStr,
|
|
68815
68925
|
extractQueries,
|
|
68816
68926
|
fetch2 as fetch,
|
|
68817
68927
|
find_graphql,
|
|
68928
|
+
find_match,
|
|
68818
68929
|
formatErrors,
|
|
68819
68930
|
fragmentKey,
|
|
68820
68931
|
fs_exports as fs,
|
|
@@ -68822,13 +68933,14 @@ export {
|
|
|
68822
68933
|
getCurrentConfig,
|
|
68823
68934
|
getMockConfig,
|
|
68824
68935
|
getRootType,
|
|
68936
|
+
get_route_segments,
|
|
68825
68937
|
get_session,
|
|
68826
68938
|
handle_request,
|
|
68827
68939
|
hashOriginal,
|
|
68828
68940
|
hashRaw,
|
|
68829
68941
|
houdini_mode,
|
|
68830
68942
|
isPending,
|
|
68831
|
-
|
|
68943
|
+
isSecondaryBuild,
|
|
68832
68944
|
keyFieldsForType,
|
|
68833
68945
|
loadLocalSchema,
|
|
68834
68946
|
load_manifest,
|
|
@@ -68841,6 +68953,7 @@ export {
|
|
|
68841
68953
|
parentTypeFromAncestors,
|
|
68842
68954
|
parseJS,
|
|
68843
68955
|
parseJSON,
|
|
68956
|
+
parse_page_pattern,
|
|
68844
68957
|
path_exports as path,
|
|
68845
68958
|
plugin,
|
|
68846
68959
|
printJS,
|
|
@@ -11,6 +11,7 @@ export declare const PaginateMode: {
|
|
|
11
11
|
readonly SinglePage: "SinglePage";
|
|
12
12
|
};
|
|
13
13
|
export type PaginateModes = ValuesOf<typeof PaginateMode>;
|
|
14
|
+
export * from '../router/types';
|
|
14
15
|
declare global {
|
|
15
16
|
namespace App {
|
|
16
17
|
interface Session {
|
|
@@ -356,4 +357,3 @@ export type QueryManifest = {
|
|
|
356
357
|
/** The filepath of the unit */
|
|
357
358
|
path: string;
|
|
358
359
|
};
|
|
359
|
-
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { GraphQLVariables } from '$houdini/runtime/lib/types';
|
|
2
|
+
import type { RouterManifest, RouterPageManifest } from './types';
|
|
3
|
+
export type RouteParam = {
|
|
4
|
+
name: string;
|
|
5
|
+
matcher: string;
|
|
6
|
+
optional: boolean;
|
|
7
|
+
rest: boolean;
|
|
8
|
+
chained: boolean;
|
|
9
|
+
};
|
|
10
|
+
export interface ParamMatcher {
|
|
11
|
+
(param: string): boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function find_match<_ComponentType>(manifest: RouterManifest<_ComponentType>, current: string, allowNull: true): [RouterPageManifest<_ComponentType> | null, GraphQLVariables];
|
|
14
|
+
export declare function find_match<_ComponentType>(manifest: RouterManifest<_ComponentType>, current: string, allowNull?: false): [RouterPageManifest<_ComponentType>, GraphQLVariables];
|
|
15
|
+
/**
|
|
16
|
+
* Creates the regex pattern, extracts parameter names, and generates types for a route
|
|
17
|
+
*/
|
|
18
|
+
export declare function parse_page_pattern(id: string): {
|
|
19
|
+
pattern: RegExp;
|
|
20
|
+
params: RouteParam[];
|
|
21
|
+
page_id: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Splits a route id into its segments, removing segments that
|
|
25
|
+
* don't affect the path (i.e. groups). The root route is represented by `/`
|
|
26
|
+
* and will be returned as `['']`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function get_route_segments(route: string): string[];
|
|
29
|
+
export declare function exec(match: RegExpMatchArray, params: RouteParam[]): Record<string, string> | undefined;
|
|
30
|
+
/**
|
|
31
|
+
Copyright (c) 2020 [these people](https://github.com/sveltejs/kit/graphs/contributors)
|
|
32
|
+
|
|
33
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
34
|
+
|
|
35
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
38
|
+
*/
|