houdini-react 1.3.6 → 1.3.8
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/index.d.ts +1 -3
- package/build/plugin/state.d.ts +3 -0
- package/build/plugin-cjs/index.js +238 -240
- package/build/plugin-esm/index.js +237 -237
- package/build/runtime/routing/Router.d.ts +6 -32
- package/build/runtime/routing/hooks.d.ts +40 -0
- package/build/runtime/routing/index.d.ts +1 -0
- package/build/runtime-cjs/hooks/useDocumentHandle.js +4 -4
- package/build/runtime-cjs/hooks/useDocumentStore.js +2 -2
- package/build/runtime-cjs/hooks/useDocumentSubscription.js +2 -2
- package/build/runtime-cjs/hooks/useMutation.js +2 -2
- package/build/runtime-cjs/routing/Router.d.ts +6 -32
- package/build/runtime-cjs/routing/Router.js +11 -62
- package/build/runtime-cjs/routing/hooks.d.ts +40 -0
- package/build/runtime-cjs/routing/hooks.js +89 -0
- package/build/runtime-cjs/routing/index.d.ts +1 -0
- package/build/runtime-cjs/routing/index.js +1 -0
- package/build/runtime-esm/hooks/useDocumentHandle.js +1 -1
- package/build/runtime-esm/hooks/useDocumentStore.js +1 -1
- package/build/runtime-esm/hooks/useDocumentSubscription.js +1 -1
- package/build/runtime-esm/hooks/useMutation.js +1 -1
- package/build/runtime-esm/routing/Router.d.ts +6 -32
- package/build/runtime-esm/routing/Router.js +3 -49
- package/build/runtime-esm/routing/hooks.d.ts +40 -0
- package/build/runtime-esm/routing/hooks.js +53 -0
- package/build/runtime-esm/routing/index.d.ts +1 -0
- package/build/runtime-esm/routing/index.js +1 -0
- package/package.json +2 -2
|
@@ -16393,7 +16393,7 @@ import { Kind as Kind12 } from "graphql";
|
|
|
16393
16393
|
import { Kind as Kind13 } from "graphql";
|
|
16394
16394
|
import { Kind as Kind14 } from "graphql";
|
|
16395
16395
|
import { parse as parse2, Kind as Kind16, isSchema, isDefinitionNode } from "graphql";
|
|
16396
|
-
import * as
|
|
16396
|
+
import * as graphql5 from "graphql";
|
|
16397
16397
|
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
|
|
16398
16398
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
16399
16399
|
import { posix, win32 } from "node:path";
|
|
@@ -16416,9 +16416,9 @@ import { types as types3 } from "node:util";
|
|
|
16416
16416
|
import http from "node:http";
|
|
16417
16417
|
import { format as formatUrl } from "node:url";
|
|
16418
16418
|
import { deprecate as deprecate2 } from "node:util";
|
|
16419
|
-
import * as graphql2 from "graphql";
|
|
16420
16419
|
import * as graphql3 from "graphql";
|
|
16421
|
-
import * as
|
|
16420
|
+
import * as graphql2 from "graphql";
|
|
16421
|
+
import * as graphql4 from "graphql";
|
|
16422
16422
|
import * as graphql6 from "graphql";
|
|
16423
16423
|
import * as graphql7 from "graphql";
|
|
16424
16424
|
var require2 = conflict_free(import.meta.url);
|
|
@@ -79417,43 +79417,43 @@ __export(conventions_exports, {
|
|
|
79417
79417
|
vite_render_path: () => vite_render_path
|
|
79418
79418
|
});
|
|
79419
79419
|
function router_path(config) {
|
|
79420
|
-
return
|
|
79420
|
+
return join2(base_dir(config), "Router.jsx");
|
|
79421
79421
|
}
|
|
79422
79422
|
function page_entry_path(config, id, base) {
|
|
79423
|
-
return
|
|
79423
|
+
return join2(page_entries_dir(config, base), `${id}.jsx`);
|
|
79424
79424
|
}
|
|
79425
79425
|
function server_adapter_path(config, base) {
|
|
79426
|
-
return
|
|
79426
|
+
return join2(units_dir(config, base), "render", "server.js");
|
|
79427
79427
|
}
|
|
79428
79428
|
function adapter_config_path(config, base) {
|
|
79429
|
-
return
|
|
79429
|
+
return join2(units_dir(config, base), "render", "config.js");
|
|
79430
79430
|
}
|
|
79431
79431
|
function vite_render_path(config, base) {
|
|
79432
|
-
return
|
|
79432
|
+
return join2(units_dir(config, base), "render", "vite.js");
|
|
79433
79433
|
}
|
|
79434
79434
|
function app_component_path(config, base) {
|
|
79435
|
-
return
|
|
79435
|
+
return join2(units_dir(config, base), "render", "App.jsx");
|
|
79436
79436
|
}
|
|
79437
79437
|
function page_unit_path(config, id, base) {
|
|
79438
|
-
return
|
|
79438
|
+
return join2(page_units_dir(config, base), `${id}.jsx`);
|
|
79439
79439
|
}
|
|
79440
79440
|
function layout_unit_path(config, id, base) {
|
|
79441
|
-
return
|
|
79441
|
+
return join2(layout_units_dir(config, base), `${id}.jsx`);
|
|
79442
79442
|
}
|
|
79443
79443
|
function componentField_unit_path(config, id, base) {
|
|
79444
|
-
return
|
|
79444
|
+
return join2(units_dir(config, base), "componentFields", `wrapper_${id}.jsx`);
|
|
79445
79445
|
}
|
|
79446
79446
|
function fallback_unit_path(config, which, id, base) {
|
|
79447
|
-
return
|
|
79447
|
+
return join2(fallbacks_units_dir(config, which, base), `${id}.jsx`);
|
|
79448
79448
|
}
|
|
79449
79449
|
async function read_pageQuery(base) {
|
|
79450
|
-
const target =
|
|
79451
|
-
return [target, await
|
|
79450
|
+
const target = join2(base, "+page.gql");
|
|
79451
|
+
return [target, await readFile(target)];
|
|
79452
79452
|
}
|
|
79453
79453
|
async function read_pageView(base) {
|
|
79454
79454
|
for (const name of ["+page.tsx", "+page.jsx"]) {
|
|
79455
|
-
let target =
|
|
79456
|
-
let result = await
|
|
79455
|
+
let target = join2(base, name);
|
|
79456
|
+
let result = await readFile(target);
|
|
79457
79457
|
if (result) {
|
|
79458
79458
|
return [target, result];
|
|
79459
79459
|
}
|
|
@@ -79461,13 +79461,13 @@ async function read_pageView(base) {
|
|
|
79461
79461
|
return [null, null];
|
|
79462
79462
|
}
|
|
79463
79463
|
async function read_layoutQuery(base) {
|
|
79464
|
-
const target =
|
|
79465
|
-
return [target, await
|
|
79464
|
+
const target = join2(base, "+layout.gql");
|
|
79465
|
+
return [target, await readFile(target)];
|
|
79466
79466
|
}
|
|
79467
79467
|
async function read_layoutView(base) {
|
|
79468
79468
|
for (const name of ["+layout.tsx", "+layout.jsx"]) {
|
|
79469
|
-
let target =
|
|
79470
|
-
let result = await
|
|
79469
|
+
let target = join2(base, name);
|
|
79470
|
+
let result = await readFile(target);
|
|
79471
79471
|
if (result) {
|
|
79472
79472
|
return [target, result];
|
|
79473
79473
|
}
|
|
@@ -79475,10 +79475,10 @@ async function read_layoutView(base) {
|
|
|
79475
79475
|
return [null, null];
|
|
79476
79476
|
}
|
|
79477
79477
|
function temp_dir(config, key) {
|
|
79478
|
-
return
|
|
79478
|
+
return join2(config.rootDir, "temp", key);
|
|
79479
79479
|
}
|
|
79480
79480
|
function router_index_path(config) {
|
|
79481
|
-
return
|
|
79481
|
+
return join2(config.routesDir, "..", "+index.jsx");
|
|
79482
79482
|
}
|
|
79483
79483
|
function is_layout(path4) {
|
|
79484
79484
|
return path4.endsWith("+layout.tsx") || path4.endsWith("+layout.jsx");
|
|
@@ -79501,27 +79501,210 @@ function page_id(path4) {
|
|
|
79501
79501
|
return copy;
|
|
79502
79502
|
}
|
|
79503
79503
|
function page_entries_dir(config, base) {
|
|
79504
|
-
return
|
|
79504
|
+
return join2(units_dir(config, base), "entries");
|
|
79505
79505
|
}
|
|
79506
79506
|
function page_units_dir(config, base) {
|
|
79507
|
-
return
|
|
79507
|
+
return join2(units_dir(config, base), "pages");
|
|
79508
79508
|
}
|
|
79509
79509
|
function layout_units_dir(config, base) {
|
|
79510
|
-
return
|
|
79510
|
+
return join2(units_dir(config, base), "layouts");
|
|
79511
79511
|
}
|
|
79512
79512
|
function fallbacks_units_dir(config, which, base) {
|
|
79513
|
-
return
|
|
79513
|
+
return join2(units_dir(config, base), "fallbacks", which);
|
|
79514
79514
|
}
|
|
79515
79515
|
function units_dir(config, base = base_dir(config)) {
|
|
79516
|
-
return
|
|
79516
|
+
return join2(base, "units");
|
|
79517
79517
|
}
|
|
79518
79518
|
function base_dir(config) {
|
|
79519
79519
|
return config.pluginDirectory("houdini-react");
|
|
79520
79520
|
}
|
|
79521
79521
|
function serialized_manifest_path(config, base = base_dir(config)) {
|
|
79522
|
-
return
|
|
79522
|
+
return join2(base, "manifest.json");
|
|
79523
79523
|
}
|
|
79524
79524
|
var t2 = __toESM2(require_lib5(), 1);
|
|
79525
|
+
var param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
|
|
79526
|
+
function parse_page_pattern(id) {
|
|
79527
|
+
const params = [];
|
|
79528
|
+
const pattern = id === "/" ? /^\/$/ : new RegExp(
|
|
79529
|
+
`^${get_route_segments(id).map((segment) => {
|
|
79530
|
+
const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
|
|
79531
|
+
if (rest_match) {
|
|
79532
|
+
params.push({
|
|
79533
|
+
name: rest_match[1],
|
|
79534
|
+
matcher: rest_match[2],
|
|
79535
|
+
optional: false,
|
|
79536
|
+
rest: true,
|
|
79537
|
+
chained: true
|
|
79538
|
+
});
|
|
79539
|
+
return "(?:/(.*))?";
|
|
79540
|
+
}
|
|
79541
|
+
const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment);
|
|
79542
|
+
if (optional_match) {
|
|
79543
|
+
params.push({
|
|
79544
|
+
name: optional_match[1],
|
|
79545
|
+
matcher: optional_match[2],
|
|
79546
|
+
optional: true,
|
|
79547
|
+
rest: false,
|
|
79548
|
+
chained: true
|
|
79549
|
+
});
|
|
79550
|
+
return "(?:/([^/]+))?";
|
|
79551
|
+
}
|
|
79552
|
+
if (!segment) {
|
|
79553
|
+
return;
|
|
79554
|
+
}
|
|
79555
|
+
const parts = segment.split(/\[(.+?)\](?!\])/);
|
|
79556
|
+
const result = parts.map((content, i2) => {
|
|
79557
|
+
if (i2 % 2) {
|
|
79558
|
+
if (content.startsWith("x+")) {
|
|
79559
|
+
return escape3(
|
|
79560
|
+
String.fromCharCode(parseInt(content.slice(2), 16))
|
|
79561
|
+
);
|
|
79562
|
+
}
|
|
79563
|
+
if (content.startsWith("u+")) {
|
|
79564
|
+
return escape3(
|
|
79565
|
+
String.fromCharCode(
|
|
79566
|
+
...content.slice(2).split("-").map((code) => parseInt(code, 16))
|
|
79567
|
+
)
|
|
79568
|
+
);
|
|
79569
|
+
}
|
|
79570
|
+
const match2 = param_pattern.exec(content);
|
|
79571
|
+
if (!match2) {
|
|
79572
|
+
throw new Error(
|
|
79573
|
+
`Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
|
|
79574
|
+
);
|
|
79575
|
+
}
|
|
79576
|
+
const [, is_optional, is_rest, name, matcher] = match2;
|
|
79577
|
+
params.push({
|
|
79578
|
+
name,
|
|
79579
|
+
matcher,
|
|
79580
|
+
optional: !!is_optional,
|
|
79581
|
+
rest: !!is_rest,
|
|
79582
|
+
chained: is_rest ? i2 === 1 && parts[0] === "" : false
|
|
79583
|
+
});
|
|
79584
|
+
return is_rest ? "(.*?)" : is_optional ? "([^/]*)?" : "([^/]+?)";
|
|
79585
|
+
}
|
|
79586
|
+
return escape3(content);
|
|
79587
|
+
}).join("");
|
|
79588
|
+
return "/" + result;
|
|
79589
|
+
}).join("")}/?$`
|
|
79590
|
+
);
|
|
79591
|
+
return { pattern, params, page_id: id };
|
|
79592
|
+
}
|
|
79593
|
+
function affects_path(segment) {
|
|
79594
|
+
return !/^\([^)]+\)$/.test(segment);
|
|
79595
|
+
}
|
|
79596
|
+
function get_route_segments(route) {
|
|
79597
|
+
return route.slice(1).split("/").filter(affects_path);
|
|
79598
|
+
}
|
|
79599
|
+
function escape3(str) {
|
|
79600
|
+
return str.normalize().replace(/[[\]]/g, "\\$&").replace(/%/g, "%25").replace(/\//g, "%2[Ff]").replace(/\?/g, "%3[Ff]").replace(/#/g, "%23").replace(/[.*+?^${}()|\\]/g, "\\$&");
|
|
79601
|
+
}
|
|
79602
|
+
function processComponentFieldDirective(directive) {
|
|
79603
|
+
let field;
|
|
79604
|
+
let exportValue;
|
|
79605
|
+
let prop;
|
|
79606
|
+
let raw;
|
|
79607
|
+
for (const arg of directive.arguments ?? []) {
|
|
79608
|
+
if (arg.name.value === "field" && arg.value.kind === "StringValue") {
|
|
79609
|
+
field = arg.value.value;
|
|
79610
|
+
} else if (arg.name.value === "export" && arg.value.kind === "StringValue") {
|
|
79611
|
+
exportValue = arg.value.value;
|
|
79612
|
+
} else if (arg.name.value === "prop" && arg.value.kind === "StringValue") {
|
|
79613
|
+
prop = arg.value.value;
|
|
79614
|
+
} else if (arg.name.value === "raw" && arg.value.kind === "StringValue") {
|
|
79615
|
+
raw = arg.value.value;
|
|
79616
|
+
}
|
|
79617
|
+
}
|
|
79618
|
+
const missing = [];
|
|
79619
|
+
if (!field) {
|
|
79620
|
+
missing.push("field");
|
|
79621
|
+
}
|
|
79622
|
+
if (!prop) {
|
|
79623
|
+
missing.push("prop");
|
|
79624
|
+
}
|
|
79625
|
+
if (missing.length > 0) {
|
|
79626
|
+
throw new Error(`missing arguments to @componentField: ${missing.join(", ")}`);
|
|
79627
|
+
}
|
|
79628
|
+
return {
|
|
79629
|
+
prop,
|
|
79630
|
+
field,
|
|
79631
|
+
raw,
|
|
79632
|
+
export: exportValue
|
|
79633
|
+
};
|
|
79634
|
+
}
|
|
79635
|
+
function unwrapType(config, type, wrappers = [], convertRuntimeScalars) {
|
|
79636
|
+
if (type.kind === "NonNullType") {
|
|
79637
|
+
return unwrapType(config, type.type, [TypeWrapper.NonNull, ...wrappers]);
|
|
79638
|
+
}
|
|
79639
|
+
if (type instanceof graphql2.GraphQLNonNull) {
|
|
79640
|
+
return unwrapType(config, type.ofType, [TypeWrapper.NonNull, ...wrappers]);
|
|
79641
|
+
}
|
|
79642
|
+
if (wrappers[0] !== TypeWrapper.NonNull) {
|
|
79643
|
+
wrappers.unshift(TypeWrapper.Nullable);
|
|
79644
|
+
}
|
|
79645
|
+
if (type.kind === "ListType") {
|
|
79646
|
+
return unwrapType(config, type.type, [TypeWrapper.List, ...wrappers]);
|
|
79647
|
+
}
|
|
79648
|
+
if (type instanceof graphql2.GraphQLList) {
|
|
79649
|
+
return unwrapType(config, type.ofType, [TypeWrapper.List, ...wrappers]);
|
|
79650
|
+
}
|
|
79651
|
+
if (convertRuntimeScalars && config.configFile.features?.runtimeScalars?.[type.name.value]) {
|
|
79652
|
+
type = config.schema.getType(
|
|
79653
|
+
config.configFile.features?.runtimeScalars?.[type.name.value].type
|
|
79654
|
+
);
|
|
79655
|
+
}
|
|
79656
|
+
const namedType = config.schema.getType(type.name.value || type.name);
|
|
79657
|
+
if (!namedType) {
|
|
79658
|
+
throw new Error("Unknown type: " + type.name.value || type.name);
|
|
79659
|
+
}
|
|
79660
|
+
return { type: namedType, wrappers };
|
|
79661
|
+
}
|
|
79662
|
+
var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
|
|
79663
|
+
TypeWrapper2["Nullable"] = "Nullable";
|
|
79664
|
+
TypeWrapper2["List"] = "List";
|
|
79665
|
+
TypeWrapper2["NonNull"] = "NonNull";
|
|
79666
|
+
return TypeWrapper2;
|
|
79667
|
+
})(TypeWrapper || {});
|
|
79668
|
+
var import_parser = __toESM2(require_lib6(), 1);
|
|
79669
|
+
var import_recast = __toESM2(require_main2(), 1);
|
|
79670
|
+
var import_deepmerge = __toESM2(require_cjs(), 1);
|
|
79671
|
+
function deepMerge2(filepath, ...targets) {
|
|
79672
|
+
try {
|
|
79673
|
+
if (targets.length === 1) {
|
|
79674
|
+
return targets[0];
|
|
79675
|
+
} else if (targets.length === 2) {
|
|
79676
|
+
return (0, import_deepmerge.default)(targets[0], targets[1], {
|
|
79677
|
+
arrayMerge: (source, update) => [...new Set(source.concat(update))]
|
|
79678
|
+
});
|
|
79679
|
+
}
|
|
79680
|
+
return deepMerge2(filepath, targets[0], deepMerge2(filepath, ...targets.slice(1)));
|
|
79681
|
+
} catch (e2) {
|
|
79682
|
+
throw new HoudiniError({
|
|
79683
|
+
filepath,
|
|
79684
|
+
message: "could not merge: " + JSON.stringify(targets, null, 4),
|
|
79685
|
+
description: e2.message
|
|
79686
|
+
});
|
|
79687
|
+
}
|
|
79688
|
+
}
|
|
79689
|
+
function parseJS(str, config) {
|
|
79690
|
+
const defaultConfig = {
|
|
79691
|
+
plugins: [
|
|
79692
|
+
"typescript",
|
|
79693
|
+
"importAssertions",
|
|
79694
|
+
"decorators-legacy",
|
|
79695
|
+
"explicitResourceManagement"
|
|
79696
|
+
],
|
|
79697
|
+
sourceType: "module"
|
|
79698
|
+
};
|
|
79699
|
+
return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
|
|
79700
|
+
}
|
|
79701
|
+
async function printJS(script, options) {
|
|
79702
|
+
if (options?.pretty) {
|
|
79703
|
+
return (0, import_recast.prettyPrint)(script, options);
|
|
79704
|
+
} else {
|
|
79705
|
+
return (0, import_recast.print)(script, options);
|
|
79706
|
+
}
|
|
79707
|
+
}
|
|
79525
79708
|
async function load_manifest(args) {
|
|
79526
79709
|
const manifest2 = await walk_routes({
|
|
79527
79710
|
config: args.config,
|
|
@@ -79543,7 +79726,7 @@ async function load_manifest(args) {
|
|
|
79543
79726
|
});
|
|
79544
79727
|
if (args.includeArtifacts) {
|
|
79545
79728
|
try {
|
|
79546
|
-
for (const artifactPath of await
|
|
79729
|
+
for (const artifactPath of await readdir2(args.config.artifactDirectory)) {
|
|
79547
79730
|
if (!artifactPath.endsWith(".js") || artifactPath === "index.js") {
|
|
79548
79731
|
continue;
|
|
79549
79732
|
}
|
|
@@ -79553,9 +79736,9 @@ async function load_manifest(args) {
|
|
|
79553
79736
|
}
|
|
79554
79737
|
}
|
|
79555
79738
|
try {
|
|
79556
|
-
await
|
|
79557
|
-
for (const child of await
|
|
79558
|
-
const name = child.isDirectory() ? child.name :
|
|
79739
|
+
await stat(args.config.localApiDir);
|
|
79740
|
+
for (const child of await readdir2(args.config.localApiDir, { withFileTypes: true })) {
|
|
79741
|
+
const name = child.isDirectory() ? child.name : parse32(child.name).name;
|
|
79559
79742
|
if (name === "+schema") {
|
|
79560
79743
|
manifest2.local_schema = true;
|
|
79561
79744
|
} else if (name === "+yoga") {
|
|
@@ -79567,7 +79750,7 @@ async function load_manifest(args) {
|
|
|
79567
79750
|
return manifest2;
|
|
79568
79751
|
}
|
|
79569
79752
|
async function walk_routes(args) {
|
|
79570
|
-
const directory_contents = await
|
|
79753
|
+
const directory_contents = await readdir2(args.filepath, {
|
|
79571
79754
|
withFileTypes: true
|
|
79572
79755
|
});
|
|
79573
79756
|
const variables = { ...args.variables };
|
|
@@ -79644,7 +79827,7 @@ async function walk_routes(args) {
|
|
|
79644
79827
|
}
|
|
79645
79828
|
return walk_routes({
|
|
79646
79829
|
...args,
|
|
79647
|
-
filepath:
|
|
79830
|
+
filepath: join2(args.filepath, dir.name),
|
|
79648
79831
|
url: `${args.url}${dir.name}/`,
|
|
79649
79832
|
queries: newLayoutQueries,
|
|
79650
79833
|
layouts: newLayouts,
|
|
@@ -79669,7 +79852,7 @@ async function add_view(args) {
|
|
|
79669
79852
|
queries,
|
|
79670
79853
|
url: args.url,
|
|
79671
79854
|
layouts: args.layouts,
|
|
79672
|
-
path:
|
|
79855
|
+
path: relative(args.config.projectRoot, args.path),
|
|
79673
79856
|
query_options: args.queries,
|
|
79674
79857
|
params: Object.fromEntries(
|
|
79675
79858
|
parse_page_pattern(args.url).params.map((param) => [
|
|
@@ -79681,7 +79864,7 @@ async function add_view(args) {
|
|
|
79681
79864
|
return target[id];
|
|
79682
79865
|
}
|
|
79683
79866
|
async function add_query(args) {
|
|
79684
|
-
const parsed =
|
|
79867
|
+
const parsed = graphql3.parse(args.contents);
|
|
79685
79868
|
const query2 = parsed.definitions.find(
|
|
79686
79869
|
(def) => def.kind === "OperationDefinition" && def.operation === "query"
|
|
79687
79870
|
);
|
|
@@ -79689,7 +79872,7 @@ async function add_query(args) {
|
|
|
79689
79872
|
throw new Error("No query found");
|
|
79690
79873
|
}
|
|
79691
79874
|
let loading = false;
|
|
79692
|
-
await
|
|
79875
|
+
await graphql3.visit(parsed, {
|
|
79693
79876
|
Directive(node) {
|
|
79694
79877
|
if (node.name.value === args.config.loadingDirective) {
|
|
79695
79878
|
loading = true;
|
|
@@ -79708,7 +79891,7 @@ async function add_query(args) {
|
|
|
79708
79891
|
Object.assign(args.variables, queryVariables);
|
|
79709
79892
|
const target = args.type === "page" ? args.project.page_queries : args.project.layout_queries;
|
|
79710
79893
|
target[page_id(args.url)] = {
|
|
79711
|
-
path:
|
|
79894
|
+
path: relative(args.config.routesDir, args.path),
|
|
79712
79895
|
name: query2.name.value,
|
|
79713
79896
|
url: args.url,
|
|
79714
79897
|
loading,
|
|
@@ -82097,114 +82280,8 @@ function isSecondaryBuild() {
|
|
|
82097
82280
|
}
|
|
82098
82281
|
var currentDir = dirname(fileURLToPath3(import.meta.url));
|
|
82099
82282
|
var DEFAULT_CONFIG_PATH = join2(process.cwd(), "houdini.config.js");
|
|
82100
|
-
var emptySchema =
|
|
82283
|
+
var emptySchema = graphql5.buildSchema("type Query { hello: String }");
|
|
82101
82284
|
var defaultDirectives = emptySchema.getDirectives().map((dir) => dir.name);
|
|
82102
|
-
function processComponentFieldDirective(directive) {
|
|
82103
|
-
let field;
|
|
82104
|
-
let exportValue;
|
|
82105
|
-
let prop;
|
|
82106
|
-
let raw;
|
|
82107
|
-
for (const arg of directive.arguments ?? []) {
|
|
82108
|
-
if (arg.name.value === "field" && arg.value.kind === "StringValue") {
|
|
82109
|
-
field = arg.value.value;
|
|
82110
|
-
} else if (arg.name.value === "export" && arg.value.kind === "StringValue") {
|
|
82111
|
-
exportValue = arg.value.value;
|
|
82112
|
-
} else if (arg.name.value === "prop" && arg.value.kind === "StringValue") {
|
|
82113
|
-
prop = arg.value.value;
|
|
82114
|
-
} else if (arg.name.value === "raw" && arg.value.kind === "StringValue") {
|
|
82115
|
-
raw = arg.value.value;
|
|
82116
|
-
}
|
|
82117
|
-
}
|
|
82118
|
-
const missing = [];
|
|
82119
|
-
if (!field) {
|
|
82120
|
-
missing.push("field");
|
|
82121
|
-
}
|
|
82122
|
-
if (!prop) {
|
|
82123
|
-
missing.push("prop");
|
|
82124
|
-
}
|
|
82125
|
-
if (missing.length > 0) {
|
|
82126
|
-
throw new Error(`missing arguments to @componentField: ${missing.join(", ")}`);
|
|
82127
|
-
}
|
|
82128
|
-
return {
|
|
82129
|
-
prop,
|
|
82130
|
-
field,
|
|
82131
|
-
raw,
|
|
82132
|
-
export: exportValue
|
|
82133
|
-
};
|
|
82134
|
-
}
|
|
82135
|
-
function unwrapType(config, type, wrappers = [], convertRuntimeScalars) {
|
|
82136
|
-
if (type.kind === "NonNullType") {
|
|
82137
|
-
return unwrapType(config, type.type, [TypeWrapper.NonNull, ...wrappers]);
|
|
82138
|
-
}
|
|
82139
|
-
if (type instanceof graphql5.GraphQLNonNull) {
|
|
82140
|
-
return unwrapType(config, type.ofType, [TypeWrapper.NonNull, ...wrappers]);
|
|
82141
|
-
}
|
|
82142
|
-
if (wrappers[0] !== TypeWrapper.NonNull) {
|
|
82143
|
-
wrappers.unshift(TypeWrapper.Nullable);
|
|
82144
|
-
}
|
|
82145
|
-
if (type.kind === "ListType") {
|
|
82146
|
-
return unwrapType(config, type.type, [TypeWrapper.List, ...wrappers]);
|
|
82147
|
-
}
|
|
82148
|
-
if (type instanceof graphql5.GraphQLList) {
|
|
82149
|
-
return unwrapType(config, type.ofType, [TypeWrapper.List, ...wrappers]);
|
|
82150
|
-
}
|
|
82151
|
-
if (convertRuntimeScalars && config.configFile.features?.runtimeScalars?.[type.name.value]) {
|
|
82152
|
-
type = config.schema.getType(
|
|
82153
|
-
config.configFile.features?.runtimeScalars?.[type.name.value].type
|
|
82154
|
-
);
|
|
82155
|
-
}
|
|
82156
|
-
const namedType = config.schema.getType(type.name.value || type.name);
|
|
82157
|
-
if (!namedType) {
|
|
82158
|
-
throw new Error("Unknown type: " + type.name.value || type.name);
|
|
82159
|
-
}
|
|
82160
|
-
return { type: namedType, wrappers };
|
|
82161
|
-
}
|
|
82162
|
-
var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
|
|
82163
|
-
TypeWrapper2["Nullable"] = "Nullable";
|
|
82164
|
-
TypeWrapper2["List"] = "List";
|
|
82165
|
-
TypeWrapper2["NonNull"] = "NonNull";
|
|
82166
|
-
return TypeWrapper2;
|
|
82167
|
-
})(TypeWrapper || {});
|
|
82168
|
-
var import_parser = __toESM2(require_lib6(), 1);
|
|
82169
|
-
var import_recast = __toESM2(require_main2(), 1);
|
|
82170
|
-
var import_deepmerge = __toESM2(require_cjs(), 1);
|
|
82171
|
-
function deepMerge2(filepath, ...targets) {
|
|
82172
|
-
try {
|
|
82173
|
-
if (targets.length === 1) {
|
|
82174
|
-
return targets[0];
|
|
82175
|
-
} else if (targets.length === 2) {
|
|
82176
|
-
return (0, import_deepmerge.default)(targets[0], targets[1], {
|
|
82177
|
-
arrayMerge: (source, update) => [...new Set(source.concat(update))]
|
|
82178
|
-
});
|
|
82179
|
-
}
|
|
82180
|
-
return deepMerge2(filepath, targets[0], deepMerge2(filepath, ...targets.slice(1)));
|
|
82181
|
-
} catch (e2) {
|
|
82182
|
-
throw new HoudiniError({
|
|
82183
|
-
filepath,
|
|
82184
|
-
message: "could not merge: " + JSON.stringify(targets, null, 4),
|
|
82185
|
-
description: e2.message
|
|
82186
|
-
});
|
|
82187
|
-
}
|
|
82188
|
-
}
|
|
82189
|
-
function parseJS(str, config) {
|
|
82190
|
-
const defaultConfig = {
|
|
82191
|
-
plugins: [
|
|
82192
|
-
"typescript",
|
|
82193
|
-
"importAssertions",
|
|
82194
|
-
"decorators-legacy",
|
|
82195
|
-
"explicitResourceManagement"
|
|
82196
|
-
],
|
|
82197
|
-
sourceType: "module"
|
|
82198
|
-
};
|
|
82199
|
-
return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
|
|
82200
|
-
}
|
|
82201
|
-
async function printJS(script, options) {
|
|
82202
|
-
if (options?.pretty) {
|
|
82203
|
-
return (0, import_recast.prettyPrint)(script, options);
|
|
82204
|
-
} else {
|
|
82205
|
-
return (0, import_recast.print)(script, options);
|
|
82206
|
-
}
|
|
82207
|
-
}
|
|
82208
82285
|
var recast = __toESM2(require_main2(), 1);
|
|
82209
82286
|
var AST2 = recast.types.builders;
|
|
82210
82287
|
function ensureArtifactImport({
|
|
@@ -82262,83 +82339,6 @@ function ensureImports({
|
|
|
82262
82339
|
}
|
|
82263
82340
|
return Array.isArray(importID) ? toImport : toImport[0];
|
|
82264
82341
|
}
|
|
82265
|
-
var param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
|
|
82266
|
-
function parse_page_pattern(id) {
|
|
82267
|
-
const params = [];
|
|
82268
|
-
const pattern = id === "/" ? /^\/$/ : new RegExp(
|
|
82269
|
-
`^${get_route_segments(id).map((segment) => {
|
|
82270
|
-
const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
|
|
82271
|
-
if (rest_match) {
|
|
82272
|
-
params.push({
|
|
82273
|
-
name: rest_match[1],
|
|
82274
|
-
matcher: rest_match[2],
|
|
82275
|
-
optional: false,
|
|
82276
|
-
rest: true,
|
|
82277
|
-
chained: true
|
|
82278
|
-
});
|
|
82279
|
-
return "(?:/(.*))?";
|
|
82280
|
-
}
|
|
82281
|
-
const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment);
|
|
82282
|
-
if (optional_match) {
|
|
82283
|
-
params.push({
|
|
82284
|
-
name: optional_match[1],
|
|
82285
|
-
matcher: optional_match[2],
|
|
82286
|
-
optional: true,
|
|
82287
|
-
rest: false,
|
|
82288
|
-
chained: true
|
|
82289
|
-
});
|
|
82290
|
-
return "(?:/([^/]+))?";
|
|
82291
|
-
}
|
|
82292
|
-
if (!segment) {
|
|
82293
|
-
return;
|
|
82294
|
-
}
|
|
82295
|
-
const parts = segment.split(/\[(.+?)\](?!\])/);
|
|
82296
|
-
const result = parts.map((content, i2) => {
|
|
82297
|
-
if (i2 % 2) {
|
|
82298
|
-
if (content.startsWith("x+")) {
|
|
82299
|
-
return escape3(
|
|
82300
|
-
String.fromCharCode(parseInt(content.slice(2), 16))
|
|
82301
|
-
);
|
|
82302
|
-
}
|
|
82303
|
-
if (content.startsWith("u+")) {
|
|
82304
|
-
return escape3(
|
|
82305
|
-
String.fromCharCode(
|
|
82306
|
-
...content.slice(2).split("-").map((code) => parseInt(code, 16))
|
|
82307
|
-
)
|
|
82308
|
-
);
|
|
82309
|
-
}
|
|
82310
|
-
const match2 = param_pattern.exec(content);
|
|
82311
|
-
if (!match2) {
|
|
82312
|
-
throw new Error(
|
|
82313
|
-
`Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
|
|
82314
|
-
);
|
|
82315
|
-
}
|
|
82316
|
-
const [, is_optional, is_rest, name, matcher] = match2;
|
|
82317
|
-
params.push({
|
|
82318
|
-
name,
|
|
82319
|
-
matcher,
|
|
82320
|
-
optional: !!is_optional,
|
|
82321
|
-
rest: !!is_rest,
|
|
82322
|
-
chained: is_rest ? i2 === 1 && parts[0] === "" : false
|
|
82323
|
-
});
|
|
82324
|
-
return is_rest ? "(.*?)" : is_optional ? "([^/]*)?" : "([^/]+?)";
|
|
82325
|
-
}
|
|
82326
|
-
return escape3(content);
|
|
82327
|
-
}).join("");
|
|
82328
|
-
return "/" + result;
|
|
82329
|
-
}).join("")}/?$`
|
|
82330
|
-
);
|
|
82331
|
-
return { pattern, params, page_id: id };
|
|
82332
|
-
}
|
|
82333
|
-
function affects_path(segment) {
|
|
82334
|
-
return !/^\([^)]+\)$/.test(segment);
|
|
82335
|
-
}
|
|
82336
|
-
function get_route_segments(route) {
|
|
82337
|
-
return route.slice(1).split("/").filter(affects_path);
|
|
82338
|
-
}
|
|
82339
|
-
function escape3(str) {
|
|
82340
|
-
return str.normalize().replace(/[[\]]/g, "\\$&").replace(/%/g, "%25").replace(/\//g, "%2[Ff]").replace(/\?/g, "%3[Ff]").replace(/#/g, "%23").replace(/[.*+?^${}()|\\]/g, "\\$&");
|
|
82341
|
-
}
|
|
82342
82342
|
var recast2 = __toESM2(require_main2(), 1);
|
|
82343
82343
|
var AST3 = recast2.types.builders;
|
|
82344
82344
|
function unwrappedTsTypeReference(config, filepath, missingScalars, {
|
|
@@ -82390,18 +82390,18 @@ function scalarPropertyValue(config, filepath, missingScalars, target, body, fie
|
|
|
82390
82390
|
return AST3.tsNeverKeyword();
|
|
82391
82391
|
}
|
|
82392
82392
|
const component = config.componentFields[field.parent][field.field];
|
|
82393
|
-
const sourcePathRelative =
|
|
82394
|
-
|
|
82393
|
+
const sourcePathRelative = relative(
|
|
82394
|
+
join2(config.projectRoot, "src"),
|
|
82395
82395
|
component.filepath
|
|
82396
82396
|
);
|
|
82397
|
-
let sourcePathParsed =
|
|
82398
|
-
let sourcePath =
|
|
82397
|
+
let sourcePathParsed = parse32(sourcePathRelative);
|
|
82398
|
+
let sourcePath = join2(sourcePathParsed.dir, sourcePathParsed.name);
|
|
82399
82399
|
const localImport = ensureImports({
|
|
82400
82400
|
config,
|
|
82401
82401
|
body,
|
|
82402
82402
|
import: "__component__" + component.fragment,
|
|
82403
|
-
sourceModule:
|
|
82404
|
-
|
|
82403
|
+
sourceModule: join2(
|
|
82404
|
+
relative(dirname(filepath), config.projectRoot),
|
|
82405
82405
|
"src",
|
|
82406
82406
|
sourcePath
|
|
82407
82407
|
)
|
|
@@ -83512,6 +83512,12 @@ async function extractDocuments({
|
|
|
83512
83512
|
return documents;
|
|
83513
83513
|
}
|
|
83514
83514
|
|
|
83515
|
+
// src/plugin/state.ts
|
|
83516
|
+
var manifest;
|
|
83517
|
+
function setManifest(newManifest) {
|
|
83518
|
+
manifest = newManifest;
|
|
83519
|
+
}
|
|
83520
|
+
|
|
83515
83521
|
// src/plugin/transform.ts
|
|
83516
83522
|
var recast4 = __toESM(require_main4());
|
|
83517
83523
|
var AST4 = recast4.types.builders;
|
|
@@ -83945,13 +83951,12 @@ function getBody(request) {
|
|
|
83945
83951
|
}
|
|
83946
83952
|
|
|
83947
83953
|
// src/plugin/index.ts
|
|
83948
|
-
var manifest;
|
|
83949
83954
|
var hooks = async () => ({
|
|
83950
83955
|
order: "core",
|
|
83951
83956
|
extensions: [".jsx", ".tsx"],
|
|
83952
83957
|
async beforeGenerate({ config }) {
|
|
83953
83958
|
try {
|
|
83954
|
-
|
|
83959
|
+
setManifest(await load_manifest({ config }));
|
|
83955
83960
|
} catch (e2) {
|
|
83956
83961
|
console.log("something went wrong: " + e2.message);
|
|
83957
83962
|
return;
|
|
@@ -84157,14 +84162,9 @@ ${content.slice(0, definitionIndex) + documents.map(signature).join("\n") + "\n"
|
|
|
84157
84162
|
`;
|
|
84158
84163
|
}
|
|
84159
84164
|
var plugin_default = plugin("houdini-react", hooks);
|
|
84160
|
-
function setManifest(newManifest) {
|
|
84161
|
-
manifest = newManifest;
|
|
84162
|
-
}
|
|
84163
84165
|
export {
|
|
84164
84166
|
plugin_default as default,
|
|
84165
|
-
hooks
|
|
84166
|
-
manifest,
|
|
84167
|
-
setManifest
|
|
84167
|
+
hooks
|
|
84168
84168
|
};
|
|
84169
84169
|
/*!
|
|
84170
84170
|
* cookie
|