houdini 1.2.0 → 1.2.1

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.
@@ -73332,7 +73332,7 @@ function deepMerge2(filepath, ...targets) {
73332
73332
  // src/lib/parse.ts
73333
73333
  async function parseJS(str, config2) {
73334
73334
  const defaultConfig = {
73335
- plugins: ["typescript", "importAssertions", "jsx"],
73335
+ plugins: ["typescript", "importAssertions"],
73336
73336
  sourceType: "module"
73337
73337
  };
73338
73338
  return (0, import_parser.parse)(str || "", config2 ? deepMerge2("", defaultConfig, config2) : defaultConfig).program;
@@ -73673,7 +73673,8 @@ function flattenSelections({
73673
73673
  selections,
73674
73674
  fragmentDefinitions,
73675
73675
  ignoreMaskDisable,
73676
- keepFragmentSpreadNodes
73676
+ keepFragmentSpreadNodes,
73677
+ hoistFragments
73677
73678
  }) {
73678
73679
  const fields = new FieldCollection({
73679
73680
  config: config2,
@@ -73681,7 +73682,8 @@ function flattenSelections({
73681
73682
  selections,
73682
73683
  fragmentDefinitions,
73683
73684
  ignoreMaskDisable: !!ignoreMaskDisable,
73684
- keepFragmentSpreadNodes: !!keepFragmentSpreadNodes
73685
+ keepFragmentSpreadNodes: !!keepFragmentSpreadNodes,
73686
+ hoistFragments
73685
73687
  });
73686
73688
  return fields.toSelectionSet();
73687
73689
  }
@@ -73694,6 +73696,7 @@ var FieldCollection = class {
73694
73696
  fragmentSpreads;
73695
73697
  ignoreMaskDisable;
73696
73698
  keepFragmentSpreadNodes;
73699
+ hoistFragments;
73697
73700
  constructor(args) {
73698
73701
  this.config = args.config;
73699
73702
  this.fragmentDefinitions = args.fragmentDefinitions;
@@ -73702,15 +73705,32 @@ var FieldCollection = class {
73702
73705
  this.fields = {};
73703
73706
  this.inlineFragments = {};
73704
73707
  this.fragmentSpreads = {};
73708
+ this.hoistFragments = !!args.hoistFragments;
73705
73709
  this.filepath = args.filepath;
73706
73710
  for (const selection of args.selections) {
73707
- this.add(selection);
73711
+ this.add({ selection });
73708
73712
  }
73709
73713
  }
73710
73714
  get size() {
73711
73715
  return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
73712
73716
  }
73713
- add(selection) {
73717
+ add({ selection, external }) {
73718
+ let includeFragments = this.config.defaultFragmentMasking === "disable";
73719
+ const maskEnableDirective = selection.directives?.find(
73720
+ ({ name }) => name.value === this.config.maskEnableDirective
73721
+ );
73722
+ if (maskEnableDirective) {
73723
+ includeFragments = false;
73724
+ }
73725
+ const maskDisableDirective = selection.directives?.find(
73726
+ ({ name }) => name.value === this.config.maskDisableDirective
73727
+ );
73728
+ if (maskDisableDirective) {
73729
+ includeFragments = true;
73730
+ }
73731
+ if (this.ignoreMaskDisable) {
73732
+ includeFragments = true;
73733
+ }
73714
73734
  if (selection.kind === "Field") {
73715
73735
  const key = selection.alias?.value || selection.name.value;
73716
73736
  if (!this.fields[key]) {
@@ -73720,41 +73740,30 @@ var FieldCollection = class {
73720
73740
  };
73721
73741
  }
73722
73742
  for (const subselect of selection.selectionSet?.selections || []) {
73723
- this.fields[key].selection.add(subselect);
73743
+ this.fields[key].selection.add({
73744
+ selection: subselect,
73745
+ external
73746
+ });
73747
+ }
73748
+ if (!external && includeFragments) {
73749
+ this.fields[key].selection.fragmentSpreads = {
73750
+ ...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
73751
+ ...this.fields[key].selection.fragmentSpreads
73752
+ };
73724
73753
  }
73725
- this.fields[key].selection.fragmentSpreads = {
73726
- ...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
73727
- ...this.fields[key].selection.fragmentSpreads
73728
- };
73729
73754
  return;
73730
73755
  }
73731
73756
  if (selection.kind === "InlineFragment" && !selection.typeCondition) {
73732
73757
  for (const subselect of selection.selectionSet.selections) {
73733
- this.add(subselect);
73758
+ this.add({ selection: subselect, external });
73734
73759
  }
73735
73760
  }
73736
73761
  if (selection.kind === "InlineFragment" && selection.typeCondition) {
73737
- this.walkInlineFragment(selection);
73762
+ this.walkInlineFragment({ selection, external, hoistFragments: this.hoistFragments });
73738
73763
  return;
73739
73764
  }
73740
73765
  if (selection.kind === "FragmentSpread") {
73741
- let includeFragments = this.config.defaultFragmentMasking === "disable";
73742
- const maskEnableDirective = selection.directives?.find(
73743
- ({ name }) => name.value === this.config.maskEnableDirective
73744
- );
73745
- if (maskEnableDirective) {
73746
- includeFragments = false;
73747
- }
73748
- const maskDisableDirective = selection.directives?.find(
73749
- ({ name }) => name.value === this.config.maskDisableDirective
73750
- );
73751
- if (maskDisableDirective) {
73752
- includeFragments = true;
73753
- }
73754
- if (this.ignoreMaskDisable) {
73755
- includeFragments = true;
73756
- }
73757
- if (this.keepFragmentSpreadNodes) {
73766
+ if (this.keepFragmentSpreadNodes && !external) {
73758
73767
  this.fragmentSpreads[selection.name.value] = selection;
73759
73768
  }
73760
73769
  if (!includeFragments) {
@@ -73768,18 +73777,21 @@ var FieldCollection = class {
73768
73777
  });
73769
73778
  }
73770
73779
  this.add({
73771
- kind: "InlineFragment",
73772
- typeCondition: {
73773
- kind: "NamedType",
73774
- name: {
73775
- kind: "Name",
73776
- value: definition.typeCondition.name.value
73780
+ selection: {
73781
+ kind: "InlineFragment",
73782
+ typeCondition: {
73783
+ kind: "NamedType",
73784
+ name: {
73785
+ kind: "Name",
73786
+ value: definition.typeCondition.name.value
73787
+ }
73788
+ },
73789
+ selectionSet: {
73790
+ kind: "SelectionSet",
73791
+ selections: [...definition.selectionSet.selections]
73777
73792
  }
73778
73793
  },
73779
- selectionSet: {
73780
- kind: "SelectionSet",
73781
- selections: [...definition.selectionSet.selections]
73782
- }
73794
+ external
73783
73795
  });
73784
73796
  }
73785
73797
  }
@@ -73835,7 +73847,11 @@ var FieldCollection = class {
73835
73847
  })
73836
73848
  );
73837
73849
  }
73838
- walkInlineFragment(selection) {
73850
+ walkInlineFragment({
73851
+ selection,
73852
+ external,
73853
+ hoistFragments
73854
+ }) {
73839
73855
  const key = selection.typeCondition.name.value;
73840
73856
  if (!this.inlineFragments[key]) {
73841
73857
  this.inlineFragments[key] = {
@@ -73844,11 +73860,21 @@ var FieldCollection = class {
73844
73860
  };
73845
73861
  }
73846
73862
  for (const subselect of selection.selectionSet.selections || []) {
73847
- if (subselect.kind !== "InlineFragment" || !subselect.typeCondition) {
73848
- this.inlineFragments[key].selection.add(subselect);
73863
+ if (subselect.kind === "FragmentSpread" && !hoistFragments || subselect.kind === "Field" || subselect.kind === "InlineFragment" && !subselect.typeCondition) {
73864
+ this.inlineFragments[key].selection.add({
73865
+ selection: subselect,
73866
+ external
73867
+ });
73849
73868
  continue;
73869
+ } else if (subselect.kind === "FragmentSpread") {
73870
+ this.add({
73871
+ selection: subselect,
73872
+ external: true
73873
+ });
73874
+ continue;
73875
+ } else {
73876
+ this.walkInlineFragment({ selection: subselect, external, hoistFragments });
73850
73877
  }
73851
- this.walkInlineFragment(subselect);
73852
73878
  }
73853
73879
  }
73854
73880
  empty() {
@@ -73858,7 +73884,8 @@ var FieldCollection = class {
73858
73884
  selections: [],
73859
73885
  filepath: this.filepath,
73860
73886
  ignoreMaskDisable: this.ignoreMaskDisable,
73861
- keepFragmentSpreadNodes: this.keepFragmentSpreadNodes
73887
+ keepFragmentSpreadNodes: this.keepFragmentSpreadNodes,
73888
+ hoistFragments: this.hoistFragments
73862
73889
  });
73863
73890
  }
73864
73891
  };
@@ -76303,7 +76330,8 @@ function artifactGenerator(stats) {
76303
76330
  selections: selectionSet.selections,
76304
76331
  fragmentDefinitions,
76305
76332
  ignoreMaskDisable: docKind !== "HoudiniFragment",
76306
- keepFragmentSpreadNodes: true
76333
+ keepFragmentSpreadNodes: true,
76334
+ hoistFragments: true
76307
76335
  }),
76308
76336
  operations: operationsByPath(
76309
76337
  config2,
@@ -80039,8 +80067,8 @@ async function updatePackageJSON(targetPath) {
80039
80067
  }
80040
80068
  packageJSON.devDependencies = {
80041
80069
  ...packageJSON.devDependencies,
80042
- houdini: "^1.2.0",
80043
- "houdini-svelte": "^1.2.0"
80070
+ houdini: "^1.2.1",
80071
+ "houdini-svelte": "^1.2.1"
80044
80072
  };
80045
80073
  await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
80046
80074
  }
@@ -73337,7 +73337,7 @@ function deepMerge2(filepath, ...targets) {
73337
73337
  // src/lib/parse.ts
73338
73338
  async function parseJS(str, config2) {
73339
73339
  const defaultConfig = {
73340
- plugins: ["typescript", "importAssertions", "jsx"],
73340
+ plugins: ["typescript", "importAssertions"],
73341
73341
  sourceType: "module"
73342
73342
  };
73343
73343
  return (0, import_parser.parse)(str || "", config2 ? deepMerge2("", defaultConfig, config2) : defaultConfig).program;
@@ -73678,7 +73678,8 @@ function flattenSelections({
73678
73678
  selections,
73679
73679
  fragmentDefinitions,
73680
73680
  ignoreMaskDisable,
73681
- keepFragmentSpreadNodes
73681
+ keepFragmentSpreadNodes,
73682
+ hoistFragments
73682
73683
  }) {
73683
73684
  const fields = new FieldCollection({
73684
73685
  config: config2,
@@ -73686,7 +73687,8 @@ function flattenSelections({
73686
73687
  selections,
73687
73688
  fragmentDefinitions,
73688
73689
  ignoreMaskDisable: !!ignoreMaskDisable,
73689
- keepFragmentSpreadNodes: !!keepFragmentSpreadNodes
73690
+ keepFragmentSpreadNodes: !!keepFragmentSpreadNodes,
73691
+ hoistFragments
73690
73692
  });
73691
73693
  return fields.toSelectionSet();
73692
73694
  }
@@ -73699,6 +73701,7 @@ var FieldCollection = class {
73699
73701
  fragmentSpreads;
73700
73702
  ignoreMaskDisable;
73701
73703
  keepFragmentSpreadNodes;
73704
+ hoistFragments;
73702
73705
  constructor(args) {
73703
73706
  this.config = args.config;
73704
73707
  this.fragmentDefinitions = args.fragmentDefinitions;
@@ -73707,15 +73710,32 @@ var FieldCollection = class {
73707
73710
  this.fields = {};
73708
73711
  this.inlineFragments = {};
73709
73712
  this.fragmentSpreads = {};
73713
+ this.hoistFragments = !!args.hoistFragments;
73710
73714
  this.filepath = args.filepath;
73711
73715
  for (const selection of args.selections) {
73712
- this.add(selection);
73716
+ this.add({ selection });
73713
73717
  }
73714
73718
  }
73715
73719
  get size() {
73716
73720
  return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
73717
73721
  }
73718
- add(selection) {
73722
+ add({ selection, external }) {
73723
+ let includeFragments = this.config.defaultFragmentMasking === "disable";
73724
+ const maskEnableDirective = selection.directives?.find(
73725
+ ({ name }) => name.value === this.config.maskEnableDirective
73726
+ );
73727
+ if (maskEnableDirective) {
73728
+ includeFragments = false;
73729
+ }
73730
+ const maskDisableDirective = selection.directives?.find(
73731
+ ({ name }) => name.value === this.config.maskDisableDirective
73732
+ );
73733
+ if (maskDisableDirective) {
73734
+ includeFragments = true;
73735
+ }
73736
+ if (this.ignoreMaskDisable) {
73737
+ includeFragments = true;
73738
+ }
73719
73739
  if (selection.kind === "Field") {
73720
73740
  const key = selection.alias?.value || selection.name.value;
73721
73741
  if (!this.fields[key]) {
@@ -73725,41 +73745,30 @@ var FieldCollection = class {
73725
73745
  };
73726
73746
  }
73727
73747
  for (const subselect of selection.selectionSet?.selections || []) {
73728
- this.fields[key].selection.add(subselect);
73748
+ this.fields[key].selection.add({
73749
+ selection: subselect,
73750
+ external
73751
+ });
73752
+ }
73753
+ if (!external && includeFragments) {
73754
+ this.fields[key].selection.fragmentSpreads = {
73755
+ ...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
73756
+ ...this.fields[key].selection.fragmentSpreads
73757
+ };
73729
73758
  }
73730
- this.fields[key].selection.fragmentSpreads = {
73731
- ...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
73732
- ...this.fields[key].selection.fragmentSpreads
73733
- };
73734
73759
  return;
73735
73760
  }
73736
73761
  if (selection.kind === "InlineFragment" && !selection.typeCondition) {
73737
73762
  for (const subselect of selection.selectionSet.selections) {
73738
- this.add(subselect);
73763
+ this.add({ selection: subselect, external });
73739
73764
  }
73740
73765
  }
73741
73766
  if (selection.kind === "InlineFragment" && selection.typeCondition) {
73742
- this.walkInlineFragment(selection);
73767
+ this.walkInlineFragment({ selection, external, hoistFragments: this.hoistFragments });
73743
73768
  return;
73744
73769
  }
73745
73770
  if (selection.kind === "FragmentSpread") {
73746
- let includeFragments = this.config.defaultFragmentMasking === "disable";
73747
- const maskEnableDirective = selection.directives?.find(
73748
- ({ name }) => name.value === this.config.maskEnableDirective
73749
- );
73750
- if (maskEnableDirective) {
73751
- includeFragments = false;
73752
- }
73753
- const maskDisableDirective = selection.directives?.find(
73754
- ({ name }) => name.value === this.config.maskDisableDirective
73755
- );
73756
- if (maskDisableDirective) {
73757
- includeFragments = true;
73758
- }
73759
- if (this.ignoreMaskDisable) {
73760
- includeFragments = true;
73761
- }
73762
- if (this.keepFragmentSpreadNodes) {
73771
+ if (this.keepFragmentSpreadNodes && !external) {
73763
73772
  this.fragmentSpreads[selection.name.value] = selection;
73764
73773
  }
73765
73774
  if (!includeFragments) {
@@ -73773,18 +73782,21 @@ var FieldCollection = class {
73773
73782
  });
73774
73783
  }
73775
73784
  this.add({
73776
- kind: "InlineFragment",
73777
- typeCondition: {
73778
- kind: "NamedType",
73779
- name: {
73780
- kind: "Name",
73781
- value: definition.typeCondition.name.value
73785
+ selection: {
73786
+ kind: "InlineFragment",
73787
+ typeCondition: {
73788
+ kind: "NamedType",
73789
+ name: {
73790
+ kind: "Name",
73791
+ value: definition.typeCondition.name.value
73792
+ }
73793
+ },
73794
+ selectionSet: {
73795
+ kind: "SelectionSet",
73796
+ selections: [...definition.selectionSet.selections]
73782
73797
  }
73783
73798
  },
73784
- selectionSet: {
73785
- kind: "SelectionSet",
73786
- selections: [...definition.selectionSet.selections]
73787
- }
73799
+ external
73788
73800
  });
73789
73801
  }
73790
73802
  }
@@ -73840,7 +73852,11 @@ var FieldCollection = class {
73840
73852
  })
73841
73853
  );
73842
73854
  }
73843
- walkInlineFragment(selection) {
73855
+ walkInlineFragment({
73856
+ selection,
73857
+ external,
73858
+ hoistFragments
73859
+ }) {
73844
73860
  const key = selection.typeCondition.name.value;
73845
73861
  if (!this.inlineFragments[key]) {
73846
73862
  this.inlineFragments[key] = {
@@ -73849,11 +73865,21 @@ var FieldCollection = class {
73849
73865
  };
73850
73866
  }
73851
73867
  for (const subselect of selection.selectionSet.selections || []) {
73852
- if (subselect.kind !== "InlineFragment" || !subselect.typeCondition) {
73853
- this.inlineFragments[key].selection.add(subselect);
73868
+ if (subselect.kind === "FragmentSpread" && !hoistFragments || subselect.kind === "Field" || subselect.kind === "InlineFragment" && !subselect.typeCondition) {
73869
+ this.inlineFragments[key].selection.add({
73870
+ selection: subselect,
73871
+ external
73872
+ });
73854
73873
  continue;
73874
+ } else if (subselect.kind === "FragmentSpread") {
73875
+ this.add({
73876
+ selection: subselect,
73877
+ external: true
73878
+ });
73879
+ continue;
73880
+ } else {
73881
+ this.walkInlineFragment({ selection: subselect, external, hoistFragments });
73855
73882
  }
73856
- this.walkInlineFragment(subselect);
73857
73883
  }
73858
73884
  }
73859
73885
  empty() {
@@ -73863,7 +73889,8 @@ var FieldCollection = class {
73863
73889
  selections: [],
73864
73890
  filepath: this.filepath,
73865
73891
  ignoreMaskDisable: this.ignoreMaskDisable,
73866
- keepFragmentSpreadNodes: this.keepFragmentSpreadNodes
73892
+ keepFragmentSpreadNodes: this.keepFragmentSpreadNodes,
73893
+ hoistFragments: this.hoistFragments
73867
73894
  });
73868
73895
  }
73869
73896
  };
@@ -76308,7 +76335,8 @@ function artifactGenerator(stats) {
76308
76335
  selections: selectionSet.selections,
76309
76336
  fragmentDefinitions,
76310
76337
  ignoreMaskDisable: docKind !== "HoudiniFragment",
76311
- keepFragmentSpreadNodes: true
76338
+ keepFragmentSpreadNodes: true,
76339
+ hoistFragments: true
76312
76340
  }),
76313
76341
  operations: operationsByPath(
76314
76342
  config2,
@@ -80044,8 +80072,8 @@ async function updatePackageJSON(targetPath) {
80044
80072
  }
80045
80073
  packageJSON.devDependencies = {
80046
80074
  ...packageJSON.devDependencies,
80047
- houdini: "^1.2.0",
80048
- "houdini-svelte": "^1.2.0"
80075
+ houdini: "^1.2.1",
80076
+ "houdini-svelte": "^1.2.1"
80049
80077
  };
80050
80078
  await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
80051
80079
  }
@@ -1,6 +1,6 @@
1
1
  import type graphql from 'graphql';
2
2
  import type { Config } from '../../lib';
3
- export declare function flattenSelections({ config, filepath, selections, fragmentDefinitions, ignoreMaskDisable, keepFragmentSpreadNodes, }: {
3
+ export declare function flattenSelections({ config, filepath, selections, fragmentDefinitions, ignoreMaskDisable, keepFragmentSpreadNodes, hoistFragments, }: {
4
4
  config: Config;
5
5
  filepath: string;
6
6
  selections: readonly graphql.SelectionNode[];
@@ -9,4 +9,5 @@ export declare function flattenSelections({ config, filepath, selections, fragme
9
9
  };
10
10
  ignoreMaskDisable?: boolean;
11
11
  keepFragmentSpreadNodes?: boolean;
12
+ hoistFragments?: boolean;
12
13
  }): readonly graphql.SelectionNode[];
@@ -57001,7 +57001,7 @@ function deepMerge2(filepath, ...targets) {
57001
57001
  // src/lib/parse.ts
57002
57002
  async function parseJS(str, config2) {
57003
57003
  const defaultConfig = {
57004
- plugins: ["typescript", "importAssertions", "jsx"],
57004
+ plugins: ["typescript", "importAssertions"],
57005
57005
  sourceType: "module"
57006
57006
  };
57007
57007
  return (0, import_parser.parse)(str || "", config2 ? deepMerge2("", defaultConfig, config2) : defaultConfig).program;
@@ -57284,7 +57284,8 @@ function flattenSelections({
57284
57284
  selections,
57285
57285
  fragmentDefinitions,
57286
57286
  ignoreMaskDisable,
57287
- keepFragmentSpreadNodes
57287
+ keepFragmentSpreadNodes,
57288
+ hoistFragments
57288
57289
  }) {
57289
57290
  const fields = new FieldCollection({
57290
57291
  config: config2,
@@ -57292,7 +57293,8 @@ function flattenSelections({
57292
57293
  selections,
57293
57294
  fragmentDefinitions,
57294
57295
  ignoreMaskDisable: !!ignoreMaskDisable,
57295
- keepFragmentSpreadNodes: !!keepFragmentSpreadNodes
57296
+ keepFragmentSpreadNodes: !!keepFragmentSpreadNodes,
57297
+ hoistFragments
57296
57298
  });
57297
57299
  return fields.toSelectionSet();
57298
57300
  }
@@ -57305,6 +57307,7 @@ var FieldCollection = class {
57305
57307
  fragmentSpreads;
57306
57308
  ignoreMaskDisable;
57307
57309
  keepFragmentSpreadNodes;
57310
+ hoistFragments;
57308
57311
  constructor(args) {
57309
57312
  this.config = args.config;
57310
57313
  this.fragmentDefinitions = args.fragmentDefinitions;
@@ -57313,15 +57316,32 @@ var FieldCollection = class {
57313
57316
  this.fields = {};
57314
57317
  this.inlineFragments = {};
57315
57318
  this.fragmentSpreads = {};
57319
+ this.hoistFragments = !!args.hoistFragments;
57316
57320
  this.filepath = args.filepath;
57317
57321
  for (const selection of args.selections) {
57318
- this.add(selection);
57322
+ this.add({ selection });
57319
57323
  }
57320
57324
  }
57321
57325
  get size() {
57322
57326
  return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
57323
57327
  }
57324
- add(selection) {
57328
+ add({ selection, external }) {
57329
+ let includeFragments = this.config.defaultFragmentMasking === "disable";
57330
+ const maskEnableDirective = selection.directives?.find(
57331
+ ({ name }) => name.value === this.config.maskEnableDirective
57332
+ );
57333
+ if (maskEnableDirective) {
57334
+ includeFragments = false;
57335
+ }
57336
+ const maskDisableDirective = selection.directives?.find(
57337
+ ({ name }) => name.value === this.config.maskDisableDirective
57338
+ );
57339
+ if (maskDisableDirective) {
57340
+ includeFragments = true;
57341
+ }
57342
+ if (this.ignoreMaskDisable) {
57343
+ includeFragments = true;
57344
+ }
57325
57345
  if (selection.kind === "Field") {
57326
57346
  const key = selection.alias?.value || selection.name.value;
57327
57347
  if (!this.fields[key]) {
@@ -57331,41 +57351,30 @@ var FieldCollection = class {
57331
57351
  };
57332
57352
  }
57333
57353
  for (const subselect of selection.selectionSet?.selections || []) {
57334
- this.fields[key].selection.add(subselect);
57354
+ this.fields[key].selection.add({
57355
+ selection: subselect,
57356
+ external
57357
+ });
57358
+ }
57359
+ if (!external && includeFragments) {
57360
+ this.fields[key].selection.fragmentSpreads = {
57361
+ ...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
57362
+ ...this.fields[key].selection.fragmentSpreads
57363
+ };
57335
57364
  }
57336
- this.fields[key].selection.fragmentSpreads = {
57337
- ...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
57338
- ...this.fields[key].selection.fragmentSpreads
57339
- };
57340
57365
  return;
57341
57366
  }
57342
57367
  if (selection.kind === "InlineFragment" && !selection.typeCondition) {
57343
57368
  for (const subselect of selection.selectionSet.selections) {
57344
- this.add(subselect);
57369
+ this.add({ selection: subselect, external });
57345
57370
  }
57346
57371
  }
57347
57372
  if (selection.kind === "InlineFragment" && selection.typeCondition) {
57348
- this.walkInlineFragment(selection);
57373
+ this.walkInlineFragment({ selection, external, hoistFragments: this.hoistFragments });
57349
57374
  return;
57350
57375
  }
57351
57376
  if (selection.kind === "FragmentSpread") {
57352
- let includeFragments = this.config.defaultFragmentMasking === "disable";
57353
- const maskEnableDirective = selection.directives?.find(
57354
- ({ name }) => name.value === this.config.maskEnableDirective
57355
- );
57356
- if (maskEnableDirective) {
57357
- includeFragments = false;
57358
- }
57359
- const maskDisableDirective = selection.directives?.find(
57360
- ({ name }) => name.value === this.config.maskDisableDirective
57361
- );
57362
- if (maskDisableDirective) {
57363
- includeFragments = true;
57364
- }
57365
- if (this.ignoreMaskDisable) {
57366
- includeFragments = true;
57367
- }
57368
- if (this.keepFragmentSpreadNodes) {
57377
+ if (this.keepFragmentSpreadNodes && !external) {
57369
57378
  this.fragmentSpreads[selection.name.value] = selection;
57370
57379
  }
57371
57380
  if (!includeFragments) {
@@ -57379,18 +57388,21 @@ var FieldCollection = class {
57379
57388
  });
57380
57389
  }
57381
57390
  this.add({
57382
- kind: "InlineFragment",
57383
- typeCondition: {
57384
- kind: "NamedType",
57385
- name: {
57386
- kind: "Name",
57387
- value: definition.typeCondition.name.value
57391
+ selection: {
57392
+ kind: "InlineFragment",
57393
+ typeCondition: {
57394
+ kind: "NamedType",
57395
+ name: {
57396
+ kind: "Name",
57397
+ value: definition.typeCondition.name.value
57398
+ }
57399
+ },
57400
+ selectionSet: {
57401
+ kind: "SelectionSet",
57402
+ selections: [...definition.selectionSet.selections]
57388
57403
  }
57389
57404
  },
57390
- selectionSet: {
57391
- kind: "SelectionSet",
57392
- selections: [...definition.selectionSet.selections]
57393
- }
57405
+ external
57394
57406
  });
57395
57407
  }
57396
57408
  }
@@ -57446,7 +57458,11 @@ var FieldCollection = class {
57446
57458
  })
57447
57459
  );
57448
57460
  }
57449
- walkInlineFragment(selection) {
57461
+ walkInlineFragment({
57462
+ selection,
57463
+ external,
57464
+ hoistFragments
57465
+ }) {
57450
57466
  const key = selection.typeCondition.name.value;
57451
57467
  if (!this.inlineFragments[key]) {
57452
57468
  this.inlineFragments[key] = {
@@ -57455,11 +57471,21 @@ var FieldCollection = class {
57455
57471
  };
57456
57472
  }
57457
57473
  for (const subselect of selection.selectionSet.selections || []) {
57458
- if (subselect.kind !== "InlineFragment" || !subselect.typeCondition) {
57459
- this.inlineFragments[key].selection.add(subselect);
57474
+ if (subselect.kind === "FragmentSpread" && !hoistFragments || subselect.kind === "Field" || subselect.kind === "InlineFragment" && !subselect.typeCondition) {
57475
+ this.inlineFragments[key].selection.add({
57476
+ selection: subselect,
57477
+ external
57478
+ });
57460
57479
  continue;
57480
+ } else if (subselect.kind === "FragmentSpread") {
57481
+ this.add({
57482
+ selection: subselect,
57483
+ external: true
57484
+ });
57485
+ continue;
57486
+ } else {
57487
+ this.walkInlineFragment({ selection: subselect, external, hoistFragments });
57461
57488
  }
57462
- this.walkInlineFragment(subselect);
57463
57489
  }
57464
57490
  }
57465
57491
  empty() {
@@ -57469,7 +57495,8 @@ var FieldCollection = class {
57469
57495
  selections: [],
57470
57496
  filepath: this.filepath,
57471
57497
  ignoreMaskDisable: this.ignoreMaskDisable,
57472
- keepFragmentSpreadNodes: this.keepFragmentSpreadNodes
57498
+ keepFragmentSpreadNodes: this.keepFragmentSpreadNodes,
57499
+ hoistFragments: this.hoistFragments
57473
57500
  });
57474
57501
  }
57475
57502
  };
@@ -59914,7 +59941,8 @@ function artifactGenerator(stats) {
59914
59941
  selections: selectionSet.selections,
59915
59942
  fragmentDefinitions,
59916
59943
  ignoreMaskDisable: docKind !== "HoudiniFragment",
59917
- keepFragmentSpreadNodes: true
59944
+ keepFragmentSpreadNodes: true,
59945
+ hoistFragments: true
59918
59946
  }),
59919
59947
  operations: operationsByPath(
59920
59948
  config2,