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.
@@ -1,7 +1,5 @@
1
- import { type Plugin, type ProjectManifest } from 'houdini';
2
- export declare let manifest: ProjectManifest;
1
+ import { type Plugin } from 'houdini';
3
2
  export declare const hooks: Plugin;
4
3
  declare const _default: import("houdini").PluginInit;
5
4
  export default _default;
6
5
  export type HoudiniReactPluginConfig = {};
7
- export declare function setManifest(newManifest: ProjectManifest): void;
@@ -0,0 +1,3 @@
1
+ import type { ProjectManifest } from 'houdini';
2
+ export declare let manifest: ProjectManifest;
3
+ export declare function setManifest(newManifest: ProjectManifest): void;
@@ -16363,9 +16363,7 @@ var require_main4 = __commonJS({
16363
16363
  var plugin_exports = {};
16364
16364
  __export(plugin_exports, {
16365
16365
  default: () => plugin_default,
16366
- hooks: () => hooks,
16367
- manifest: () => manifest,
16368
- setManifest: () => setManifest
16366
+ hooks: () => hooks
16369
16367
  });
16370
16368
  module.exports = __toCommonJS(plugin_exports);
16371
16369
 
@@ -16402,7 +16400,7 @@ var import_graphql27 = require("graphql");
16402
16400
  var import_graphql28 = require("graphql");
16403
16401
  var import_graphql29 = require("graphql");
16404
16402
  var import_graphql30 = require("graphql");
16405
- var graphql4 = __toESM(require("graphql"), 1);
16403
+ var graphql5 = __toESM(require("graphql"), 1);
16406
16404
  var import_node_url = require("node:url");
16407
16405
  var import_node_url2 = require("node:url");
16408
16406
  var import_node_path = require("node:path");
@@ -16425,9 +16423,9 @@ var import_node_util3 = require("node:util");
16425
16423
  var import_node_http = __toESM(require("node:http"), 1);
16426
16424
  var import_node_url4 = require("node:url");
16427
16425
  var import_node_util4 = require("node:util");
16428
- var graphql2 = __toESM(require("graphql"), 1);
16429
16426
  var graphql3 = __toESM(require("graphql"), 1);
16430
- var graphql5 = __toESM(require("graphql"), 1);
16427
+ var graphql2 = __toESM(require("graphql"), 1);
16428
+ var graphql4 = __toESM(require("graphql"), 1);
16431
16429
  var graphql6 = __toESM(require("graphql"), 1);
16432
16430
  var graphql7 = __toESM(require("graphql"), 1);
16433
16431
  var import_meta = {};
@@ -79427,43 +79425,43 @@ __export2(conventions_exports, {
79427
79425
  vite_render_path: () => vite_render_path
79428
79426
  });
79429
79427
  function router_path(config) {
79430
- return path_exports.join(base_dir(config), "Router.jsx");
79428
+ return join2(base_dir(config), "Router.jsx");
79431
79429
  }
79432
79430
  function page_entry_path(config, id, base) {
79433
- return path_exports.join(page_entries_dir(config, base), `${id}.jsx`);
79431
+ return join2(page_entries_dir(config, base), `${id}.jsx`);
79434
79432
  }
79435
79433
  function server_adapter_path(config, base) {
79436
- return path_exports.join(units_dir(config, base), "render", "server.js");
79434
+ return join2(units_dir(config, base), "render", "server.js");
79437
79435
  }
79438
79436
  function adapter_config_path(config, base) {
79439
- return path_exports.join(units_dir(config, base), "render", "config.js");
79437
+ return join2(units_dir(config, base), "render", "config.js");
79440
79438
  }
79441
79439
  function vite_render_path(config, base) {
79442
- return path_exports.join(units_dir(config, base), "render", "vite.js");
79440
+ return join2(units_dir(config, base), "render", "vite.js");
79443
79441
  }
79444
79442
  function app_component_path(config, base) {
79445
- return path_exports.join(units_dir(config, base), "render", "App.jsx");
79443
+ return join2(units_dir(config, base), "render", "App.jsx");
79446
79444
  }
79447
79445
  function page_unit_path(config, id, base) {
79448
- return path_exports.join(page_units_dir(config, base), `${id}.jsx`);
79446
+ return join2(page_units_dir(config, base), `${id}.jsx`);
79449
79447
  }
79450
79448
  function layout_unit_path(config, id, base) {
79451
- return path_exports.join(layout_units_dir(config, base), `${id}.jsx`);
79449
+ return join2(layout_units_dir(config, base), `${id}.jsx`);
79452
79450
  }
79453
79451
  function componentField_unit_path(config, id, base) {
79454
- return path_exports.join(units_dir(config, base), "componentFields", `wrapper_${id}.jsx`);
79452
+ return join2(units_dir(config, base), "componentFields", `wrapper_${id}.jsx`);
79455
79453
  }
79456
79454
  function fallback_unit_path(config, which, id, base) {
79457
- return path_exports.join(fallbacks_units_dir(config, which, base), `${id}.jsx`);
79455
+ return join2(fallbacks_units_dir(config, which, base), `${id}.jsx`);
79458
79456
  }
79459
79457
  async function read_pageQuery(base) {
79460
- const target = path_exports.join(base, "+page.gql");
79461
- return [target, await fs_exports.readFile(target)];
79458
+ const target = join2(base, "+page.gql");
79459
+ return [target, await readFile(target)];
79462
79460
  }
79463
79461
  async function read_pageView(base) {
79464
79462
  for (const name of ["+page.tsx", "+page.jsx"]) {
79465
- let target = path_exports.join(base, name);
79466
- let result = await fs_exports.readFile(target);
79463
+ let target = join2(base, name);
79464
+ let result = await readFile(target);
79467
79465
  if (result) {
79468
79466
  return [target, result];
79469
79467
  }
@@ -79471,13 +79469,13 @@ async function read_pageView(base) {
79471
79469
  return [null, null];
79472
79470
  }
79473
79471
  async function read_layoutQuery(base) {
79474
- const target = path_exports.join(base, "+layout.gql");
79475
- return [target, await fs_exports.readFile(target)];
79472
+ const target = join2(base, "+layout.gql");
79473
+ return [target, await readFile(target)];
79476
79474
  }
79477
79475
  async function read_layoutView(base) {
79478
79476
  for (const name of ["+layout.tsx", "+layout.jsx"]) {
79479
- let target = path_exports.join(base, name);
79480
- let result = await fs_exports.readFile(target);
79477
+ let target = join2(base, name);
79478
+ let result = await readFile(target);
79481
79479
  if (result) {
79482
79480
  return [target, result];
79483
79481
  }
@@ -79485,10 +79483,10 @@ async function read_layoutView(base) {
79485
79483
  return [null, null];
79486
79484
  }
79487
79485
  function temp_dir(config, key) {
79488
- return path_exports.join(config.rootDir, "temp", key);
79486
+ return join2(config.rootDir, "temp", key);
79489
79487
  }
79490
79488
  function router_index_path(config) {
79491
- return path_exports.join(config.routesDir, "..", "+index.jsx");
79489
+ return join2(config.routesDir, "..", "+index.jsx");
79492
79490
  }
79493
79491
  function is_layout(path4) {
79494
79492
  return path4.endsWith("+layout.tsx") || path4.endsWith("+layout.jsx");
@@ -79511,27 +79509,210 @@ function page_id(path4) {
79511
79509
  return copy;
79512
79510
  }
79513
79511
  function page_entries_dir(config, base) {
79514
- return path_exports.join(units_dir(config, base), "entries");
79512
+ return join2(units_dir(config, base), "entries");
79515
79513
  }
79516
79514
  function page_units_dir(config, base) {
79517
- return path_exports.join(units_dir(config, base), "pages");
79515
+ return join2(units_dir(config, base), "pages");
79518
79516
  }
79519
79517
  function layout_units_dir(config, base) {
79520
- return path_exports.join(units_dir(config, base), "layouts");
79518
+ return join2(units_dir(config, base), "layouts");
79521
79519
  }
79522
79520
  function fallbacks_units_dir(config, which, base) {
79523
- return path_exports.join(units_dir(config, base), "fallbacks", which);
79521
+ return join2(units_dir(config, base), "fallbacks", which);
79524
79522
  }
79525
79523
  function units_dir(config, base = base_dir(config)) {
79526
- return path_exports.join(base, "units");
79524
+ return join2(base, "units");
79527
79525
  }
79528
79526
  function base_dir(config) {
79529
79527
  return config.pluginDirectory("houdini-react");
79530
79528
  }
79531
79529
  function serialized_manifest_path(config, base = base_dir(config)) {
79532
- return path_exports.join(base, "manifest.json");
79530
+ return join2(base, "manifest.json");
79533
79531
  }
79534
79532
  var t2 = __toESM2(require_lib5(), 1);
79533
+ var param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
79534
+ function parse_page_pattern(id) {
79535
+ const params = [];
79536
+ const pattern = id === "/" ? /^\/$/ : new RegExp(
79537
+ `^${get_route_segments(id).map((segment) => {
79538
+ const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
79539
+ if (rest_match) {
79540
+ params.push({
79541
+ name: rest_match[1],
79542
+ matcher: rest_match[2],
79543
+ optional: false,
79544
+ rest: true,
79545
+ chained: true
79546
+ });
79547
+ return "(?:/(.*))?";
79548
+ }
79549
+ const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment);
79550
+ if (optional_match) {
79551
+ params.push({
79552
+ name: optional_match[1],
79553
+ matcher: optional_match[2],
79554
+ optional: true,
79555
+ rest: false,
79556
+ chained: true
79557
+ });
79558
+ return "(?:/([^/]+))?";
79559
+ }
79560
+ if (!segment) {
79561
+ return;
79562
+ }
79563
+ const parts = segment.split(/\[(.+?)\](?!\])/);
79564
+ const result = parts.map((content, i2) => {
79565
+ if (i2 % 2) {
79566
+ if (content.startsWith("x+")) {
79567
+ return escape3(
79568
+ String.fromCharCode(parseInt(content.slice(2), 16))
79569
+ );
79570
+ }
79571
+ if (content.startsWith("u+")) {
79572
+ return escape3(
79573
+ String.fromCharCode(
79574
+ ...content.slice(2).split("-").map((code) => parseInt(code, 16))
79575
+ )
79576
+ );
79577
+ }
79578
+ const match2 = param_pattern.exec(content);
79579
+ if (!match2) {
79580
+ throw new Error(
79581
+ `Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
79582
+ );
79583
+ }
79584
+ const [, is_optional, is_rest, name, matcher] = match2;
79585
+ params.push({
79586
+ name,
79587
+ matcher,
79588
+ optional: !!is_optional,
79589
+ rest: !!is_rest,
79590
+ chained: is_rest ? i2 === 1 && parts[0] === "" : false
79591
+ });
79592
+ return is_rest ? "(.*?)" : is_optional ? "([^/]*)?" : "([^/]+?)";
79593
+ }
79594
+ return escape3(content);
79595
+ }).join("");
79596
+ return "/" + result;
79597
+ }).join("")}/?$`
79598
+ );
79599
+ return { pattern, params, page_id: id };
79600
+ }
79601
+ function affects_path(segment) {
79602
+ return !/^\([^)]+\)$/.test(segment);
79603
+ }
79604
+ function get_route_segments(route) {
79605
+ return route.slice(1).split("/").filter(affects_path);
79606
+ }
79607
+ function escape3(str) {
79608
+ return str.normalize().replace(/[[\]]/g, "\\$&").replace(/%/g, "%25").replace(/\//g, "%2[Ff]").replace(/\?/g, "%3[Ff]").replace(/#/g, "%23").replace(/[.*+?^${}()|\\]/g, "\\$&");
79609
+ }
79610
+ function processComponentFieldDirective(directive) {
79611
+ let field;
79612
+ let exportValue;
79613
+ let prop;
79614
+ let raw;
79615
+ for (const arg of directive.arguments ?? []) {
79616
+ if (arg.name.value === "field" && arg.value.kind === "StringValue") {
79617
+ field = arg.value.value;
79618
+ } else if (arg.name.value === "export" && arg.value.kind === "StringValue") {
79619
+ exportValue = arg.value.value;
79620
+ } else if (arg.name.value === "prop" && arg.value.kind === "StringValue") {
79621
+ prop = arg.value.value;
79622
+ } else if (arg.name.value === "raw" && arg.value.kind === "StringValue") {
79623
+ raw = arg.value.value;
79624
+ }
79625
+ }
79626
+ const missing = [];
79627
+ if (!field) {
79628
+ missing.push("field");
79629
+ }
79630
+ if (!prop) {
79631
+ missing.push("prop");
79632
+ }
79633
+ if (missing.length > 0) {
79634
+ throw new Error(`missing arguments to @componentField: ${missing.join(", ")}`);
79635
+ }
79636
+ return {
79637
+ prop,
79638
+ field,
79639
+ raw,
79640
+ export: exportValue
79641
+ };
79642
+ }
79643
+ function unwrapType(config, type, wrappers = [], convertRuntimeScalars) {
79644
+ if (type.kind === "NonNullType") {
79645
+ return unwrapType(config, type.type, [TypeWrapper.NonNull, ...wrappers]);
79646
+ }
79647
+ if (type instanceof graphql2.GraphQLNonNull) {
79648
+ return unwrapType(config, type.ofType, [TypeWrapper.NonNull, ...wrappers]);
79649
+ }
79650
+ if (wrappers[0] !== TypeWrapper.NonNull) {
79651
+ wrappers.unshift(TypeWrapper.Nullable);
79652
+ }
79653
+ if (type.kind === "ListType") {
79654
+ return unwrapType(config, type.type, [TypeWrapper.List, ...wrappers]);
79655
+ }
79656
+ if (type instanceof graphql2.GraphQLList) {
79657
+ return unwrapType(config, type.ofType, [TypeWrapper.List, ...wrappers]);
79658
+ }
79659
+ if (convertRuntimeScalars && config.configFile.features?.runtimeScalars?.[type.name.value]) {
79660
+ type = config.schema.getType(
79661
+ config.configFile.features?.runtimeScalars?.[type.name.value].type
79662
+ );
79663
+ }
79664
+ const namedType = config.schema.getType(type.name.value || type.name);
79665
+ if (!namedType) {
79666
+ throw new Error("Unknown type: " + type.name.value || type.name);
79667
+ }
79668
+ return { type: namedType, wrappers };
79669
+ }
79670
+ var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
79671
+ TypeWrapper2["Nullable"] = "Nullable";
79672
+ TypeWrapper2["List"] = "List";
79673
+ TypeWrapper2["NonNull"] = "NonNull";
79674
+ return TypeWrapper2;
79675
+ })(TypeWrapper || {});
79676
+ var import_parser = __toESM2(require_lib6(), 1);
79677
+ var import_recast = __toESM2(require_main2(), 1);
79678
+ var import_deepmerge = __toESM2(require_cjs(), 1);
79679
+ function deepMerge2(filepath, ...targets) {
79680
+ try {
79681
+ if (targets.length === 1) {
79682
+ return targets[0];
79683
+ } else if (targets.length === 2) {
79684
+ return (0, import_deepmerge.default)(targets[0], targets[1], {
79685
+ arrayMerge: (source, update) => [...new Set(source.concat(update))]
79686
+ });
79687
+ }
79688
+ return deepMerge2(filepath, targets[0], deepMerge2(filepath, ...targets.slice(1)));
79689
+ } catch (e2) {
79690
+ throw new HoudiniError({
79691
+ filepath,
79692
+ message: "could not merge: " + JSON.stringify(targets, null, 4),
79693
+ description: e2.message
79694
+ });
79695
+ }
79696
+ }
79697
+ function parseJS(str, config) {
79698
+ const defaultConfig = {
79699
+ plugins: [
79700
+ "typescript",
79701
+ "importAssertions",
79702
+ "decorators-legacy",
79703
+ "explicitResourceManagement"
79704
+ ],
79705
+ sourceType: "module"
79706
+ };
79707
+ return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
79708
+ }
79709
+ async function printJS(script, options) {
79710
+ if (options?.pretty) {
79711
+ return (0, import_recast.prettyPrint)(script, options);
79712
+ } else {
79713
+ return (0, import_recast.print)(script, options);
79714
+ }
79715
+ }
79535
79716
  async function load_manifest(args) {
79536
79717
  const manifest2 = await walk_routes({
79537
79718
  config: args.config,
@@ -79553,7 +79734,7 @@ async function load_manifest(args) {
79553
79734
  });
79554
79735
  if (args.includeArtifacts) {
79555
79736
  try {
79556
- for (const artifactPath of await fs_exports.readdir(args.config.artifactDirectory)) {
79737
+ for (const artifactPath of await readdir2(args.config.artifactDirectory)) {
79557
79738
  if (!artifactPath.endsWith(".js") || artifactPath === "index.js") {
79558
79739
  continue;
79559
79740
  }
@@ -79563,9 +79744,9 @@ async function load_manifest(args) {
79563
79744
  }
79564
79745
  }
79565
79746
  try {
79566
- await fs_exports.stat(args.config.localApiDir);
79567
- for (const child of await fs_exports.readdir(args.config.localApiDir, { withFileTypes: true })) {
79568
- const name = child.isDirectory() ? child.name : path_exports.parse(child.name).name;
79747
+ await stat(args.config.localApiDir);
79748
+ for (const child of await readdir2(args.config.localApiDir, { withFileTypes: true })) {
79749
+ const name = child.isDirectory() ? child.name : parse32(child.name).name;
79569
79750
  if (name === "+schema") {
79570
79751
  manifest2.local_schema = true;
79571
79752
  } else if (name === "+yoga") {
@@ -79577,7 +79758,7 @@ async function load_manifest(args) {
79577
79758
  return manifest2;
79578
79759
  }
79579
79760
  async function walk_routes(args) {
79580
- const directory_contents = await fs_exports.readdir(args.filepath, {
79761
+ const directory_contents = await readdir2(args.filepath, {
79581
79762
  withFileTypes: true
79582
79763
  });
79583
79764
  const variables = { ...args.variables };
@@ -79654,7 +79835,7 @@ async function walk_routes(args) {
79654
79835
  }
79655
79836
  return walk_routes({
79656
79837
  ...args,
79657
- filepath: path_exports.join(args.filepath, dir.name),
79838
+ filepath: join2(args.filepath, dir.name),
79658
79839
  url: `${args.url}${dir.name}/`,
79659
79840
  queries: newLayoutQueries,
79660
79841
  layouts: newLayouts,
@@ -79679,7 +79860,7 @@ async function add_view(args) {
79679
79860
  queries,
79680
79861
  url: args.url,
79681
79862
  layouts: args.layouts,
79682
- path: path_exports.relative(args.config.projectRoot, args.path),
79863
+ path: relative(args.config.projectRoot, args.path),
79683
79864
  query_options: args.queries,
79684
79865
  params: Object.fromEntries(
79685
79866
  parse_page_pattern(args.url).params.map((param) => [
@@ -79691,7 +79872,7 @@ async function add_view(args) {
79691
79872
  return target[id];
79692
79873
  }
79693
79874
  async function add_query(args) {
79694
- const parsed = graphql2.parse(args.contents);
79875
+ const parsed = graphql3.parse(args.contents);
79695
79876
  const query2 = parsed.definitions.find(
79696
79877
  (def) => def.kind === "OperationDefinition" && def.operation === "query"
79697
79878
  );
@@ -79699,7 +79880,7 @@ async function add_query(args) {
79699
79880
  throw new Error("No query found");
79700
79881
  }
79701
79882
  let loading = false;
79702
- await graphql2.visit(parsed, {
79883
+ await graphql3.visit(parsed, {
79703
79884
  Directive(node) {
79704
79885
  if (node.name.value === args.config.loadingDirective) {
79705
79886
  loading = true;
@@ -79718,7 +79899,7 @@ async function add_query(args) {
79718
79899
  Object.assign(args.variables, queryVariables);
79719
79900
  const target = args.type === "page" ? args.project.page_queries : args.project.layout_queries;
79720
79901
  target[page_id(args.url)] = {
79721
- path: path_exports.relative(args.config.routesDir, args.path),
79902
+ path: relative(args.config.routesDir, args.path),
79722
79903
  name: query2.name.value,
79723
79904
  url: args.url,
79724
79905
  loading,
@@ -82107,114 +82288,8 @@ function isSecondaryBuild() {
82107
82288
  }
82108
82289
  var currentDir = dirname((0, import_node_url.fileURLToPath)(import_meta.url));
82109
82290
  var DEFAULT_CONFIG_PATH = join2(process.cwd(), "houdini.config.js");
82110
- var emptySchema = graphql4.buildSchema("type Query { hello: String }");
82291
+ var emptySchema = graphql5.buildSchema("type Query { hello: String }");
82111
82292
  var defaultDirectives = emptySchema.getDirectives().map((dir) => dir.name);
82112
- function processComponentFieldDirective(directive) {
82113
- let field;
82114
- let exportValue;
82115
- let prop;
82116
- let raw;
82117
- for (const arg of directive.arguments ?? []) {
82118
- if (arg.name.value === "field" && arg.value.kind === "StringValue") {
82119
- field = arg.value.value;
82120
- } else if (arg.name.value === "export" && arg.value.kind === "StringValue") {
82121
- exportValue = arg.value.value;
82122
- } else if (arg.name.value === "prop" && arg.value.kind === "StringValue") {
82123
- prop = arg.value.value;
82124
- } else if (arg.name.value === "raw" && arg.value.kind === "StringValue") {
82125
- raw = arg.value.value;
82126
- }
82127
- }
82128
- const missing = [];
82129
- if (!field) {
82130
- missing.push("field");
82131
- }
82132
- if (!prop) {
82133
- missing.push("prop");
82134
- }
82135
- if (missing.length > 0) {
82136
- throw new Error(`missing arguments to @componentField: ${missing.join(", ")}`);
82137
- }
82138
- return {
82139
- prop,
82140
- field,
82141
- raw,
82142
- export: exportValue
82143
- };
82144
- }
82145
- function unwrapType(config, type, wrappers = [], convertRuntimeScalars) {
82146
- if (type.kind === "NonNullType") {
82147
- return unwrapType(config, type.type, [TypeWrapper.NonNull, ...wrappers]);
82148
- }
82149
- if (type instanceof graphql5.GraphQLNonNull) {
82150
- return unwrapType(config, type.ofType, [TypeWrapper.NonNull, ...wrappers]);
82151
- }
82152
- if (wrappers[0] !== TypeWrapper.NonNull) {
82153
- wrappers.unshift(TypeWrapper.Nullable);
82154
- }
82155
- if (type.kind === "ListType") {
82156
- return unwrapType(config, type.type, [TypeWrapper.List, ...wrappers]);
82157
- }
82158
- if (type instanceof graphql5.GraphQLList) {
82159
- return unwrapType(config, type.ofType, [TypeWrapper.List, ...wrappers]);
82160
- }
82161
- if (convertRuntimeScalars && config.configFile.features?.runtimeScalars?.[type.name.value]) {
82162
- type = config.schema.getType(
82163
- config.configFile.features?.runtimeScalars?.[type.name.value].type
82164
- );
82165
- }
82166
- const namedType = config.schema.getType(type.name.value || type.name);
82167
- if (!namedType) {
82168
- throw new Error("Unknown type: " + type.name.value || type.name);
82169
- }
82170
- return { type: namedType, wrappers };
82171
- }
82172
- var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
82173
- TypeWrapper2["Nullable"] = "Nullable";
82174
- TypeWrapper2["List"] = "List";
82175
- TypeWrapper2["NonNull"] = "NonNull";
82176
- return TypeWrapper2;
82177
- })(TypeWrapper || {});
82178
- var import_parser = __toESM2(require_lib6(), 1);
82179
- var import_recast = __toESM2(require_main2(), 1);
82180
- var import_deepmerge = __toESM2(require_cjs(), 1);
82181
- function deepMerge2(filepath, ...targets) {
82182
- try {
82183
- if (targets.length === 1) {
82184
- return targets[0];
82185
- } else if (targets.length === 2) {
82186
- return (0, import_deepmerge.default)(targets[0], targets[1], {
82187
- arrayMerge: (source, update) => [...new Set(source.concat(update))]
82188
- });
82189
- }
82190
- return deepMerge2(filepath, targets[0], deepMerge2(filepath, ...targets.slice(1)));
82191
- } catch (e2) {
82192
- throw new HoudiniError({
82193
- filepath,
82194
- message: "could not merge: " + JSON.stringify(targets, null, 4),
82195
- description: e2.message
82196
- });
82197
- }
82198
- }
82199
- function parseJS(str, config) {
82200
- const defaultConfig = {
82201
- plugins: [
82202
- "typescript",
82203
- "importAssertions",
82204
- "decorators-legacy",
82205
- "explicitResourceManagement"
82206
- ],
82207
- sourceType: "module"
82208
- };
82209
- return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
82210
- }
82211
- async function printJS(script, options) {
82212
- if (options?.pretty) {
82213
- return (0, import_recast.prettyPrint)(script, options);
82214
- } else {
82215
- return (0, import_recast.print)(script, options);
82216
- }
82217
- }
82218
82293
  var recast = __toESM2(require_main2(), 1);
82219
82294
  var AST2 = recast.types.builders;
82220
82295
  function ensureArtifactImport({
@@ -82272,83 +82347,6 @@ function ensureImports({
82272
82347
  }
82273
82348
  return Array.isArray(importID) ? toImport : toImport[0];
82274
82349
  }
82275
- var param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
82276
- function parse_page_pattern(id) {
82277
- const params = [];
82278
- const pattern = id === "/" ? /^\/$/ : new RegExp(
82279
- `^${get_route_segments(id).map((segment) => {
82280
- const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
82281
- if (rest_match) {
82282
- params.push({
82283
- name: rest_match[1],
82284
- matcher: rest_match[2],
82285
- optional: false,
82286
- rest: true,
82287
- chained: true
82288
- });
82289
- return "(?:/(.*))?";
82290
- }
82291
- const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment);
82292
- if (optional_match) {
82293
- params.push({
82294
- name: optional_match[1],
82295
- matcher: optional_match[2],
82296
- optional: true,
82297
- rest: false,
82298
- chained: true
82299
- });
82300
- return "(?:/([^/]+))?";
82301
- }
82302
- if (!segment) {
82303
- return;
82304
- }
82305
- const parts = segment.split(/\[(.+?)\](?!\])/);
82306
- const result = parts.map((content, i2) => {
82307
- if (i2 % 2) {
82308
- if (content.startsWith("x+")) {
82309
- return escape3(
82310
- String.fromCharCode(parseInt(content.slice(2), 16))
82311
- );
82312
- }
82313
- if (content.startsWith("u+")) {
82314
- return escape3(
82315
- String.fromCharCode(
82316
- ...content.slice(2).split("-").map((code) => parseInt(code, 16))
82317
- )
82318
- );
82319
- }
82320
- const match2 = param_pattern.exec(content);
82321
- if (!match2) {
82322
- throw new Error(
82323
- `Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
82324
- );
82325
- }
82326
- const [, is_optional, is_rest, name, matcher] = match2;
82327
- params.push({
82328
- name,
82329
- matcher,
82330
- optional: !!is_optional,
82331
- rest: !!is_rest,
82332
- chained: is_rest ? i2 === 1 && parts[0] === "" : false
82333
- });
82334
- return is_rest ? "(.*?)" : is_optional ? "([^/]*)?" : "([^/]+?)";
82335
- }
82336
- return escape3(content);
82337
- }).join("");
82338
- return "/" + result;
82339
- }).join("")}/?$`
82340
- );
82341
- return { pattern, params, page_id: id };
82342
- }
82343
- function affects_path(segment) {
82344
- return !/^\([^)]+\)$/.test(segment);
82345
- }
82346
- function get_route_segments(route) {
82347
- return route.slice(1).split("/").filter(affects_path);
82348
- }
82349
- function escape3(str) {
82350
- return str.normalize().replace(/[[\]]/g, "\\$&").replace(/%/g, "%25").replace(/\//g, "%2[Ff]").replace(/\?/g, "%3[Ff]").replace(/#/g, "%23").replace(/[.*+?^${}()|\\]/g, "\\$&");
82351
- }
82352
82350
  var recast2 = __toESM2(require_main2(), 1);
82353
82351
  var AST3 = recast2.types.builders;
82354
82352
  function unwrappedTsTypeReference(config, filepath, missingScalars, {
@@ -82400,18 +82398,18 @@ function scalarPropertyValue(config, filepath, missingScalars, target, body, fie
82400
82398
  return AST3.tsNeverKeyword();
82401
82399
  }
82402
82400
  const component = config.componentFields[field.parent][field.field];
82403
- const sourcePathRelative = path_exports.relative(
82404
- path_exports.join(config.projectRoot, "src"),
82401
+ const sourcePathRelative = relative(
82402
+ join2(config.projectRoot, "src"),
82405
82403
  component.filepath
82406
82404
  );
82407
- let sourcePathParsed = path_exports.parse(sourcePathRelative);
82408
- let sourcePath = path_exports.join(sourcePathParsed.dir, sourcePathParsed.name);
82405
+ let sourcePathParsed = parse32(sourcePathRelative);
82406
+ let sourcePath = join2(sourcePathParsed.dir, sourcePathParsed.name);
82409
82407
  const localImport = ensureImports({
82410
82408
  config,
82411
82409
  body,
82412
82410
  import: "__component__" + component.fragment,
82413
- sourceModule: path_exports.join(
82414
- path_exports.relative(path_exports.dirname(filepath), config.projectRoot),
82411
+ sourceModule: join2(
82412
+ relative(dirname(filepath), config.projectRoot),
82415
82413
  "src",
82416
82414
  sourcePath
82417
82415
  )
@@ -83522,6 +83520,12 @@ async function extractDocuments({
83522
83520
  return documents;
83523
83521
  }
83524
83522
 
83523
+ // src/plugin/state.ts
83524
+ var manifest;
83525
+ function setManifest(newManifest) {
83526
+ manifest = newManifest;
83527
+ }
83528
+
83525
83529
  // src/plugin/transform.ts
83526
83530
  var recast4 = __toESM(require_main4());
83527
83531
  var AST4 = recast4.types.builders;
@@ -83955,13 +83959,12 @@ function getBody(request) {
83955
83959
  }
83956
83960
 
83957
83961
  // src/plugin/index.ts
83958
- var manifest;
83959
83962
  var hooks = async () => ({
83960
83963
  order: "core",
83961
83964
  extensions: [".jsx", ".tsx"],
83962
83965
  async beforeGenerate({ config }) {
83963
83966
  try {
83964
- manifest = await load_manifest({ config });
83967
+ setManifest(await load_manifest({ config }));
83965
83968
  } catch (e2) {
83966
83969
  console.log("something went wrong: " + e2.message);
83967
83970
  return;
@@ -84167,14 +84170,9 @@ ${content.slice(0, definitionIndex) + documents.map(signature).join("\n") + "\n"
84167
84170
  `;
84168
84171
  }
84169
84172
  var plugin_default = plugin("houdini-react", hooks);
84170
- function setManifest(newManifest) {
84171
- manifest = newManifest;
84172
- }
84173
84173
  // Annotate the CommonJS export names for ESM import in node:
84174
84174
  0 && (module.exports = {
84175
- hooks,
84176
- manifest,
84177
- setManifest
84175
+ hooks
84178
84176
  });
84179
84177
  /*!
84180
84178
  * cookie