houdini 1.1.3 → 1.1.4-react.0

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.
Files changed (41) hide show
  1. package/build/cmd-cjs/index.js +230 -158
  2. package/build/cmd-esm/index.js +230 -158
  3. package/build/codegen-cjs/index.js +217 -156
  4. package/build/codegen-esm/index.js +217 -156
  5. package/build/lib/config.d.ts +1 -0
  6. package/build/lib/parse.d.ts +2 -1
  7. package/build/lib/types.d.ts +4 -1
  8. package/build/lib-cjs/index.js +178 -146
  9. package/build/lib-esm/index.js +178 -146
  10. package/build/runtime/client/documentStore.d.ts +3 -0
  11. package/build/runtime/client/index.d.ts +1 -1
  12. package/build/runtime/lib/pageInfo.d.ts +7 -0
  13. package/build/runtime/lib/pagination.d.ts +29 -0
  14. package/build/runtime/lib/types.d.ts +46 -0
  15. package/build/runtime-cjs/client/documentStore.d.ts +3 -0
  16. package/build/runtime-cjs/client/documentStore.js +11 -6
  17. package/build/runtime-cjs/client/index.d.ts +1 -1
  18. package/build/runtime-cjs/client/plugins/cache.js +6 -3
  19. package/build/runtime-cjs/client/plugins/fragment.js +8 -1
  20. package/build/runtime-cjs/client/plugins/query.js +2 -1
  21. package/build/runtime-cjs/lib/pageInfo.d.ts +7 -0
  22. package/build/runtime-cjs/lib/pageInfo.js +79 -0
  23. package/build/runtime-cjs/lib/pagination.d.ts +29 -0
  24. package/build/runtime-cjs/lib/pagination.js +231 -0
  25. package/build/runtime-cjs/lib/types.d.ts +46 -0
  26. package/build/runtime-esm/client/documentStore.d.ts +3 -0
  27. package/build/runtime-esm/client/documentStore.js +11 -6
  28. package/build/runtime-esm/client/index.d.ts +1 -1
  29. package/build/runtime-esm/client/plugins/cache.js +6 -3
  30. package/build/runtime-esm/client/plugins/fragment.js +8 -1
  31. package/build/runtime-esm/client/plugins/query.js +2 -1
  32. package/build/runtime-esm/lib/pageInfo.d.ts +7 -0
  33. package/build/runtime-esm/lib/pageInfo.js +52 -0
  34. package/build/runtime-esm/lib/pagination.d.ts +29 -0
  35. package/build/runtime-esm/lib/pagination.js +206 -0
  36. package/build/runtime-esm/lib/types.d.ts +46 -0
  37. package/build/test-cjs/index.js +224 -155
  38. package/build/test-esm/index.js +224 -155
  39. package/build/vite-cjs/index.js +228 -156
  40. package/build/vite-esm/index.js +228 -156
  41. package/package.json +1 -1
