houdini-svelte 1.2.42 → 1.2.44

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.
@@ -2301,7 +2301,7 @@ var require_path_visitor2 = __commonJS({
2301
2301
  }
2302
2302
  return target;
2303
2303
  }
2304
- PathVisitor.visit = function visit21(node2, methods) {
2304
+ PathVisitor.visit = function visit22(node2, methods) {
2305
2305
  return PathVisitor.fromMethodsObject(methods).visit(node2);
2306
2306
  };
2307
2307
  var PVp = PathVisitor.prototype;
@@ -2492,7 +2492,7 @@ var require_path_visitor2 = __commonJS({
2492
2492
  this.needToCallTraverse = false;
2493
2493
  return visitChildren(path3, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
2494
2494
  };
2495
- sharedContextProtoMethods.visit = function visit21(path3, newVisitor) {
2495
+ sharedContextProtoMethods.visit = function visit22(path3, newVisitor) {
2496
2496
  if (!(this instanceof this.Context)) {
2497
2497
  throw new Error("");
2498
2498
  }
@@ -3885,7 +3885,7 @@ var require_main3 = __commonJS({
3885
3885
  var someField = _a.someField;
3886
3886
  var Type = _a.Type;
3887
3887
  var use = _a.use;
3888
- var visit21 = _a.visit;
3888
+ var visit22 = _a.visit;
3889
3889
  exports.astNodesAreEquivalent = astNodesAreEquivalent;
3890
3890
  exports.builders = builders;
3891
3891
  exports.builtInTypes = builtInTypes;
@@ -3902,7 +3902,7 @@ var require_main3 = __commonJS({
3902
3902
  exports.someField = someField;
3903
3903
  exports.Type = Type;
3904
3904
  exports.use = use;
3905
- exports.visit = visit21;
3905
+ exports.visit = visit22;
3906
3906
  Object.assign(namedTypes_1.namedTypes, n);
3907
3907
  }
3908
3908
  });
@@ -81180,8 +81180,22 @@ var query = documentPlugin(ArtifactKind.Query, function() {
81180
81180
  let lastVariables = null;
81181
81181
  return {
81182
81182
  start(ctx, { next }) {
81183
+ const runtimeScalarPayload = {
81184
+ session: ctx.session
81185
+ };
81183
81186
  ctx.variables = {
81184
81187
  ...lastVariables,
81188
+ ...Object.fromEntries(
81189
+ Object.entries(ctx.artifact.input?.runtimeScalars ?? {}).map(
81190
+ ([field, type]) => {
81191
+ const runtimeScalar = ctx.config.features?.runtimeScalars?.[type];
81192
+ if (!runtimeScalar) {
81193
+ return [field, type];
81194
+ }
81195
+ return [field, runtimeScalar.resolve(runtimeScalarPayload)];
81196
+ }
81197
+ )
81198
+ ),
81185
81199
  ...ctx.variables
81186
81200
  };
81187
81201
  next(ctx);
@@ -81753,6 +81767,9 @@ var Config = class {
81753
81767
  get loadingDirective() {
81754
81768
  return `loading`;
81755
81769
  }
81770
+ get runtimeScalarDirective() {
81771
+ return "__houdini__runtimeScalar";
81772
+ }
81756
81773
  get whenDirective() {
81757
81774
  return "when";
81758
81775
  }
@@ -81823,7 +81840,7 @@ var Config = class {
81823
81840
  const internalDirectives = this.#newSchemaInstance?.getDirectives().reduce((list, directive) => {
81824
81841
  return list.concat(directive.name);
81825
81842
  }, []) ?? [];
81826
- return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name));
81843
+ return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name) || name === this.runtimeScalarDirective);
81827
81844
  }
81828
81845
  get componentFieldDirective() {
81829
81846
  return "componentField";
@@ -82240,7 +82257,7 @@ function unwrapType(config2, type, wrappers = []) {
82240
82257
  }
82241
82258
  const namedType = config2.schema.getType(type.name.value || type.name);
82242
82259
  if (!namedType) {
82243
- throw new Error("Could not unwrap type: " + JSON.stringify(type));
82260
+ throw new Error("Unknown type: " + type.name.value || type.name);
82244
82261
  }
82245
82262
  return { type: namedType, wrappers };
82246
82263
  }
@@ -110273,6 +110290,9 @@ async function preprocess(source, preprocessor, options) {
110273
110290
 
110274
110291
  // src/plugin/extract.ts
110275
110292
  async function parseSvelte(str) {
110293
+ str = str.replace(/(<script[^>]*)(\s+)(generics="[^"]+?")/, (_, $1, $2, $3) => {
110294
+ return $1 + $2 + " ".repeat($3.length);
110295
+ });
110276
110296
  const preprocessed = await preprocess(str, [
110277
110297
  {
110278
110298
  script({ content: input }) {
@@ -110448,7 +110468,7 @@ var yellow3 = (str) => {
110448
110468
  // ../houdini/build/vite-esm/index.js
110449
110469
  import { createRequire as conflict_free2 } from "module";
110450
110470
  import { statSync as statSync2, createReadStream as createReadStream2, promises as fs22 } from "node:fs";
110451
- import * as graphql32 from "graphql";
110471
+ import * as graphql33 from "graphql";
110452
110472
  import { getNamedType as getNamedType32, isScalarType as isScalarType52 } from "graphql";
110453
110473
  import { parse as parse9 } from "graphql";
110454
110474
  import { GraphQLError as GraphQLError2 } from "graphql";
@@ -110493,7 +110513,7 @@ import { types as types22 } from "node:util";
110493
110513
  import http3 from "node:http";
110494
110514
  import { format as formatUrl2 } from "node:url";
110495
110515
  import { deprecate as deprecate22 } from "node:util";
110496
- import * as graphql33 from "graphql";
110516
+ import * as graphql32 from "graphql";
110497
110517
  import * as graphql42 from "graphql";
110498
110518
  import * as graphql52 from "graphql";
110499
110519
  import * as graphql16 from "graphql";
@@ -110542,6 +110562,7 @@ import * as graphql28 from "graphql";
110542
110562
  import * as graphql29 from "graphql";
110543
110563
  import * as graphql30 from "graphql";
110544
110564
  import * as graphql31 from "graphql";
110565
+ import * as graphql322 from "graphql";
110545
110566
  var require3 = conflict_free2(import.meta.url);
110546
110567
  var __create3 = Object.create;
110547
110568
  var __defProp3 = Object.defineProperty;
@@ -142244,7 +142265,7 @@ var require_path_visitor3 = __commonJS3({
142244
142265
  }
142245
142266
  return target;
142246
142267
  }
142247
- PathVisitor.visit = function visit192(node2, methods) {
142268
+ PathVisitor.visit = function visit202(node2, methods) {
142248
142269
  return PathVisitor.fromMethodsObject(methods).visit(node2);
142249
142270
  };
142250
142271
  var PVp = PathVisitor.prototype;
@@ -142435,7 +142456,7 @@ var require_path_visitor3 = __commonJS3({
142435
142456
  this.needToCallTraverse = false;
142436
142457
  return visitChildren(path3, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
142437
142458
  };
142438
- sharedContextProtoMethods.visit = function visit192(path3, newVisitor) {
142459
+ sharedContextProtoMethods.visit = function visit202(path3, newVisitor) {
142439
142460
  if (!(this instanceof this.Context)) {
142440
142461
  throw new Error("");
142441
142462
  }
@@ -143778,7 +143799,7 @@ var require_main5 = __commonJS3({
143778
143799
  var someField = _a.someField;
143779
143800
  var Type = _a.Type;
143780
143801
  var use = _a.use;
143781
- var visit192 = _a.visit;
143802
+ var visit202 = _a.visit;
143782
143803
  exports.astNodesAreEquivalent = astNodesAreEquivalent;
143783
143804
  exports.builders = builders;
143784
143805
  exports.builtInTypes = builtInTypes;
@@ -143795,7 +143816,7 @@ var require_main5 = __commonJS3({
143795
143816
  exports.someField = someField;
143796
143817
  exports.Type = Type;
143797
143818
  exports.use = use;
143798
- exports.visit = visit192;
143819
+ exports.visit = visit202;
143799
143820
  Object.assign(namedTypes_1.namedTypes, n);
143800
143821
  }
143801
143822
  });
@@ -174790,8 +174811,22 @@ var query2 = documentPlugin2(ArtifactKind2.Query, function() {
174790
174811
  let lastVariables = null;
174791
174812
  return {
174792
174813
  start(ctx, { next }) {
174814
+ const runtimeScalarPayload = {
174815
+ session: ctx.session
174816
+ };
174793
174817
  ctx.variables = {
174794
174818
  ...lastVariables,
174819
+ ...Object.fromEntries(
174820
+ Object.entries(ctx.artifact.input?.runtimeScalars ?? {}).map(
174821
+ ([field, type]) => {
174822
+ const runtimeScalar = ctx.config.features?.runtimeScalars?.[type];
174823
+ if (!runtimeScalar) {
174824
+ return [field, type];
174825
+ }
174826
+ return [field, runtimeScalar.resolve(runtimeScalarPayload)];
174827
+ }
174828
+ )
174829
+ ),
174795
174830
  ...ctx.variables
174796
174831
  };
174797
174832
  next(ctx);
@@ -176520,7 +176555,8 @@ function variable_function_for_query(page2, query3, has_local) {
176520
176555
  const has_args = {};
176521
176556
  for (const definition of query3.variableDefinitions ?? []) {
176522
176557
  const unwrapped = unwrapType(page2.config, definition.type);
176523
- if (unwrapped.wrappers[unwrapped.wrappers.length - 1] === TypeWrapper.NonNull && !definition.defaultValue && (!params[definition.variable.name.value] || params[definition.variable.name.value].optional)) {
176558
+ const runtime_scalar = page2.config.configFile.features?.runtimeScalars?.[unwrapped.type.name];
176559
+ if (unwrapped.wrappers[unwrapped.wrappers.length - 1] === TypeWrapper.NonNull && !definition.defaultValue && !runtime_scalar && (!params[definition.variable.name.value] || params[definition.variable.name.value].optional)) {
176524
176560
  missing_args.push(definition.variable.name);
176525
176561
  }
176526
176562
  if (params[definition.variable.name.value]) {
@@ -176540,8 +176576,8 @@ function variable_function_for_query(page2, query3, has_local) {
176540
176576
  AST17.variableDeclarator(
176541
176577
  AST17.identifier("result"),
176542
176578
  AST17.objectExpression(
176543
- Object.entries(has_args).map(
176544
- ([arg, type]) => AST17.objectProperty(
176579
+ Object.entries(has_args).map(([arg, type]) => {
176580
+ return AST17.objectProperty(
176545
176581
  AST17.identifier(arg),
176546
176582
  AST17.callExpression(AST17.identifier("parseScalar"), [
176547
176583
  AST17.identifier("config"),
@@ -176554,8 +176590,8 @@ function variable_function_for_query(page2, query3, has_local) {
176554
176590
  AST17.identifier(arg)
176555
176591
  )
176556
176592
  ])
176557
- )
176558
- )
176593
+ );
176594
+ })
176559
176595
  )
176560
176596
  )
176561
176597
  ])