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
@@ -6546,7 +6546,7 @@ var require_visitor = __commonJS({
6546
6546
  Object.defineProperty(exports, "__esModule", {
6547
6547
  value: true
6548
6548
  });
6549
- exports.visit = visit13;
6549
+ exports.visit = visit14;
6550
6550
  exports.visitInParallel = visitInParallel;
6551
6551
  exports.getVisitFn = getVisitFn;
6552
6552
  exports.BREAK = exports.QueryDocumentKeys = void 0;
@@ -6609,7 +6609,7 @@ var require_visitor = __commonJS({
6609
6609
  exports.QueryDocumentKeys = QueryDocumentKeys;
6610
6610
  var BREAK = Object.freeze({});
6611
6611
  exports.BREAK = BREAK;
6612
- function visit13(root, visitor) {
6612
+ function visit14(root, visitor) {
6613
6613
  var visitorKeys = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : QueryDocumentKeys;
6614
6614
  var stack = void 0;
6615
6615
  var inArray = Array.isArray(root);
@@ -45401,6 +45401,109 @@ var require_lib3 = __commonJS({
45401
45401
  }
45402
45402
  });
45403
45403
 
45404
+ // ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
45405
+ var require_cjs = __commonJS({
45406
+ "../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module2) {
45407
+ "use strict";
45408
+ var isMergeableObject = function isMergeableObject2(value) {
45409
+ return isNonNullObject(value) && !isSpecial(value);
45410
+ };
45411
+ function isNonNullObject(value) {
45412
+ return !!value && typeof value === "object";
45413
+ }
45414
+ function isSpecial(value) {
45415
+ var stringValue = Object.prototype.toString.call(value);
45416
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
45417
+ }
45418
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
45419
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
45420
+ function isReactElement(value) {
45421
+ return value.$$typeof === REACT_ELEMENT_TYPE;
45422
+ }
45423
+ function emptyTarget(val) {
45424
+ return Array.isArray(val) ? [] : {};
45425
+ }
45426
+ function cloneUnlessOtherwiseSpecified(value, options) {
45427
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
45428
+ }
45429
+ function defaultArrayMerge(target, source, options) {
45430
+ return target.concat(source).map(function(element) {
45431
+ return cloneUnlessOtherwiseSpecified(element, options);
45432
+ });
45433
+ }
45434
+ function getMergeFunction(key, options) {
45435
+ if (!options.customMerge) {
45436
+ return deepmerge;
45437
+ }
45438
+ var customMerge = options.customMerge(key);
45439
+ return typeof customMerge === "function" ? customMerge : deepmerge;
45440
+ }
45441
+ function getEnumerableOwnPropertySymbols(target) {
45442
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
45443
+ return target.propertyIsEnumerable(symbol);
45444
+ }) : [];
45445
+ }
45446
+ function getKeys(target) {
45447
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
45448
+ }
45449
+ function propertyIsOnObject(object, property) {
45450
+ try {
45451
+ return property in object;
45452
+ } catch (_) {
45453
+ return false;
45454
+ }
45455
+ }
45456
+ function propertyIsUnsafe(target, key) {
45457
+ return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
45458
+ }
45459
+ function mergeObject(target, source, options) {
45460
+ var destination = {};
45461
+ if (options.isMergeableObject(target)) {
45462
+ getKeys(target).forEach(function(key) {
45463
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
45464
+ });
45465
+ }
45466
+ getKeys(source).forEach(function(key) {
45467
+ if (propertyIsUnsafe(target, key)) {
45468
+ return;
45469
+ }
45470
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
45471
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
45472
+ } else {
45473
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
45474
+ }
45475
+ });
45476
+ return destination;
45477
+ }
45478
+ function deepmerge(target, source, options) {
45479
+ options = options || {};
45480
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
45481
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
45482
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
45483
+ var sourceIsArray = Array.isArray(source);
45484
+ var targetIsArray = Array.isArray(target);
45485
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
45486
+ if (!sourceAndTargetTypesMatch) {
45487
+ return cloneUnlessOtherwiseSpecified(source, options);
45488
+ } else if (sourceIsArray) {
45489
+ return options.arrayMerge(target, source, options);
45490
+ } else {
45491
+ return mergeObject(target, source, options);
45492
+ }
45493
+ }
45494
+ deepmerge.all = function deepmergeAll(array, options) {
45495
+ if (!Array.isArray(array)) {
45496
+ throw new Error("first argument should be an array");
45497
+ }
45498
+ return array.reduce(function(prev, next) {
45499
+ return deepmerge(prev, next, options);
45500
+ }, {});
45501
+ };
45502
+ var deepmerge_1 = deepmerge;
45503
+ module2.exports = deepmerge_1;
45504
+ }
45505
+ });
45506
+
45404
45507
  // ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js
45405
45508
  var require_tslib = __commonJS({
45406
45509
  "../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js"(exports, module2) {
@@ -47670,7 +47773,7 @@ var require_path_visitor = __commonJS({
47670
47773
  }
47671
47774
  return target;
47672
47775
  }
47673
- PathVisitor.visit = function visit13(node, methods) {
47776
+ PathVisitor.visit = function visit14(node, methods) {
47674
47777
  return PathVisitor.fromMethodsObject(methods).visit(node);
47675
47778
  };
47676
47779
  var PVp = PathVisitor.prototype;
@@ -47861,7 +47964,7 @@ var require_path_visitor = __commonJS({
47861
47964
  this.needToCallTraverse = false;
47862
47965
  return visitChildren(path2, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
47863
47966
  };
47864
- sharedContextProtoMethods.visit = function visit13(path2, newVisitor) {
47967
+ sharedContextProtoMethods.visit = function visit14(path2, newVisitor) {
47865
47968
  if (!(this instanceof this.Context)) {
47866
47969
  throw new Error("");
47867
47970
  }
@@ -49254,7 +49357,7 @@ var require_main = __commonJS({
49254
49357
  var someField = _a.someField;
49255
49358
  var Type = _a.Type;
49256
49359
  var use = _a.use;
49257
- var visit13 = _a.visit;
49360
+ var visit14 = _a.visit;
49258
49361
  exports.astNodesAreEquivalent = astNodesAreEquivalent;
49259
49362
  exports.builders = builders;
49260
49363
  exports.builtInTypes = builtInTypes;
@@ -49271,7 +49374,7 @@ var require_main = __commonJS({
49271
49374
  exports.someField = someField;
49272
49375
  exports.Type = Type;
49273
49376
  exports.use = use;
49274
- exports.visit = visit13;
49377
+ exports.visit = visit14;
49275
49378
  Object.assign(namedTypes_1.namedTypes, n);
49276
49379
  }
49277
49380
  });
@@ -61733,109 +61836,6 @@ var require_main2 = __commonJS({
61733
61836
  }
61734
61837
  });
61735
61838
 
61736
- // ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
61737
- var require_cjs = __commonJS({
61738
- "../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module2) {
61739
- "use strict";
61740
- var isMergeableObject = function isMergeableObject2(value) {
61741
- return isNonNullObject(value) && !isSpecial(value);
61742
- };
61743
- function isNonNullObject(value) {
61744
- return !!value && typeof value === "object";
61745
- }
61746
- function isSpecial(value) {
61747
- var stringValue = Object.prototype.toString.call(value);
61748
- return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
61749
- }
61750
- var canUseSymbol = typeof Symbol === "function" && Symbol.for;
61751
- var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
61752
- function isReactElement(value) {
61753
- return value.$$typeof === REACT_ELEMENT_TYPE;
61754
- }
61755
- function emptyTarget(val) {
61756
- return Array.isArray(val) ? [] : {};
61757
- }
61758
- function cloneUnlessOtherwiseSpecified(value, options) {
61759
- return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
61760
- }
61761
- function defaultArrayMerge(target, source, options) {
61762
- return target.concat(source).map(function(element) {
61763
- return cloneUnlessOtherwiseSpecified(element, options);
61764
- });
61765
- }
61766
- function getMergeFunction(key, options) {
61767
- if (!options.customMerge) {
61768
- return deepmerge;
61769
- }
61770
- var customMerge = options.customMerge(key);
61771
- return typeof customMerge === "function" ? customMerge : deepmerge;
61772
- }
61773
- function getEnumerableOwnPropertySymbols(target) {
61774
- return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
61775
- return target.propertyIsEnumerable(symbol);
61776
- }) : [];
61777
- }
61778
- function getKeys(target) {
61779
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
61780
- }
61781
- function propertyIsOnObject(object, property) {
61782
- try {
61783
- return property in object;
61784
- } catch (_) {
61785
- return false;
61786
- }
61787
- }
61788
- function propertyIsUnsafe(target, key) {
61789
- return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
61790
- }
61791
- function mergeObject(target, source, options) {
61792
- var destination = {};
61793
- if (options.isMergeableObject(target)) {
61794
- getKeys(target).forEach(function(key) {
61795
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
61796
- });
61797
- }
61798
- getKeys(source).forEach(function(key) {
61799
- if (propertyIsUnsafe(target, key)) {
61800
- return;
61801
- }
61802
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
61803
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
61804
- } else {
61805
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
61806
- }
61807
- });
61808
- return destination;
61809
- }
61810
- function deepmerge(target, source, options) {
61811
- options = options || {};
61812
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
61813
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
61814
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
61815
- var sourceIsArray = Array.isArray(source);
61816
- var targetIsArray = Array.isArray(target);
61817
- var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
61818
- if (!sourceAndTargetTypesMatch) {
61819
- return cloneUnlessOtherwiseSpecified(source, options);
61820
- } else if (sourceIsArray) {
61821
- return options.arrayMerge(target, source, options);
61822
- } else {
61823
- return mergeObject(target, source, options);
61824
- }
61825
- }
61826
- deepmerge.all = function deepmergeAll(array, options) {
61827
- if (!Array.isArray(array)) {
61828
- throw new Error("first argument should be an array");
61829
- }
61830
- return array.reduce(function(prev, next) {
61831
- return deepmerge(prev, next, options);
61832
- }, {});
61833
- };
61834
- var deepmerge_1 = deepmerge;
61835
- module2.exports = deepmerge_1;
61836
- }
61837
- });
61838
-
61839
61839
  // src/vite/index.ts
61840
61840
  var vite_exports = {};
61841
61841
  __export(vite_exports, {
@@ -69006,10 +69006,11 @@ var query = documentPlugin(ArtifactKind.Query, function() {
69006
69006
  cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
69007
69007
  }
69008
69008
  lastVariables = { ...marshalVariables(ctx) };
69009
+ const variables = lastVariables;
69009
69010
  subscriptionSpec = {
69010
69011
  rootType: ctx.artifact.rootType,
69011
69012
  selection: ctx.artifact.selection,
69012
- variables: () => lastVariables,
69013
+ variables: () => variables,
69013
69014
  set: (newValue) => {
69014
69015
  resolve2(ctx, {
69015
69016
  data: newValue,
@@ -69038,12 +69039,17 @@ var query = documentPlugin(ArtifactKind.Query, function() {
69038
69039
  // src/runtime/client/plugins/fragment.ts
69039
69040
  var fragment = documentPlugin(ArtifactKind.Fragment, function() {
69040
69041
  let subscriptionSpec = null;
69042
+ let lastReference = null;
69041
69043
  return {
69042
69044
  start(ctx, { next, resolve: resolve2, variablesChanged, marshalVariables }) {
69043
69045
  if (!ctx.stuff.parentID) {
69044
69046
  return next(ctx);
69045
69047
  }
69046
- if (variablesChanged(ctx) && !ctx.cacheParams?.disableSubscriptions) {
69048
+ const currentReference = {
69049
+ parent: ctx.stuff.parentID,
69050
+ variables: marshalVariables(ctx)
69051
+ };
69052
+ if (!ctx.cacheParams?.disableSubscriptions && (!deepEquals(lastReference, currentReference) || variablesChanged(ctx))) {
69047
69053
  if (subscriptionSpec) {
69048
69054
  cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
69049
69055
  }
@@ -69066,6 +69072,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
69066
69072
  }
69067
69073
  };
69068
69074
  cache_default.subscribe(subscriptionSpec, variables);
69075
+ lastReference = currentReference;
69069
69076
  }
69070
69077
  next(ctx);
69071
69078
  },
@@ -69574,6 +69581,17 @@ var Config = class {
69574
69581
  }, []) ?? [];
69575
69582
  return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name));
69576
69583
  }
69584
+ needsRefetchArtifact(document) {
69585
+ let needsArtifact = false;
69586
+ graphql2.visit(document, {
69587
+ Directive: (node) => {
69588
+ if ([this.paginateDirective].includes(node.name.value)) {
69589
+ needsArtifact = true;
69590
+ }
69591
+ }
69592
+ });
69593
+ return needsArtifact;
69594
+ }
69577
69595
  #fragmentVariableMaps;
69578
69596
  registerFragmentVariablesHash({
69579
69597
  hash,
@@ -70062,13 +70080,40 @@ var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
70062
70080
 
70063
70081
  // src/lib/parse.ts
70064
70082
  var import_parser = __toESM(require_lib3(), 1);
70065
- async function parseJS(str) {
70083
+
70084
+ // src/lib/deepMerge.ts
70085
+ var import_deepmerge = __toESM(require_cjs(), 1);
70086
+ function deepMerge(filepath, ...targets) {
70087
+ try {
70088
+ if (targets.length === 1) {
70089
+ return targets[0];
70090
+ } else if (targets.length === 2) {
70091
+ return (0, import_deepmerge.default)(targets[0], targets[1], {
70092
+ arrayMerge: (source, update) => [...new Set(source.concat(update))]
70093
+ });
70094
+ }
70095
+ return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
70096
+ } catch (e2) {
70097
+ throw new HoudiniError({
70098
+ filepath,
70099
+ message: "could not merge: " + JSON.stringify(targets, null, 4),
70100
+ description: e2.message
70101
+ });
70102
+ }
70103
+ }
70104
+
70105
+ // src/lib/parse.ts
70106
+ async function parseJS(str, config4) {
70107
+ const defaultConfig = {
70108
+ plugins: ["typescript"],
70109
+ sourceType: "module"
70110
+ };
70066
70111
  return {
70067
70112
  start: 0,
70068
- script: (0, import_parser.parse)(str || "", {
70069
- plugins: ["typescript"],
70070
- sourceType: "module"
70071
- }).program,
70113
+ script: (0, import_parser.parse)(
70114
+ str || "",
70115
+ config4 ? deepMerge("", defaultConfig, config4) : defaultConfig
70116
+ ).program,
70072
70117
  end: str.length
70073
70118
  };
70074
70119
  }
@@ -70118,27 +70163,6 @@ async function cleanupFiles(pathFolder, listOfObj) {
70118
70163
  return allFilesNotInList;
70119
70164
  }
70120
70165
 
70121
- // src/lib/deepMerge.ts
70122
- var import_deepmerge = __toESM(require_cjs(), 1);
70123
- function deepMerge(filepath, ...targets) {
70124
- try {
70125
- if (targets.length === 1) {
70126
- return targets[0];
70127
- } else if (targets.length === 2) {
70128
- return (0, import_deepmerge.default)(targets[0], targets[1], {
70129
- arrayMerge: (source, update) => [...new Set(source.concat(update))]
70130
- });
70131
- }
70132
- return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
70133
- } catch (e2) {
70134
- throw new HoudiniError({
70135
- filepath,
70136
- message: "could not merge: " + targets,
70137
- description: e2.message
70138
- });
70139
- }
70140
- }
70141
-
70142
70166
  // ../../node_modules/.pnpm/estree-walker@3.0.1/node_modules/estree-walker/src/walker.js
70143
70167
  var WalkerBase = class {
70144
70168
  constructor() {
@@ -73003,12 +73027,12 @@ ${exportStatement("config")}
73003
73027
  },
73004
73028
  [path_exports.join(config4.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config4, content, importStatement, exportStatement })
73005
73029
  }),
73006
- ...config4.plugins.filter((plugin2) => plugin2.includeRuntime).map((plugin2) => generatePluginRuntime(config4, plugin2)),
73030
+ ...config4.plugins.filter((plugin2) => plugin2.includeRuntime).map((plugin2) => generatePluginRuntime(config4, docs, plugin2)),
73007
73031
  generatePluginIndex({ config: config4, exportStatement: exportStar })
73008
73032
  ]);
73009
73033
  await generateGraphqlReturnTypes(config4, docs);
73010
73034
  }
73011
- async function generatePluginRuntime(config4, plugin2) {
73035
+ async function generatePluginRuntime(config4, docs, plugin2) {
73012
73036
  if (houdini_mode.is_testing || !plugin2.includeRuntime) {
73013
73037
  return;
73014
73038
  }
@@ -73025,12 +73049,16 @@ async function generatePluginRuntime(config4, plugin2) {
73025
73049
  });
73026
73050
  }
73027
73051
  const pluginDir = config4.pluginRuntimeDirectory(plugin2.name);
73052
+ let transformMap = plugin2.transformRuntime ?? {};
73053
+ if (transformMap && typeof transformMap === "function") {
73054
+ transformMap = transformMap(docs);
73055
+ }
73028
73056
  await fs_exports.mkdirp(pluginDir);
73029
73057
  await fs_exports.recursiveCopy(
73030
73058
  runtime_path,
73031
73059
  pluginDir,
73032
73060
  Object.fromEntries(
73033
- Object.entries(plugin2.transformRuntime ?? {}).map(([key, value]) => [
73061
+ Object.entries(transformMap).map(([key, value]) => [
73034
73062
  path_exports.join(runtime_path, key),
73035
73063
  (content) => value({ config: config4, content })
73036
73064
  ])
@@ -73470,7 +73498,8 @@ async function generateDocumentTypes(config4, docs) {
73470
73498
  originalParsed: originalDocument,
73471
73499
  name,
73472
73500
  filename,
73473
- generateArtifact
73501
+ generateArtifact,
73502
+ artifact
73474
73503
  }) => {
73475
73504
  if (!generateArtifact) {
73476
73505
  return;
@@ -73509,6 +73538,14 @@ async function generateDocumentTypes(config4, docs) {
73509
73538
  missingScalars
73510
73539
  );
73511
73540
  }
73541
+ program.body.push(
73542
+ AST11.exportNamedDeclaration(
73543
+ AST11.tsTypeAliasDeclaration(
73544
+ AST11.identifier(`${name}$artifact`),
73545
+ convertToTs(serializeValue(artifact))
73546
+ )
73547
+ )
73548
+ );
73512
73549
  await fs_exports.writeFile(typeDefPath, recast11.print(program).code);
73513
73550
  typePaths.push(typeDefPath);
73514
73551
  }
@@ -73535,18 +73572,17 @@ export * from "${module2}"
73535
73572
  `;
73536
73573
  let indexContent = recast11.print(typeIndex).code;
73537
73574
  for (const plugin2 of config4.plugins) {
73538
- if (!plugin2.indexFile) {
73539
- continue;
73575
+ if (plugin2.indexFile) {
73576
+ indexContent = plugin2.indexFile({
73577
+ config: config4,
73578
+ content: indexContent,
73579
+ exportDefaultAs,
73580
+ exportStarFrom: exportStarFrom2,
73581
+ pluginRoot: config4.pluginDirectory(plugin2.name),
73582
+ typedef: true,
73583
+ documents: docs
73584
+ });
73540
73585
  }
73541
- indexContent = plugin2.indexFile({
73542
- config: config4,
73543
- content: indexContent,
73544
- exportDefaultAs,
73545
- exportStarFrom: exportStarFrom2,
73546
- pluginRoot: config4.pluginDirectory(plugin2.name),
73547
- typedef: true,
73548
- documents: docs
73549
- });
73550
73586
  if (plugin2.includeRuntime) {
73551
73587
  indexContent += exportStarFrom2({
73552
73588
  module: "./" + path_exports.relative(config4.rootDir, config4.pluginRuntimeDirectory(plugin2.name))
@@ -73578,6 +73614,42 @@ ${[...missingScalars].map(
73578
73614
  For more information, please visit this link: ${siteURL}/api/config#custom-scalars`);
73579
73615
  }
73580
73616
  }
73617
+ function convertToTs(source) {
73618
+ if (source.type === "ObjectExpression") {
73619
+ return AST11.tsTypeLiteral(
73620
+ source.properties.reduce(
73621
+ (props, prop) => {
73622
+ if (prop.type !== "ObjectProperty" || prop.key.type !== "StringLiteral" && prop.key.type === "Identifier") {
73623
+ return props;
73624
+ }
73625
+ return [
73626
+ ...props,
73627
+ AST11.tsPropertySignature(
73628
+ prop.key,
73629
+ AST11.tsTypeAnnotation(convertToTs(prop.value))
73630
+ )
73631
+ ];
73632
+ },
73633
+ []
73634
+ )
73635
+ );
73636
+ }
73637
+ if (source.type === "ArrayExpression") {
73638
+ return AST11.tsTupleType(
73639
+ source.elements.map((element) => convertToTs(element))
73640
+ );
73641
+ }
73642
+ if (source.type === "Literal" && typeof source.value === "boolean") {
73643
+ return AST11.tsLiteralType(AST11.booleanLiteral(source.value));
73644
+ }
73645
+ if (source.type === "Literal" && typeof source.value === "number") {
73646
+ return AST11.tsLiteralType(AST11.numericLiteral(source.value));
73647
+ }
73648
+ if (source.type === "Literal" && typeof source.value === "string") {
73649
+ return AST11.tsLiteralType(AST11.stringLiteral(source.value));
73650
+ }
73651
+ return AST11.tsLiteralType(source);
73652
+ }
73581
73653
  async function generateOperationTypeDefs(config4, filepath, body, definition, selections, visitedTypes, missingScalars) {
73582
73654
  let parentType = null;
73583
73655
  if (definition.operation === "query") {
@@ -74285,9 +74357,6 @@ async function writeIndexFile2(config4, docs) {
74285
74357
  module: relative2(config4.pluginRuntimeDirectory(plugin2.name))
74286
74358
  });
74287
74359
  }
74288
- if (!plugin2.indexFile) {
74289
- continue;
74290
- }
74291
74360
  }
74292
74361
  await fs_exports.writeFile(path_exports.join(config4.rootDir, "index.js"), body);
74293
74362
  }
@@ -75553,7 +75622,10 @@ async function collectDocuments(config4) {
75553
75622
  }
75554
75623
  }
75555
75624
  } catch (err) {
75556
- throw new HoudiniError({ ...err, filepath });
75625
+ throw {
75626
+ message: err.message,
75627
+ filepath
75628
+ };
75557
75629
  }
75558
75630
  })
75559
75631
  );