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
@@ -2403,7 +2403,7 @@ var require_visitor = __commonJS({
2403
2403
  Object.defineProperty(exports, "__esModule", {
2404
2404
  value: true
2405
2405
  });
2406
- exports.visit = visit12;
2406
+ exports.visit = visit13;
2407
2407
  exports.visitInParallel = visitInParallel;
2408
2408
  exports.getVisitFn = getVisitFn;
2409
2409
  exports.BREAK = exports.QueryDocumentKeys = void 0;
@@ -2466,7 +2466,7 @@ var require_visitor = __commonJS({
2466
2466
  exports.QueryDocumentKeys = QueryDocumentKeys;
2467
2467
  var BREAK = Object.freeze({});
2468
2468
  exports.BREAK = BREAK;
2469
- function visit12(root, visitor) {
2469
+ function visit13(root, visitor) {
2470
2470
  var visitorKeys = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : QueryDocumentKeys;
2471
2471
  var stack = void 0;
2472
2472
  var inArray = Array.isArray(root);
@@ -37672,6 +37672,109 @@ var require_lib3 = __commonJS({
37672
37672
  }
37673
37673
  });
37674
37674
 
37675
+ // ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
37676
+ var require_cjs = __commonJS({
37677
+ "../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module) {
37678
+ "use strict";
37679
+ var isMergeableObject = function isMergeableObject2(value) {
37680
+ return isNonNullObject(value) && !isSpecial(value);
37681
+ };
37682
+ function isNonNullObject(value) {
37683
+ return !!value && typeof value === "object";
37684
+ }
37685
+ function isSpecial(value) {
37686
+ var stringValue = Object.prototype.toString.call(value);
37687
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
37688
+ }
37689
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
37690
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
37691
+ function isReactElement(value) {
37692
+ return value.$$typeof === REACT_ELEMENT_TYPE;
37693
+ }
37694
+ function emptyTarget(val) {
37695
+ return Array.isArray(val) ? [] : {};
37696
+ }
37697
+ function cloneUnlessOtherwiseSpecified(value, options) {
37698
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
37699
+ }
37700
+ function defaultArrayMerge(target, source, options) {
37701
+ return target.concat(source).map(function(element) {
37702
+ return cloneUnlessOtherwiseSpecified(element, options);
37703
+ });
37704
+ }
37705
+ function getMergeFunction(key, options) {
37706
+ if (!options.customMerge) {
37707
+ return deepmerge;
37708
+ }
37709
+ var customMerge = options.customMerge(key);
37710
+ return typeof customMerge === "function" ? customMerge : deepmerge;
37711
+ }
37712
+ function getEnumerableOwnPropertySymbols(target) {
37713
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
37714
+ return target.propertyIsEnumerable(symbol);
37715
+ }) : [];
37716
+ }
37717
+ function getKeys(target) {
37718
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
37719
+ }
37720
+ function propertyIsOnObject(object, property) {
37721
+ try {
37722
+ return property in object;
37723
+ } catch (_) {
37724
+ return false;
37725
+ }
37726
+ }
37727
+ function propertyIsUnsafe(target, key) {
37728
+ return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
37729
+ }
37730
+ function mergeObject(target, source, options) {
37731
+ var destination = {};
37732
+ if (options.isMergeableObject(target)) {
37733
+ getKeys(target).forEach(function(key) {
37734
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
37735
+ });
37736
+ }
37737
+ getKeys(source).forEach(function(key) {
37738
+ if (propertyIsUnsafe(target, key)) {
37739
+ return;
37740
+ }
37741
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
37742
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
37743
+ } else {
37744
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
37745
+ }
37746
+ });
37747
+ return destination;
37748
+ }
37749
+ function deepmerge(target, source, options) {
37750
+ options = options || {};
37751
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
37752
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
37753
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
37754
+ var sourceIsArray = Array.isArray(source);
37755
+ var targetIsArray = Array.isArray(target);
37756
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
37757
+ if (!sourceAndTargetTypesMatch) {
37758
+ return cloneUnlessOtherwiseSpecified(source, options);
37759
+ } else if (sourceIsArray) {
37760
+ return options.arrayMerge(target, source, options);
37761
+ } else {
37762
+ return mergeObject(target, source, options);
37763
+ }
37764
+ }
37765
+ deepmerge.all = function deepmergeAll(array, options) {
37766
+ if (!Array.isArray(array)) {
37767
+ throw new Error("first argument should be an array");
37768
+ }
37769
+ return array.reduce(function(prev, next) {
37770
+ return deepmerge(prev, next, options);
37771
+ }, {});
37772
+ };
37773
+ var deepmerge_1 = deepmerge;
37774
+ module.exports = deepmerge_1;
37775
+ }
37776
+ });
37777
+
37675
37778
  // ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js
37676
37779
  var require_tslib = __commonJS({
37677
37780
  "../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js"(exports, module) {
@@ -39941,7 +40044,7 @@ var require_path_visitor = __commonJS({
39941
40044
  }
39942
40045
  return target;
39943
40046
  }
39944
- PathVisitor.visit = function visit12(node, methods) {
40047
+ PathVisitor.visit = function visit13(node, methods) {
39945
40048
  return PathVisitor.fromMethodsObject(methods).visit(node);
39946
40049
  };
39947
40050
  var PVp = PathVisitor.prototype;
@@ -40132,7 +40235,7 @@ var require_path_visitor = __commonJS({
40132
40235
  this.needToCallTraverse = false;
40133
40236
  return visitChildren(path2, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
40134
40237
  };
40135
- sharedContextProtoMethods.visit = function visit12(path2, newVisitor) {
40238
+ sharedContextProtoMethods.visit = function visit13(path2, newVisitor) {
40136
40239
  if (!(this instanceof this.Context)) {
40137
40240
  throw new Error("");
40138
40241
  }
@@ -41525,7 +41628,7 @@ var require_main = __commonJS({
41525
41628
  var someField = _a.someField;
41526
41629
  var Type = _a.Type;
41527
41630
  var use = _a.use;
41528
- var visit12 = _a.visit;
41631
+ var visit13 = _a.visit;
41529
41632
  exports.astNodesAreEquivalent = astNodesAreEquivalent;
41530
41633
  exports.builders = builders;
41531
41634
  exports.builtInTypes = builtInTypes;
@@ -41542,7 +41645,7 @@ var require_main = __commonJS({
41542
41645
  exports.someField = someField;
41543
41646
  exports.Type = Type;
41544
41647
  exports.use = use;
41545
- exports.visit = visit12;
41648
+ exports.visit = visit13;
41546
41649
  Object.assign(namedTypes_1.namedTypes, n);
41547
41650
  }
41548
41651
  });
@@ -54004,109 +54107,6 @@ var require_main2 = __commonJS({
54004
54107
  }
54005
54108
  });
54006
54109
 
54007
- // ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
54008
- var require_cjs = __commonJS({
54009
- "../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module) {
54010
- "use strict";
54011
- var isMergeableObject = function isMergeableObject2(value) {
54012
- return isNonNullObject(value) && !isSpecial(value);
54013
- };
54014
- function isNonNullObject(value) {
54015
- return !!value && typeof value === "object";
54016
- }
54017
- function isSpecial(value) {
54018
- var stringValue = Object.prototype.toString.call(value);
54019
- return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
54020
- }
54021
- var canUseSymbol = typeof Symbol === "function" && Symbol.for;
54022
- var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
54023
- function isReactElement(value) {
54024
- return value.$$typeof === REACT_ELEMENT_TYPE;
54025
- }
54026
- function emptyTarget(val) {
54027
- return Array.isArray(val) ? [] : {};
54028
- }
54029
- function cloneUnlessOtherwiseSpecified(value, options) {
54030
- return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
54031
- }
54032
- function defaultArrayMerge(target, source, options) {
54033
- return target.concat(source).map(function(element) {
54034
- return cloneUnlessOtherwiseSpecified(element, options);
54035
- });
54036
- }
54037
- function getMergeFunction(key, options) {
54038
- if (!options.customMerge) {
54039
- return deepmerge;
54040
- }
54041
- var customMerge = options.customMerge(key);
54042
- return typeof customMerge === "function" ? customMerge : deepmerge;
54043
- }
54044
- function getEnumerableOwnPropertySymbols(target) {
54045
- return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
54046
- return target.propertyIsEnumerable(symbol);
54047
- }) : [];
54048
- }
54049
- function getKeys(target) {
54050
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
54051
- }
54052
- function propertyIsOnObject(object, property) {
54053
- try {
54054
- return property in object;
54055
- } catch (_) {
54056
- return false;
54057
- }
54058
- }
54059
- function propertyIsUnsafe(target, key) {
54060
- return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
54061
- }
54062
- function mergeObject(target, source, options) {
54063
- var destination = {};
54064
- if (options.isMergeableObject(target)) {
54065
- getKeys(target).forEach(function(key) {
54066
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
54067
- });
54068
- }
54069
- getKeys(source).forEach(function(key) {
54070
- if (propertyIsUnsafe(target, key)) {
54071
- return;
54072
- }
54073
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
54074
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
54075
- } else {
54076
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
54077
- }
54078
- });
54079
- return destination;
54080
- }
54081
- function deepmerge(target, source, options) {
54082
- options = options || {};
54083
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
54084
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
54085
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
54086
- var sourceIsArray = Array.isArray(source);
54087
- var targetIsArray = Array.isArray(target);
54088
- var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
54089
- if (!sourceAndTargetTypesMatch) {
54090
- return cloneUnlessOtherwiseSpecified(source, options);
54091
- } else if (sourceIsArray) {
54092
- return options.arrayMerge(target, source, options);
54093
- } else {
54094
- return mergeObject(target, source, options);
54095
- }
54096
- }
54097
- deepmerge.all = function deepmergeAll(array, options) {
54098
- if (!Array.isArray(array)) {
54099
- throw new Error("first argument should be an array");
54100
- }
54101
- return array.reduce(function(prev, next) {
54102
- return deepmerge(prev, next, options);
54103
- }, {});
54104
- };
54105
- var deepmerge_1 = deepmerge;
54106
- module.exports = deepmerge_1;
54107
- }
54108
- });
54109
-
54110
54110
  // src/codegen/index.ts
54111
54111
  var graphql26 = __toESM(require_graphql2(), 1);
54112
54112
 
@@ -56618,10 +56618,11 @@ var query = documentPlugin(ArtifactKind.Query, function() {
56618
56618
  cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
56619
56619
  }
56620
56620
  lastVariables = { ...marshalVariables(ctx) };
56621
+ const variables = lastVariables;
56621
56622
  subscriptionSpec = {
56622
56623
  rootType: ctx.artifact.rootType,
56623
56624
  selection: ctx.artifact.selection,
56624
- variables: () => lastVariables,
56625
+ variables: () => variables,
56625
56626
  set: (newValue) => {
56626
56627
  resolve2(ctx, {
56627
56628
  data: newValue,
@@ -56650,12 +56651,17 @@ var query = documentPlugin(ArtifactKind.Query, function() {
56650
56651
  // src/runtime/client/plugins/fragment.ts
56651
56652
  var fragment = documentPlugin(ArtifactKind.Fragment, function() {
56652
56653
  let subscriptionSpec = null;
56654
+ let lastReference = null;
56653
56655
  return {
56654
56656
  start(ctx, { next, resolve: resolve2, variablesChanged, marshalVariables }) {
56655
56657
  if (!ctx.stuff.parentID) {
56656
56658
  return next(ctx);
56657
56659
  }
56658
- if (variablesChanged(ctx) && !ctx.cacheParams?.disableSubscriptions) {
56660
+ const currentReference = {
56661
+ parent: ctx.stuff.parentID,
56662
+ variables: marshalVariables(ctx)
56663
+ };
56664
+ if (!ctx.cacheParams?.disableSubscriptions && (!deepEquals(lastReference, currentReference) || variablesChanged(ctx))) {
56659
56665
  if (subscriptionSpec) {
56660
56666
  cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
56661
56667
  }
@@ -56678,6 +56684,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
56678
56684
  }
56679
56685
  };
56680
56686
  cache_default.subscribe(subscriptionSpec, variables);
56687
+ lastReference = currentReference;
56681
56688
  }
56682
56689
  next(ctx);
56683
56690
  },
@@ -56901,13 +56908,40 @@ var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
56901
56908
 
56902
56909
  // src/lib/parse.ts
56903
56910
  var import_parser = __toESM(require_lib3(), 1);
56904
- async function parseJS(str) {
56911
+
56912
+ // src/lib/deepMerge.ts
56913
+ var import_deepmerge = __toESM(require_cjs(), 1);
56914
+ function deepMerge(filepath, ...targets) {
56915
+ try {
56916
+ if (targets.length === 1) {
56917
+ return targets[0];
56918
+ } else if (targets.length === 2) {
56919
+ return (0, import_deepmerge.default)(targets[0], targets[1], {
56920
+ arrayMerge: (source, update) => [...new Set(source.concat(update))]
56921
+ });
56922
+ }
56923
+ return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
56924
+ } catch (e) {
56925
+ throw new HoudiniError({
56926
+ filepath,
56927
+ message: "could not merge: " + JSON.stringify(targets, null, 4),
56928
+ description: e.message
56929
+ });
56930
+ }
56931
+ }
56932
+
56933
+ // src/lib/parse.ts
56934
+ async function parseJS(str, config2) {
56935
+ const defaultConfig = {
56936
+ plugins: ["typescript"],
56937
+ sourceType: "module"
56938
+ };
56905
56939
  return {
56906
56940
  start: 0,
56907
- script: (0, import_parser.parse)(str || "", {
56908
- plugins: ["typescript"],
56909
- sourceType: "module"
56910
- }).program,
56941
+ script: (0, import_parser.parse)(
56942
+ str || "",
56943
+ config2 ? deepMerge("", defaultConfig, config2) : defaultConfig
56944
+ ).program,
56911
56945
  end: str.length
56912
56946
  };
56913
56947
  }
@@ -56957,27 +56991,6 @@ async function cleanupFiles(pathFolder, listOfObj) {
56957
56991
  return allFilesNotInList;
56958
56992
  }
56959
56993
 
56960
- // src/lib/deepMerge.ts
56961
- var import_deepmerge = __toESM(require_cjs(), 1);
56962
- function deepMerge(filepath, ...targets) {
56963
- try {
56964
- if (targets.length === 1) {
56965
- return targets[0];
56966
- } else if (targets.length === 2) {
56967
- return (0, import_deepmerge.default)(targets[0], targets[1], {
56968
- arrayMerge: (source, update) => [...new Set(source.concat(update))]
56969
- });
56970
- }
56971
- return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
56972
- } catch (e) {
56973
- throw new HoudiniError({
56974
- filepath,
56975
- message: "could not merge: " + targets,
56976
- description: e.message
56977
- });
56978
- }
56979
- }
56980
-
56981
56994
  // ../../node_modules/.pnpm/estree-walker@3.0.1/node_modules/estree-walker/src/walker.js
56982
56995
  var WalkerBase = class {
56983
56996
  constructor() {
@@ -59836,12 +59849,12 @@ ${exportStatement("config")}
59836
59849
  },
59837
59850
  [path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
59838
59851
  }),
59839
- ...config2.plugins.filter((plugin2) => plugin2.includeRuntime).map((plugin2) => generatePluginRuntime(config2, plugin2)),
59852
+ ...config2.plugins.filter((plugin2) => plugin2.includeRuntime).map((plugin2) => generatePluginRuntime(config2, docs, plugin2)),
59840
59853
  generatePluginIndex({ config: config2, exportStatement: exportStar })
59841
59854
  ]);
59842
59855
  await generateGraphqlReturnTypes(config2, docs);
59843
59856
  }
59844
- async function generatePluginRuntime(config2, plugin2) {
59857
+ async function generatePluginRuntime(config2, docs, plugin2) {
59845
59858
  if (houdini_mode.is_testing || !plugin2.includeRuntime) {
59846
59859
  return;
59847
59860
  }
@@ -59858,12 +59871,16 @@ async function generatePluginRuntime(config2, plugin2) {
59858
59871
  });
59859
59872
  }
59860
59873
  const pluginDir = config2.pluginRuntimeDirectory(plugin2.name);
59874
+ let transformMap = plugin2.transformRuntime ?? {};
59875
+ if (transformMap && typeof transformMap === "function") {
59876
+ transformMap = transformMap(docs);
59877
+ }
59861
59878
  await fs_exports.mkdirp(pluginDir);
59862
59879
  await fs_exports.recursiveCopy(
59863
59880
  runtime_path,
59864
59881
  pluginDir,
59865
59882
  Object.fromEntries(
59866
- Object.entries(plugin2.transformRuntime ?? {}).map(([key, value]) => [
59883
+ Object.entries(transformMap).map(([key, value]) => [
59867
59884
  path_exports.join(runtime_path, key),
59868
59885
  (content) => value({ config: config2, content })
59869
59886
  ])
@@ -60303,7 +60320,8 @@ async function generateDocumentTypes(config2, docs) {
60303
60320
  originalParsed: originalDocument,
60304
60321
  name,
60305
60322
  filename,
60306
- generateArtifact
60323
+ generateArtifact,
60324
+ artifact
60307
60325
  }) => {
60308
60326
  if (!generateArtifact) {
60309
60327
  return;
@@ -60342,6 +60360,14 @@ async function generateDocumentTypes(config2, docs) {
60342
60360
  missingScalars
60343
60361
  );
60344
60362
  }
60363
+ program.body.push(
60364
+ AST11.exportNamedDeclaration(
60365
+ AST11.tsTypeAliasDeclaration(
60366
+ AST11.identifier(`${name}$artifact`),
60367
+ convertToTs(serializeValue(artifact))
60368
+ )
60369
+ )
60370
+ );
60345
60371
  await fs_exports.writeFile(typeDefPath, recast11.print(program).code);
60346
60372
  typePaths.push(typeDefPath);
60347
60373
  }
@@ -60368,18 +60394,17 @@ export * from "${module}"
60368
60394
  `;
60369
60395
  let indexContent = recast11.print(typeIndex).code;
60370
60396
  for (const plugin2 of config2.plugins) {
60371
- if (!plugin2.indexFile) {
60372
- continue;
60397
+ if (plugin2.indexFile) {
60398
+ indexContent = plugin2.indexFile({
60399
+ config: config2,
60400
+ content: indexContent,
60401
+ exportDefaultAs,
60402
+ exportStarFrom: exportStarFrom2,
60403
+ pluginRoot: config2.pluginDirectory(plugin2.name),
60404
+ typedef: true,
60405
+ documents: docs
60406
+ });
60373
60407
  }
60374
- indexContent = plugin2.indexFile({
60375
- config: config2,
60376
- content: indexContent,
60377
- exportDefaultAs,
60378
- exportStarFrom: exportStarFrom2,
60379
- pluginRoot: config2.pluginDirectory(plugin2.name),
60380
- typedef: true,
60381
- documents: docs
60382
- });
60383
60408
  if (plugin2.includeRuntime) {
60384
60409
  indexContent += exportStarFrom2({
60385
60410
  module: "./" + path_exports.relative(config2.rootDir, config2.pluginRuntimeDirectory(plugin2.name))
@@ -60411,6 +60436,42 @@ ${[...missingScalars].map(
60411
60436
  For more information, please visit this link: ${siteURL}/api/config#custom-scalars`);
60412
60437
  }
60413
60438
  }
60439
+ function convertToTs(source) {
60440
+ if (source.type === "ObjectExpression") {
60441
+ return AST11.tsTypeLiteral(
60442
+ source.properties.reduce(
60443
+ (props, prop) => {
60444
+ if (prop.type !== "ObjectProperty" || prop.key.type !== "StringLiteral" && prop.key.type === "Identifier") {
60445
+ return props;
60446
+ }
60447
+ return [
60448
+ ...props,
60449
+ AST11.tsPropertySignature(
60450
+ prop.key,
60451
+ AST11.tsTypeAnnotation(convertToTs(prop.value))
60452
+ )
60453
+ ];
60454
+ },
60455
+ []
60456
+ )
60457
+ );
60458
+ }
60459
+ if (source.type === "ArrayExpression") {
60460
+ return AST11.tsTupleType(
60461
+ source.elements.map((element) => convertToTs(element))
60462
+ );
60463
+ }
60464
+ if (source.type === "Literal" && typeof source.value === "boolean") {
60465
+ return AST11.tsLiteralType(AST11.booleanLiteral(source.value));
60466
+ }
60467
+ if (source.type === "Literal" && typeof source.value === "number") {
60468
+ return AST11.tsLiteralType(AST11.numericLiteral(source.value));
60469
+ }
60470
+ if (source.type === "Literal" && typeof source.value === "string") {
60471
+ return AST11.tsLiteralType(AST11.stringLiteral(source.value));
60472
+ }
60473
+ return AST11.tsLiteralType(source);
60474
+ }
60414
60475
  async function generateOperationTypeDefs(config2, filepath, body, definition, selections, visitedTypes, missingScalars) {
60415
60476
  let parentType = null;
60416
60477
  if (definition.operation === "query") {
@@ -61118,9 +61179,6 @@ async function writeIndexFile2(config2, docs) {
61118
61179
  module: relative2(config2.pluginRuntimeDirectory(plugin2.name))
61119
61180
  });
61120
61181
  }
61121
- if (!plugin2.indexFile) {
61122
- continue;
61123
- }
61124
61182
  }
61125
61183
  await fs_exports.writeFile(path_exports.join(config2.rootDir, "index.js"), body);
61126
61184
  }
@@ -62386,7 +62444,10 @@ async function collectDocuments(config2) {
62386
62444
  }
62387
62445
  }
62388
62446
  } catch (err) {
62389
- throw new HoudiniError({ ...err, filepath });
62447
+ throw {
62448
+ message: err.message,
62449
+ filepath
62450
+ };
62390
62451
  }
62391
62452
  })
62392
62453
  );
@@ -118,6 +118,7 @@ export declare class Config {
118
118
  listRemoveFragment(name: string): string;
119
119
  isInternalEnum(node: graphql.EnumTypeDefinitionNode): boolean;
120
120
  isInternalDirective(name: string): boolean;
121
+ needsRefetchArtifact(document: graphql.DocumentNode): boolean;
121
122
  registerFragmentVariablesHash({ hash, args, fragment, }: {
122
123
  hash: string;
123
124
  args: ValueMap | null;
@@ -1,8 +1,9 @@
1
+ import { type ParserOptions } from '@babel/parser';
1
2
  import type { Maybe, Script } from './types';
2
3
  export type ParsedFile = Maybe<{
3
4
  script: Script;
4
5
  start: number;
5
6
  end: number;
6
7
  }>;
7
- export declare function parseJS(str: string): Promise<ParsedFile>;
8
+ export declare function parseJS(str: string, config?: Partial<ParserOptions>): Promise<ParsedFile>;
8
9
  export declare function parseJSON(str: string): any;
@@ -103,7 +103,10 @@ export type PluginHooks = {
103
103
  transformRuntime?: Record<string, (args: {
104
104
  config: Config;
105
105
  content: string;
106
- }) => string>;
106
+ }) => string> | ((docs: Document[]) => Record<string, (args: {
107
+ config: Config;
108
+ content: string;
109
+ }) => string>);
107
110
  /**
108
111
  * An module with an default export that sets configuration values.
109
112
  */