houdini-svelte 0.20.2 → 0.20.3

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.
@@ -147850,6 +147850,9 @@ var FieldCollection = class {
147850
147850
  this.add(selection2);
147851
147851
  }
147852
147852
  }
147853
+ get size() {
147854
+ return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
147855
+ }
147853
147856
  add(selection2) {
147854
147857
  if (selection2.kind === "Field") {
147855
147858
  const key = selection2.alias?.value || selection2.name.value;
@@ -147918,9 +147921,12 @@ var FieldCollection = class {
147918
147921
  }
147919
147922
  }
147920
147923
  toSelectionSet() {
147921
- return Object.values(this.inlineFragments).map((fragment2) => {
147924
+ return Object.values(this.inlineFragments).flatMap((fragment2) => {
147925
+ if (fragment2.selection.size === 0) {
147926
+ return [];
147927
+ }
147922
147928
  fragment2.astNode.selectionSet.selections = fragment2.selection.toSelectionSet();
147923
- return fragment2.astNode;
147929
+ return [fragment2.astNode];
147924
147930
  }).concat(
147925
147931
  Object.values(this.fields).map((field) => {
147926
147932
  if (field.astNode.selectionSet) {
@@ -147841,6 +147841,9 @@ var FieldCollection = class {
147841
147841
  this.add(selection2);
147842
147842
  }
147843
147843
  }
147844
+ get size() {
147845
+ return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
147846
+ }
147844
147847
  add(selection2) {
147845
147848
  if (selection2.kind === "Field") {
147846
147849
  const key = selection2.alias?.value || selection2.name.value;
@@ -147909,9 +147912,12 @@ var FieldCollection = class {
147909
147912
  }
147910
147913
  }
147911
147914
  toSelectionSet() {
147912
- return Object.values(this.inlineFragments).map((fragment2) => {
147915
+ return Object.values(this.inlineFragments).flatMap((fragment2) => {
147916
+ if (fragment2.selection.size === 0) {
147917
+ return [];
147918
+ }
147913
147919
  fragment2.astNode.selectionSet.selections = fragment2.selection.toSelectionSet();
147914
- return fragment2.astNode;
147920
+ return [fragment2.astNode];
147915
147921
  }).concat(
147916
147922
  Object.values(this.fields).map((field) => {
147917
147923
  if (field.astNode.selectionSet) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-svelte",
3
- "version": "0.20.2",
3
+ "version": "0.20.3",
4
4
  "description": "The svelte plugin for houdini",
5
5
  "keywords": [
6
6
  "typescript",
@@ -31,7 +31,7 @@
31
31
  "recast": "^0.23.1",
32
32
  "svelte": "^3.55.0",
33
33
  "vite": "^4.0.1",
34
- "houdini": "^0.20.2"
34
+ "houdini": "^0.20.3"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "graphql": "^14.0.0 || ^15.0.0"