houdini 1.2.13 → 1.2.15
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-cjs/package.json +1 -0
- package/build/adapter-esm/index.js +9 -0
- package/build/adapter-esm/package.json +1 -0
- package/build/cmd-cjs/index.js +19 -19
- package/build/cmd-esm/index.js +18 -18
- package/build/codegen-cjs/index.js +16 -17
- package/build/codegen-esm/index.js +16 -16
- package/build/lib/index.d.ts +2 -0
- package/build/lib/router/conventions.d.ts +3 -4
- package/build/lib/router/index.d.ts +1 -1
- package/build/lib/router/types.d.ts +1 -0
- package/build/lib-cjs/index.js +142 -22
- package/build/lib-esm/index.js +138 -21
- 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 +16 -17
- package/build/test-esm/index.js +16 -16
- package/build/vite-cjs/index.js +28 -32
- package/build/vite-esm/index.js +28 -31
- package/package.json +10 -1
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,6 +58621,7 @@ __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,
|
|
@@ -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() {
|
|
@@ -68235,6 +68356,8 @@ async function find_graphql(config2, parsedScript, walker) {
|
|
|
68235
68356
|
// src/lib/router/conventions.ts
|
|
68236
68357
|
var conventions_exports = {};
|
|
68237
68358
|
__export(conventions_exports, {
|
|
68359
|
+
adapter_config_path: () => adapter_config_path,
|
|
68360
|
+
app_component_path: () => app_component_path,
|
|
68238
68361
|
fallback_unit_path: () => fallback_unit_path,
|
|
68239
68362
|
is_layout: () => is_layout,
|
|
68240
68363
|
layout_unit_path: () => layout_unit_path,
|
|
@@ -68246,13 +68369,10 @@ __export(conventions_exports, {
|
|
|
68246
68369
|
read_layoutView: () => read_layoutView,
|
|
68247
68370
|
read_pageQuery: () => read_pageQuery,
|
|
68248
68371
|
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
68372
|
router_index_path: () => router_index_path,
|
|
68254
68373
|
router_path: () => router_path,
|
|
68255
|
-
serialized_manifest_path: () => serialized_manifest_path
|
|
68374
|
+
serialized_manifest_path: () => serialized_manifest_path,
|
|
68375
|
+
server_adapter_path: () => server_adapter_path
|
|
68256
68376
|
});
|
|
68257
68377
|
function router_path(config2) {
|
|
68258
68378
|
return path_exports.join(base_dir(config2), "Router.jsx");
|
|
@@ -68260,16 +68380,13 @@ function router_path(config2) {
|
|
|
68260
68380
|
function page_entry_path(config2, id, base) {
|
|
68261
68381
|
return path_exports.join(page_entries_dir(config2, base), `${id}.jsx`);
|
|
68262
68382
|
}
|
|
68263
|
-
function
|
|
68264
|
-
return path_exports.join(units_dir(config2, base), "render", "client.jsx");
|
|
68265
|
-
}
|
|
68266
|
-
function render_server_path(config2, base) {
|
|
68383
|
+
function server_adapter_path(config2, base) {
|
|
68267
68384
|
return path_exports.join(units_dir(config2, base), "render", "server.js");
|
|
68268
68385
|
}
|
|
68269
|
-
function
|
|
68270
|
-
return path_exports.join(units_dir(config2, base), "render", "
|
|
68386
|
+
function adapter_config_path(config2, base) {
|
|
68387
|
+
return path_exports.join(units_dir(config2, base), "render", "config.js");
|
|
68271
68388
|
}
|
|
68272
|
-
function
|
|
68389
|
+
function app_component_path(config2, base) {
|
|
68273
68390
|
return path_exports.join(units_dir(config2, base), "render", "App.jsx");
|
|
68274
68391
|
}
|
|
68275
68392
|
function page_unit_path(config2, id, base) {
|
|
@@ -68807,29 +68924,28 @@ function decode2(token) {
|
|
|
68807
68924
|
};
|
|
68808
68925
|
}
|
|
68809
68926
|
|
|
68810
|
-
// src/runtime/router/
|
|
68927
|
+
// src/runtime/router/session.ts
|
|
68811
68928
|
async function handle_request(args) {
|
|
68812
68929
|
const plugin_config = args.config.router ?? {};
|
|
68813
68930
|
if (plugin_config.auth && "redirect" in plugin_config.auth && args.url.startsWith(plugin_config.auth.redirect)) {
|
|
68814
68931
|
return await redirect_auth(args);
|
|
68815
68932
|
}
|
|
68816
|
-
args.next();
|
|
68817
68933
|
}
|
|
68818
68934
|
async function redirect_auth(args) {
|
|
68819
|
-
const { searchParams } = new URL(args.url, `http://${args.
|
|
68935
|
+
const { searchParams } = new URL(args.url, `http://${args.headers.get("host")}`);
|
|
68820
68936
|
const { redirectTo, ...session } = Object.fromEntries(searchParams.entries());
|
|
68821
|
-
await set_session(args, session);
|
|
68822
68937
|
if (redirectTo) {
|
|
68823
|
-
|
|
68938
|
+
const response = Response.redirect(redirectTo, 302);
|
|
68939
|
+
await set_session(args, response, session);
|
|
68940
|
+
return response;
|
|
68824
68941
|
}
|
|
68825
|
-
args.next();
|
|
68826
68942
|
}
|
|
68827
68943
|
var session_cookie_name = "__houdini__";
|
|
68828
|
-
async function set_session(req, value) {
|
|
68944
|
+
async function set_session(req, response, value) {
|
|
68829
68945
|
const today = new Date();
|
|
68830
68946
|
const expires = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1e3);
|
|
68831
68947
|
const serialized = await encode(value, req.session_keys[0]);
|
|
68832
|
-
|
|
68948
|
+
response.headers.set(
|
|
68833
68949
|
"Set-Cookie",
|
|
68834
68950
|
`${session_cookie_name}=${serialized}; Path=/; HttpOnly; Secure; SameSite=Lax; Expires=${expires.toUTCString()} `
|
|
68835
68951
|
);
|
|
@@ -68884,11 +69000,13 @@ async function get_session(req, secrets) {
|
|
|
68884
69000
|
detectTools,
|
|
68885
69001
|
ensureArtifactImport,
|
|
68886
69002
|
ensureImports,
|
|
69003
|
+
exec,
|
|
68887
69004
|
extractHeaders,
|
|
68888
69005
|
extractHeadersStr,
|
|
68889
69006
|
extractQueries,
|
|
68890
69007
|
fetch,
|
|
68891
69008
|
find_graphql,
|
|
69009
|
+
find_match,
|
|
68892
69010
|
formatErrors,
|
|
68893
69011
|
fragmentKey,
|
|
68894
69012
|
fs,
|
|
@@ -68896,6 +69014,7 @@ async function get_session(req, secrets) {
|
|
|
68896
69014
|
getCurrentConfig,
|
|
68897
69015
|
getMockConfig,
|
|
68898
69016
|
getRootType,
|
|
69017
|
+
get_route_segments,
|
|
68899
69018
|
get_session,
|
|
68900
69019
|
handle_request,
|
|
68901
69020
|
hashOriginal,
|
|
@@ -68915,6 +69034,7 @@ async function get_session(req, secrets) {
|
|
|
68915
69034
|
parentTypeFromAncestors,
|
|
68916
69035
|
parseJS,
|
|
68917
69036
|
parseJSON,
|
|
69037
|
+
parse_page_pattern,
|
|
68918
69038
|
path,
|
|
68919
69039
|
plugin,
|
|
68920
69040
|
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() {
|
|
@@ -68162,6 +68280,8 @@ async function find_graphql(config2, parsedScript, walker) {
|
|
|
68162
68280
|
// src/lib/router/conventions.ts
|
|
68163
68281
|
var conventions_exports = {};
|
|
68164
68282
|
__export(conventions_exports, {
|
|
68283
|
+
adapter_config_path: () => adapter_config_path,
|
|
68284
|
+
app_component_path: () => app_component_path,
|
|
68165
68285
|
fallback_unit_path: () => fallback_unit_path,
|
|
68166
68286
|
is_layout: () => is_layout,
|
|
68167
68287
|
layout_unit_path: () => layout_unit_path,
|
|
@@ -68173,13 +68293,10 @@ __export(conventions_exports, {
|
|
|
68173
68293
|
read_layoutView: () => read_layoutView,
|
|
68174
68294
|
read_pageQuery: () => read_pageQuery,
|
|
68175
68295
|
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
68296
|
router_index_path: () => router_index_path,
|
|
68181
68297
|
router_path: () => router_path,
|
|
68182
|
-
serialized_manifest_path: () => serialized_manifest_path
|
|
68298
|
+
serialized_manifest_path: () => serialized_manifest_path,
|
|
68299
|
+
server_adapter_path: () => server_adapter_path
|
|
68183
68300
|
});
|
|
68184
68301
|
function router_path(config2) {
|
|
68185
68302
|
return path_exports.join(base_dir(config2), "Router.jsx");
|
|
@@ -68187,16 +68304,13 @@ function router_path(config2) {
|
|
|
68187
68304
|
function page_entry_path(config2, id, base) {
|
|
68188
68305
|
return path_exports.join(page_entries_dir(config2, base), `${id}.jsx`);
|
|
68189
68306
|
}
|
|
68190
|
-
function
|
|
68191
|
-
return path_exports.join(units_dir(config2, base), "render", "client.jsx");
|
|
68192
|
-
}
|
|
68193
|
-
function render_server_path(config2, base) {
|
|
68307
|
+
function server_adapter_path(config2, base) {
|
|
68194
68308
|
return path_exports.join(units_dir(config2, base), "render", "server.js");
|
|
68195
68309
|
}
|
|
68196
|
-
function
|
|
68197
|
-
return path_exports.join(units_dir(config2, base), "render", "
|
|
68310
|
+
function adapter_config_path(config2, base) {
|
|
68311
|
+
return path_exports.join(units_dir(config2, base), "render", "config.js");
|
|
68198
68312
|
}
|
|
68199
|
-
function
|
|
68313
|
+
function app_component_path(config2, base) {
|
|
68200
68314
|
return path_exports.join(units_dir(config2, base), "render", "App.jsx");
|
|
68201
68315
|
}
|
|
68202
68316
|
function page_unit_path(config2, id, base) {
|
|
@@ -68734,29 +68848,28 @@ function decode2(token) {
|
|
|
68734
68848
|
};
|
|
68735
68849
|
}
|
|
68736
68850
|
|
|
68737
|
-
// src/runtime/router/
|
|
68851
|
+
// src/runtime/router/session.ts
|
|
68738
68852
|
async function handle_request(args) {
|
|
68739
68853
|
const plugin_config = args.config.router ?? {};
|
|
68740
68854
|
if (plugin_config.auth && "redirect" in plugin_config.auth && args.url.startsWith(plugin_config.auth.redirect)) {
|
|
68741
68855
|
return await redirect_auth(args);
|
|
68742
68856
|
}
|
|
68743
|
-
args.next();
|
|
68744
68857
|
}
|
|
68745
68858
|
async function redirect_auth(args) {
|
|
68746
|
-
const { searchParams } = new URL(args.url, `http://${args.
|
|
68859
|
+
const { searchParams } = new URL(args.url, `http://${args.headers.get("host")}`);
|
|
68747
68860
|
const { redirectTo, ...session } = Object.fromEntries(searchParams.entries());
|
|
68748
|
-
await set_session(args, session);
|
|
68749
68861
|
if (redirectTo) {
|
|
68750
|
-
|
|
68862
|
+
const response = Response.redirect(redirectTo, 302);
|
|
68863
|
+
await set_session(args, response, session);
|
|
68864
|
+
return response;
|
|
68751
68865
|
}
|
|
68752
|
-
args.next();
|
|
68753
68866
|
}
|
|
68754
68867
|
var session_cookie_name = "__houdini__";
|
|
68755
|
-
async function set_session(req, value) {
|
|
68868
|
+
async function set_session(req, response, value) {
|
|
68756
68869
|
const today = new Date();
|
|
68757
68870
|
const expires = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1e3);
|
|
68758
68871
|
const serialized = await encode(value, req.session_keys[0]);
|
|
68759
|
-
|
|
68872
|
+
response.headers.set(
|
|
68760
68873
|
"Set-Cookie",
|
|
68761
68874
|
`${session_cookie_name}=${serialized}; Path=/; HttpOnly; Secure; SameSite=Lax; Expires=${expires.toUTCString()} `
|
|
68762
68875
|
);
|
|
@@ -68810,11 +68923,13 @@ export {
|
|
|
68810
68923
|
detectTools,
|
|
68811
68924
|
ensureArtifactImport,
|
|
68812
68925
|
ensureImports,
|
|
68926
|
+
exec,
|
|
68813
68927
|
extractHeaders,
|
|
68814
68928
|
extractHeadersStr,
|
|
68815
68929
|
extractQueries,
|
|
68816
68930
|
fetch2 as fetch,
|
|
68817
68931
|
find_graphql,
|
|
68932
|
+
find_match,
|
|
68818
68933
|
formatErrors,
|
|
68819
68934
|
fragmentKey,
|
|
68820
68935
|
fs_exports as fs,
|
|
@@ -68822,6 +68937,7 @@ export {
|
|
|
68822
68937
|
getCurrentConfig,
|
|
68823
68938
|
getMockConfig,
|
|
68824
68939
|
getRootType,
|
|
68940
|
+
get_route_segments,
|
|
68825
68941
|
get_session,
|
|
68826
68942
|
handle_request,
|
|
68827
68943
|
hashOriginal,
|
|
@@ -68841,6 +68957,7 @@ export {
|
|
|
68841
68957
|
parentTypeFromAncestors,
|
|
68842
68958
|
parseJS,
|
|
68843
68959
|
parseJSON,
|
|
68960
|
+
parse_page_pattern,
|
|
68844
68961
|
path_exports as path,
|
|
68845
68962
|
plugin,
|
|
68846
68963
|
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
|
+
*/
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
export declare function get_session(req: Headers, secrets: string[]): Promise<App.Session>;
|
|
25
|
-
export {};
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { createServerAdapter as createAdapter } from '@whatwg-node/server';
|
|
3
|
+
import { type GraphQLSchema } from 'graphql';
|
|
4
|
+
import { createYoga } from 'graphql-yoga';
|
|
5
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
6
|
+
import type { RouterManifest, RouterPageManifest, YogaServerOptions } from './types';
|
|
7
|
+
export declare const serverAdapterFactory: <ComponentType>({ schema, yoga, production, manifest, on_render, pipe, assetPrefix, }: {
|
|
8
|
+
schema?: GraphQLSchema | null | undefined;
|
|
9
|
+
yoga?: import("graphql-yoga").YogaServerInstance<Record<string, any>, Record<string, any>> | null | undefined;
|
|
10
|
+
assetPrefix: string;
|
|
11
|
+
production?: boolean | undefined;
|
|
12
|
+
pipe?: ServerResponse<IncomingMessage> | undefined;
|
|
13
|
+
on_render: (args: {
|
|
14
|
+
url: string;
|
|
15
|
+
match: RouterPageManifest<ComponentType> | null;
|
|
16
|
+
manifest: RouterManifest<unknown>;
|
|
17
|
+
session: App.Session;
|
|
18
|
+
pipe?: ServerResponse<IncomingMessage> | undefined;
|
|
19
|
+
}) => Response | Promise<Response>;
|
|
20
|
+
manifest: RouterManifest<ComponentType> | null;
|
|
21
|
+
} & Omit<import("graphql-yoga").YogaServerOptions<Record<string, any>, Record<string, any>>, "schema">) => ReturnType<typeof createAdapter>;
|
|
22
|
+
export type ServerAdapterFactory = typeof serverAdapterFactory;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ConfigFile } from '../lib';
|
|
2
|
+
type ServerHandlerArgs = {
|
|
3
|
+
url: string;
|
|
4
|
+
config: ConfigFile;
|
|
5
|
+
session_keys: string[];
|
|
6
|
+
headers: Headers;
|
|
7
|
+
};
|
|
8
|
+
export declare function handle_request(args: ServerHandlerArgs): Promise<Response | undefined>;
|
|
9
|
+
export type Server = {
|
|
10
|
+
use(fn: ServerMiddleware): void;
|
|
11
|
+
};
|
|
12
|
+
export type ServerMiddleware = (req: IncomingRequest, res: ServerResponse, next: () => void) => void;
|
|
13
|
+
export type IncomingRequest = {
|
|
14
|
+
url?: string;
|
|
15
|
+
headers: Headers;
|
|
16
|
+
};
|
|
17
|
+
export type ServerResponse = {
|
|
18
|
+
redirect(url: string, status?: number): void;
|
|
19
|
+
set_header(name: string, value: string): void;
|
|
20
|
+
};
|
|
21
|
+
export declare function get_session(req: Headers, secrets: string[]): Promise<App.Session>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { QueryArtifact } from '$houdini/runtime/lib/types';
|
|
2
|
+
import type { createYoga } from 'graphql-yoga';
|
|
3
|
+
import type { RouteParam } from './match';
|
|
4
|
+
export type YogaServer = ReturnType<typeof createYoga>;
|
|
5
|
+
export type YogaServerOptions = Parameters<typeof createYoga>[0];
|
|
6
|
+
export type RouterManifest<_ComponentType> = {
|
|
7
|
+
pages: Record<string, RouterPageManifest<_ComponentType>>;
|
|
8
|
+
};
|
|
9
|
+
export type { ServerAdapterFactory } from './server';
|
|
10
|
+
export type RouterPageManifest<_ComponentType> = {
|
|
11
|
+
id: string;
|
|
12
|
+
pattern: RegExp;
|
|
13
|
+
params: RouteParam[];
|
|
14
|
+
documents: Record<string, {
|
|
15
|
+
artifact: () => Promise<{
|
|
16
|
+
default: QueryArtifact;
|
|
17
|
+
}>;
|
|
18
|
+
loading: boolean;
|
|
19
|
+
}>;
|
|
20
|
+
component: () => Promise<{
|
|
21
|
+
default: (props: any) => _ComponentType;
|
|
22
|
+
}>;
|
|
23
|
+
};
|