@@ -2398,7 +2398,7 @@ var require_visitor = __commonJS({
2398
2398
  Object.defineProperty(exports, "__esModule", {
2399
2399
  value: true
2400
2400
  });
2401
- exports.visit = visit12;
2401
+ exports.visit = visit13;
2402
2402
  exports.visitInParallel = visitInParallel;
2403
2403
  exports.getVisitFn = getVisitFn;
2404
2404
  exports.BREAK = exports.QueryDocumentKeys = void 0;
@@ -2461,7 +2461,7 @@ var require_visitor = __commonJS({
2461
2461
  exports.QueryDocumentKeys = QueryDocumentKeys;
2462
2462
  var BREAK = Object.freeze({});
2463
2463
  exports.BREAK = BREAK;
2464
- function visit12(root, visitor) {
2464
+ function visit13(root, visitor) {
2465
2465
  var visitorKeys = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : QueryDocumentKeys;
2466
2466
  var stack = void 0;
2467
2467
  var inArray = Array.isArray(root);
@@ -37667,6 +37667,109 @@ var require_lib3 = __commonJS({
37667
37667
  }
37668
37668
  });
37669
37669
 
37670
+ // ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
37671
+ var require_cjs = __commonJS({
37672
+ "../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module2) {
37673
+ "use strict";
37674
+ var isMergeableObject = function isMergeableObject2(value) {
37675
+ return isNonNullObject(value) && !isSpecial(value);
37676
+ };
37677
+ function isNonNullObject(value) {
37678
+ return !!value && typeof value === "object";
37679
+ }
37680
+ function isSpecial(value) {
37681
+ var stringValue = Object.prototype.toString.call(value);
37682
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
37683
+ }
37684
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
37685
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
37686
+ function isReactElement(value) {
37687
+ return value.$$typeof === REACT_ELEMENT_TYPE;
37688
+ }
37689
+ function emptyTarget(val) {
37690
+ return Array.isArray(val) ? [] : {};
37691
+ }
37692
+ function cloneUnlessOtherwiseSpecified(value, options) {
37693
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
37694
+ }
37695
+ function defaultArrayMerge(target, source, options) {
37696
+ return target.concat(source).map(function(element) {
37697
+ return cloneUnlessOtherwiseSpecified(element, options);
37698
+ });
37699
+ }
37700
+ function getMergeFunction(key, options) {
37701
+ if (!options.customMerge) {
37702
+ return deepmerge;
37703
+ }
37704
+ var customMerge = options.customMerge(key);
37705
+ return typeof customMerge === "function" ? customMerge : deepmerge;
37706
+ }
37707
+ function getEnumerableOwnPropertySymbols(target) {
37708
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
37709
+ return target.propertyIsEnumerable(symbol);
37710
+ }) : [];
37711
+ }
37712
+ function getKeys(target) {
37713
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
37714
+ }
37715
+ function propertyIsOnObject(object, property) {
37716
+ try {
37717
+ return property in object;
37718
+ } catch (_) {
37719
+ return false;
37720
+ }
37721
+ }
37722
+ function propertyIsUnsafe(target, key) {
37723
+ return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
37724
+ }
37725
+ function mergeObject(target, source, options) {
37726
+ var destination = {};
37727
+ if (options.isMergeableObject(target)) {
37728
+ getKeys(target).forEach(function(key) {
37729
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
37730
+ });
37731
+ }
37732
+ getKeys(source).forEach(function(key) {
37733
+ if (propertyIsUnsafe(target, key)) {
37734
+ return;
37735
+ }
37736
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
37737
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
37738
+ } else {
37739
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
37740
+ }
37741
+ });
37742
+ return destination;
37743
+ }
37744
+ function deepmerge(target, source, options) {
37745
+ options = options || {};
37746
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
37747
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
37748
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
37749
+ var sourceIsArray = Array.isArray(source);
37750
+ var targetIsArray = Array.isArray(target);
37751
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
37752
+ if (!sourceAndTargetTypesMatch) {
37753
+ return cloneUnlessOtherwiseSpecified(source, options);
37754
+ } else if (sourceIsArray) {
37755
+ return options.arrayMerge(target, source, options);
37756
+ } else {
37757
+ return mergeObject(target, source, options);
37758
+ }
37759
+ }
37760
+ deepmerge.all = function deepmergeAll(array, options) {
37761
+ if (!Array.isArray(array)) {
37762
+ throw new Error("first argument should be an array");
37763
+ }
37764
+ return array.reduce(function(prev, next) {
37765
+ return deepmerge(prev, next, options);
37766
+ }, {});
37767
+ };
37768
+ var deepmerge_1 = deepmerge;
37769
+ module2.exports = deepmerge_1;
37770
+ }
37771
+ });
37772
+
37670
37773
  // ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js
37671
37774
  var require_tslib = __commonJS({
37672
37775
  "../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js"(exports, module2) {
@@ -39936,7 +40039,7 @@ var require_path_visitor = __commonJS({
39936
40039
  }
39937
40040
  return target;
39938
40041
  }
39939
- PathVisitor.visit = function visit12(node, methods) {
40042
+ PathVisitor.visit = function visit13(node, methods) {
39940
40043
  return PathVisitor.fromMethodsObject(methods).visit(node);
39941
40044
  };
39942
40045
  var PVp = PathVisitor.prototype;
@@ -40127,7 +40230,7 @@ var require_path_visitor = __commonJS({
40127
40230
  this.needToCallTraverse = false;
40128
40231
  return visitChildren(path2, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
40129
40232
  };
40130
- sharedContextProtoMethods.visit = function visit12(path2, newVisitor) {
40233
+ sharedContextProtoMethods.visit = function visit13(path2, newVisitor) {
40131
40234
  if (!(this instanceof this.Context)) {
40132
40235
  throw new Error("");
40133
40236
  }
@@ -41520,7 +41623,7 @@ var require_main = __commonJS({
41520
41623
  var someField = _a.someField;
41521
41624
  var Type = _a.Type;
41522
41625
  var use = _a.use;
41523
- var visit12 = _a.visit;
41626
+ var visit13 = _a.visit;
41524
41627
  exports.astNodesAreEquivalent = astNodesAreEquivalent;
41525
41628
  exports.builders = builders;
41526
41629
  exports.builtInTypes = builtInTypes;
@@ -41537,7 +41640,7 @@ var require_main = __commonJS({
41537
41640
  exports.someField = someField;
41538
41641
  exports.Type = Type;
41539
41642
  exports.use = use;
41540
- exports.visit = visit12;
41643
+ exports.visit = visit13;
41541
41644
  Object.assign(namedTypes_1.namedTypes, n);
41542
41645
  }
41543
41646
  });
@@ -53999,109 +54102,6 @@ var require_main2 = __commonJS({
53999
54102
  }
54000
54103
  });
54001
54104
 
54002
- // ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
54003
- var require_cjs = __commonJS({
54004
- "../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module2) {
54005
- "use strict";
54006
- var isMergeableObject = function isMergeableObject2(value) {
54007
- return isNonNullObject(value) && !isSpecial(value);
54008
- };
54009
- function isNonNullObject(value) {
54010
- return !!value && typeof value === "object";
54011
- }
54012
- function isSpecial(value) {
54013
- var stringValue = Object.prototype.toString.call(value);
54014
- return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
54015
- }
54016
- var canUseSymbol = typeof Symbol === "function" && Symbol.for;
54017
- var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
54018
- function isReactElement(value) {
54019
- return value.$$typeof === REACT_ELEMENT_TYPE;
54020
- }
54021
- function emptyTarget(val) {
54022
- return Array.isArray(val) ? [] : {};
54023
- }
54024
- function cloneUnlessOtherwiseSpecified(value, options) {
54025
- return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
54026
- }
54027
- function defaultArrayMerge(target, source, options) {
54028
- return target.concat(source).map(function(element) {
54029
- return cloneUnlessOtherwiseSpecified(element, options);
54030
- });
54031
- }
54032
- function getMergeFunction(key, options) {
54033
- if (!options.customMerge) {
54034
- return deepmerge;
54035
- }
54036
- var customMerge = options.customMerge(key);
54037
- return typeof customMerge === "function" ? customMerge : deepmerge;
54038
- }
54039
- function getEnumerableOwnPropertySymbols(target) {
54040
- return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
54041
- return target.propertyIsEnumerable(symbol);
54042
- }) : [];
54043
- }
54044
- function getKeys(target) {
54045
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
54046
- }
54047
- function propertyIsOnObject(object, property) {
54048
- try {
54049
- return property in object;
54050
- } catch (_) {
54051
- return false;
54052
- }
54053
- }
54054
- function propertyIsUnsafe(target, key) {
54055
- return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
54056
- }
54057
- function mergeObject(target, source, options) {
54058
- var destination = {};
54059
- if (options.isMergeableObject(target)) {
54060
- getKeys(target).forEach(function(key) {
54061
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
54062
- });
54063
- }
54064
- getKeys(source).forEach(function(key) {
54065
- if (propertyIsUnsafe(target, key)) {
54066
- return;
54067
- }
54068
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
54069
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
54070
- } else {
54071
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
54072
- }
54073
- });
54074
- return destination;
54075
- }
54076
- function deepmerge(target, source, options) {
54077
- options = options || {};
54078
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
54079
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
54080
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
54081
- var sourceIsArray = Array.isArray(source);
54082
- var targetIsArray = Array.isArray(target);
54083
- var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
54084
- if (!sourceAndTargetTypesMatch) {
54085
- return cloneUnlessOtherwiseSpecified(source, options);
54086
- } else if (sourceIsArray) {
54087
- return options.arrayMerge(target, source, options);
54088
- } else {
54089
- return mergeObject(target, source, options);
54090
- }
54091
- }
54092
- deepmerge.all = function deepmergeAll(array, options) {
54093
- if (!Array.isArray(array)) {
54094
- throw new Error("first argument should be an array");
54095
- }
54096
- return array.reduce(function(prev, next) {
54097
- return deepmerge(prev, next, options);
54098
- }, {});
54099
- };
54100
- var deepmerge_1 = deepmerge;
54101
- module2.exports = deepmerge_1;
54102
- }
54103
- });
54104
-
54105
54105
  // src/codegen/index.ts
54106
54106
  var codegen_exports = {};
54107
54107
  __export(codegen_exports, {
@@ -56619,10 +56619,11 @@ var query = documentPlugin(ArtifactKind.Query, function() {
56619
56619
  cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
56620
56620
  }
56621
56621
  lastVariables = { ...marshalVariables(ctx) };
56622
+ const variables = lastVariables;
56622
56623
  subscriptionSpec = {
56623
56624
  rootType: ctx.artifact.rootType,
56624
56625
  selection: ctx.artifact.selection,
56625
- variables: () => lastVariables,
56626
+ variables: () => variables,
56626
56627
  set: (newValue) => {
56627
56628
  resolve2(ctx, {
56628
56629
  data: newValue,
@@ -56651,12 +56652,17 @@ var query = documentPlugin(ArtifactKind.Query, function() {
56651
56652
  // src/runtime/client/plugins/fragment.ts
56652
56653
  var fragment = documentPlugin(ArtifactKind.Fragment, function() {
56653
56654
  let subscriptionSpec = null;
56655
+ let lastReference = null;
56654
56656
  return {
56655
56657
  start(ctx, { next, resolve: resolve2, variablesChanged, marshalVariables }) {
56656
56658
  if (!ctx.stuff.parentID) {
56657
56659
  return next(ctx);
56658
56660
  }
56659
- if (variablesChanged(ctx) && !ctx.cacheParams?.disableSubscriptions) {
56661
+ const currentReference = {
56662
+ parent: ctx.stuff.parentID,
56663
+ variables: marshalVariables(ctx)
56664
+ };
56665
+ if (!ctx.cacheParams?.disableSubscriptions && (!deepEquals(lastReference, currentReference) || variablesChanged(ctx))) {
56660
56666
  if (subscriptionSpec) {
56661
56667
  cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
56662
56668
  }
@@ -56679,6 +56685,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
56679
56685
  }
56680
56686
  };
56681
56687
  cache_default.subscribe(subscriptionSpec, variables);
56688
+ lastReference = currentReference;
56682
56689
  }
56683
56690
  next(ctx);
56684
56691
  },
@@ -56903,13 +56910,40 @@ var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
56903
56910
 
56904
56911
  // src/lib/parse.ts
56905
56912
  var import_parser = __toESM(require_lib3(), 1);
56906
- async function parseJS(str) {
56913
+
56914
+ // src/lib/deepMerge.ts
56915
+ var import_deepmerge = __toESM(require_cjs(), 1);
56916
+ function deepMerge(filepath, ...targets) {
56917
+ try {
56918
+ if (targets.length === 1) {
56919
+ return targets[0];
56920
+ } else if (targets.length === 2) {
56921
+ return (0, import_deepmerge.default)(targets[0], targets[1], {
56922
+ arrayMerge: (source, update) => [...new Set(source.concat(update))]
56923
+ });
56924
+ }
56925
+ return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
56926
+ } catch (e) {
56927
+ throw new HoudiniError({
56928
+ filepath,
56929
+ message: "could not merge: " + JSON.stringify(targets, null, 4),
56930
+ description: e.message
56931
+ });
56932
+ }
56933
+ }
56934
+
56935
+ // src/lib/parse.ts
56936
+ async function parseJS(str, config2) {
56937
+ const defaultConfig = {
56938
+ plugins: ["typescript"],
56939
+ sourceType: "module"
56940
+ };
56907
56941
  return {
56908
56942
  start: 0,
56909
- script: (0, import_parser.parse)(str || "", {
56910
- plugins: ["typescript"],
56911
- sourceType: "module"
56912
- }).program,
56943
+ script: (0, import_parser.parse)(
56944
+ str || "",
56945
+ config2 ? deepMerge("", defaultConfig, config2) : defaultConfig
56946
+ ).program,
56913
56947
  end: str.length
56914
56948
  };
56915
56949
  }
@@ -56959,27 +56993,6 @@ async function cleanupFiles(pathFolder, listOfObj) {
56959
56993
  return allFilesNotInList;
56960
56994
  }
56961
56995
 
56962
- // src/lib/deepMerge.ts
56963
- var import_deepmerge = __toESM(require_cjs(), 1);
56964
- function deepMerge(filepath, ...targets) {
56965
- try {
56966
- if (targets.length === 1) {
56967
- return targets[0];
56968
- } else if (targets.length === 2) {
56969
- return (0, import_deepmerge.default)(targets[0], targets[1], {
56970
- arrayMerge: (source, update) => [...new Set(source.concat(update))]
56971
- });
56972
- }
56973
- return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
56974
- } catch (e) {
56975
- throw new HoudiniError({
56976
- filepath,
56977
- message: "could not merge: " + targets,
56978
- description: e.message
56979
- });
56980
- }
56981
- }
56982
-
56983
56996
  // ../../node_modules/.pnpm/estree-walker@3.0.1/node_modules/estree-walker/src/walker.js
56984
56997
  var WalkerBase = class {
56985
56998
  constructor() {
@@ -59838,12 +59851,12 @@ ${exportStatement("config")}
59838
59851
  },
59839
59852
  [path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
59840
59853
  }),
59841
- ...config2.plugins.filter((plugin2) => plugin2.includeRuntime).map((plugin2) => generatePluginRuntime(config2, plugin2)),
59854
+ ...config2.plugins.filter((plugin2) => plugin2.includeRuntime).map((plugin2) => generatePluginRuntime(config2, docs, plugin2)),
59842
59855
  generatePluginIndex({ config: config2, exportStatement: exportStar })
59843
59856
  ]);
59844
59857
  await generateGraphqlReturnTypes(config2, docs);
59845
59858
  }
59846
- async function generatePluginRuntime(config2, plugin2) {
59859
+ async function generatePluginRuntime(config2, docs, plugin2) {
59847
59860
  if (houdini_mode.is_testing || !plugin2.includeRuntime) {
59848
59861
  return;
59849
59862
  }
@@ -59860,12 +59873,16 @@ async function generatePluginRuntime(config2, plugin2) {
59860
59873
  });
59861
59874
  }
59862
59875
  const pluginDir = config2.pluginRuntimeDirectory(plugin2.name);
59876
+ let transformMap = plugin2.transformRuntime ?? {};
59877
+ if (transformMap && typeof transformMap === "function") {
59878
+ transformMap = transformMap(docs);
59879
+ }
59863
59880
  await fs_exports.mkdirp(pluginDir);
59864
59881
  await fs_exports.recursiveCopy(
59865
59882
  runtime_path,
59866
59883
  pluginDir,
59867
59884
  Object.fromEntries(
59868
- Object.entries(plugin2.transformRuntime ?? {}).map(([key, value]) => [
59885
+ Object.entries(transformMap).map(([key, value]) => [
59869
59886
  path_exports.join(runtime_path, key),
59870
59887
  (content) => value({ config: config2, content })
59871
59888
  ])
@@ -60305,7 +60322,8 @@ async function generateDocumentTypes(config2, docs) {
60305
60322
  originalParsed: originalDocument,
60306
60323
  name,
60307
60324
  filename,
60308
- generateArtifact
60325
+ generateArtifact,
60326
+ artifact
60309
60327
  }) => {
60310
60328
  if (!generateArtifact) {
60311
60329
  return;
@@ -60344,6 +60362,14 @@ async function generateDocumentTypes(config2, docs) {
60344
60362
  missingScalars
60345
60363
  );
60346
60364
  }
60365
+ program.body.push(
60366
+ AST11.exportNamedDeclaration(
60367
+ AST11.tsTypeAliasDeclaration(
60368
+ AST11.identifier(`${name}$artifact`),
60369
+ convertToTs(serializeValue(artifact))
60370
+ )
60371
+ )
60372
+ );
60347
60373
  await fs_exports.writeFile(typeDefPath, recast11.print(program).code);
60348
60374
  typePaths.push(typeDefPath);
60349
60375
  }
@@ -60370,18 +60396,17 @@ export * from "${module2}"
60370
60396
  `;
60371
60397
  let indexContent = recast11.print(typeIndex).code;
60372
60398
  for (const plugin2 of config2.plugins) {
60373
- if (!plugin2.indexFile) {
60374
- continue;
60399
+ if (plugin2.indexFile) {
60400
+ indexContent = plugin2.indexFile({
60401
+ config: config2,
60402
+ content: indexContent,
60403
+ exportDefaultAs,
60404
+ exportStarFrom: exportStarFrom2,
60405
+ pluginRoot: config2.pluginDirectory(plugin2.name),
60406
+ typedef: true,
60407
+ documents: docs
60408
+ });
60375
60409
  }
60376
- indexContent = plugin2.indexFile({
60377
- config: config2,
60378
- content: indexContent,
60379
- exportDefaultAs,
60380
- exportStarFrom: exportStarFrom2,
60381
- pluginRoot: config2.pluginDirectory(plugin2.name),
60382
- typedef: true,
60383
- documents: docs
60384
- });
60385
60410
  if (plugin2.includeRuntime) {
60386
60411
  indexContent += exportStarFrom2({
60387
60412
  module: "./" + path_exports.relative(config2.rootDir, config2.pluginRuntimeDirectory(plugin2.name))
@@ -60413,6 +60438,42 @@ ${[...missingScalars].map(
60413
60438
  For more information, please visit this link: ${siteURL}/api/config#custom-scalars`);
60414
60439
  }
60415
60440
  }
60441
+ function convertToTs(source) {
60442
+ if (source.type === "ObjectExpression") {
60443
+ return AST11.tsTypeLiteral(
60444
+ source.properties.reduce(
60445
+ (props, prop) => {
60446
+ if (prop.type !== "ObjectProperty" || prop.key.type !== "StringLiteral" && prop.key.type === "Identifier") {
60447
+ return props;
60448
+ }
60449
+ return [
60450
+ ...props,
60451
+ AST11.tsPropertySignature(
60452
+ prop.key,
60453
+ AST11.tsTypeAnnotation(convertToTs(prop.value))
60454
+ )
60455
+ ];
60456
+ },
60457
+ []
60458
+ )
60459
+ );
60460
+ }
60461
+ if (source.type === "ArrayExpression") {
60462
+ return AST11.tsTupleType(
60463
+ source.elements.map((element) => convertToTs(element))
60464
+ );
60465
+ }
60466
+ if (source.type === "Literal" && typeof source.value === "boolean") {
60467
+ return AST11.tsLiteralType(AST11.booleanLiteral(source.value));
60468
+ }
60469
+ if (source.type === "Literal" && typeof source.value === "number") {
60470
+ return AST11.tsLiteralType(AST11.numericLiteral(source.value));
60471
+ }
60472
+ if (source.type === "Literal" && typeof source.value === "string") {
60473
+ return AST11.tsLiteralType(AST11.stringLiteral(source.value));
60474
+ }
60475
+ return AST11.tsLiteralType(source);
60476
+ }
60416
60477
  async function generateOperationTypeDefs(config2, filepath, body, definition, selections, visitedTypes, missingScalars) {
60417
60478
  let parentType = null;
60418
60479
  if (definition.operation === "query") {
@@ -61120,9 +61181,6 @@ async function writeIndexFile2(config2, docs) {
61120
61181
  module: relative2(config2.pluginRuntimeDirectory(plugin2.name))
61121
61182
  });
61122
61183
  }
61123
- if (!plugin2.indexFile) {
61124
- continue;
61125
- }
61126
61184
  }
61127
61185
  await fs_exports.writeFile(path_exports.join(config2.rootDir, "index.js"), body);
61128
61186
  }
@@ -62388,7 +62446,10 @@ async function collectDocuments(config2) {
62388
62446
  }
62389
62447
  }
62390
62448
  } catch (err) {
62391
- throw new HoudiniError({ ...err, filepath });
62449
+ throw {
62450
+ message: err.message,
62451
+ filepath
62452
+ };
62392
62453
  }
62393
62454
  })
62394
62455
  );