houdini-svelte 1.0.4 → 1.0.6

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.
@@ -91713,9 +91713,7 @@ var CacheInternal = class {
91713
91713
  let targetSelection = getFieldsForType(selection, data2["__typename"]);
91714
91714
  for (const [field, value2] of Object.entries(data2)) {
91715
91715
  if (!selection || !targetSelection[field]) {
91716
- throw new Error(
91717
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection)
91718
- );
91716
+ continue;
91719
91717
  }
91720
91718
  let {
91721
91719
  type: linkedType,
@@ -156737,9 +156735,7 @@ var CacheInternal2 = class {
156737
156735
  let targetSelection = getFieldsForType2(selection2, data2["__typename"]);
156738
156736
  for (const [field, value2] of Object.entries(data2)) {
156739
156737
  if (!selection2 || !targetSelection[field]) {
156740
- throw new Error(
156741
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
156742
- );
156738
+ continue;
156743
156739
  }
156744
156740
  let {
156745
156741
  type: linkedType,
@@ -186459,6 +186455,13 @@ async function svelteKitGenerator(framework2, { config: config4 }) {
186459
186455
  uniqueLayoutQueries.push(layout);
186460
186456
  }
186461
186457
  }
186458
+ if (!config4.include.some((path3) => path3.includes("js")) && (!plugin_config(config4).static || uniquePageQueries.length > 0 || uniqueLayoutQueries.length > 0)) {
186459
+ console.error(
186460
+ `\u26A0\uFE0F You are using at least one page/layout query but aren't "include"ing .js files in your config.
186461
+
186462
+ This will cause houdini to not pick up the generated files and prevent it from working as expected.`
186463
+ );
186464
+ }
186462
186465
  let skTypeString = await fs_exports.readFile(svelteTypeFilePath);
186463
186466
  if (skTypeString) {
186464
186467
  const pageTypeImports = getTypeImports(houdiniRelative, config4, uniquePageQueries);
@@ -91708,9 +91708,7 @@ var CacheInternal = class {
91708
91708
  let targetSelection = getFieldsForType(selection, data2["__typename"]);
91709
91709
  for (const [field, value2] of Object.entries(data2)) {
91710
91710
  if (!selection || !targetSelection[field]) {
91711
- throw new Error(
91712
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection)
91713
- );
91711
+ continue;
91714
91712
  }
91715
91713
  let {
91716
91714
  type: linkedType,
@@ -156731,9 +156729,7 @@ var CacheInternal2 = class {
156731
156729
  let targetSelection = getFieldsForType2(selection2, data2["__typename"]);
156732
156730
  for (const [field, value2] of Object.entries(data2)) {
156733
156731
  if (!selection2 || !targetSelection[field]) {
156734
- throw new Error(
156735
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
156736
- );
156732
+ continue;
156737
156733
  }
156738
156734
  let {
156739
156735
  type: linkedType,
@@ -186453,6 +186449,13 @@ async function svelteKitGenerator(framework2, { config: config4 }) {
186453
186449
  uniqueLayoutQueries.push(layout);
186454
186450
  }
186455
186451
  }
186452
+ if (!config4.include.some((path3) => path3.includes("js")) && (!plugin_config(config4).static || uniquePageQueries.length > 0 || uniqueLayoutQueries.length > 0)) {
186453
+ console.error(
186454
+ `\u26A0\uFE0F You are using at least one page/layout query but aren't "include"ing .js files in your config.
186455
+
186456
+ This will cause houdini to not pick up the generated files and prevent it from working as expected.`
186457
+ );
186458
+ }
186456
186459
  let skTypeString = await fs_exports.readFile(svelteTypeFilePath);
186457
186460
  if (skTypeString) {
186458
186461
  const pageTypeImports = getTypeImports(houdiniRelative, config4, uniquePageQueries);
@@ -94906,9 +94906,7 @@ var CacheInternal = class {
94906
94906
  let targetSelection = getFieldsForType(selection, data2["__typename"]);
94907
94907
  for (const [field, value2] of Object.entries(data2)) {
94908
94908
  if (!selection || !targetSelection[field]) {
94909
- throw new Error(
94910
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection)
94911
- );
94909
+ continue;
94912
94910
  }
94913
94911
  let {
94914
94912
  type: linkedType,
@@ -188590,9 +188588,7 @@ var CacheInternal2 = class {
188590
188588
  let targetSelection = getFieldsForType2(selection2, data2["__typename"]);
188591
188589
  for (const [field, value2] of Object.entries(data2)) {
188592
188590
  if (!selection2 || !targetSelection[field]) {
188593
- throw new Error(
188594
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
188595
- );
188591
+ continue;
188596
188592
  }
188597
188593
  let {
188598
188594
  type: linkedType,
@@ -94899,9 +94899,7 @@ var CacheInternal = class {
94899
94899
  let targetSelection = getFieldsForType(selection, data2["__typename"]);
94900
94900
  for (const [field, value2] of Object.entries(data2)) {
94901
94901
  if (!selection || !targetSelection[field]) {
94902
- throw new Error(
94903
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection)
94904
- );
94902
+ continue;
94905
94903
  }
94906
94904
  let {
94907
94905
  type: linkedType,
@@ -188582,9 +188580,7 @@ var CacheInternal2 = class {
188582
188580
  let targetSelection = getFieldsForType2(selection2, data2["__typename"]);
188583
188581
  for (const [field, value2] of Object.entries(data2)) {
188584
188582
  if (!selection2 || !targetSelection[field]) {
188585
- throw new Error(
188586
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
188587
- );
188583
+ continue;
188588
188584
  }
188589
188585
  let {
188590
188586
  type: linkedType,
@@ -91716,9 +91716,7 @@ var CacheInternal = class {
91716
91716
  let targetSelection = getFieldsForType(selection2, data2["__typename"]);
91717
91717
  for (const [field, value2] of Object.entries(data2)) {
91718
91718
  if (!selection2 || !targetSelection[field]) {
91719
- throw new Error(
91720
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
91721
- );
91719
+ continue;
91722
91720
  }
91723
91721
  let {
91724
91722
  type: linkedType,
@@ -147985,9 +147983,7 @@ var CacheInternal2 = class {
147985
147983
  let targetSelection = getFieldsForType2(selection2, data2["__typename"]);
147986
147984
  for (const [field, value2] of Object.entries(data2)) {
147987
147985
  if (!selection2 || !targetSelection[field]) {
147988
- throw new Error(
147989
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
147990
- );
147986
+ continue;
147991
147987
  }
147992
147988
  let {
147993
147989
  type: linkedType,
@@ -152685,41 +152681,55 @@ async function addID(config22, documents) {
152685
152681
  );
152686
152682
  const field = type.getFields()[node2.name.value];
152687
152683
  const fieldType = unwrapType2(config22, field.type).type;
152688
- if (node2.selectionSet?.selections.length > 0) {
152689
- if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
152690
- return;
152691
- }
152692
- const keyFields = config22.keyFieldsForType(fieldType.name);
152693
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
152694
- return;
152695
- }
152696
- const selections = [...node2.selectionSet.selections];
152697
- for (const keyField of keyFields) {
152698
- if (node2.selectionSet.selections.find(
152699
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
152700
- )) {
152701
- continue;
152702
- }
152703
- selections.push({
152704
- kind: graphql23.Kind.FIELD,
152705
- name: {
152706
- kind: graphql23.Kind.NAME,
152707
- value: keyField
152708
- }
152709
- });
152710
- }
152711
- return {
152712
- ...node2,
152713
- selectionSet: {
152714
- ...node2.selectionSet,
152715
- selections
152716
- }
152717
- };
152684
+ return addKeysToSelection(config22, node2, fieldType);
152685
+ },
152686
+ InlineFragment(node2) {
152687
+ if (!node2.selectionSet || !node2.typeCondition) {
152688
+ return;
152689
+ }
152690
+ const fragmentType = config22.schema.getType(node2.typeCondition.name.value);
152691
+ if (!fragmentType) {
152692
+ return;
152718
152693
  }
152694
+ return addKeysToSelection(config22, node2, fragmentType);
152719
152695
  }
152720
152696
  });
152721
152697
  }
152722
152698
  }
152699
+ function addKeysToSelection(config22, node2, fieldType) {
152700
+ if (!node2.selectionSet || node2.selectionSet.selections.length == 0) {
152701
+ return;
152702
+ }
152703
+ if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
152704
+ return;
152705
+ }
152706
+ const keyFields = config22.keyFieldsForType(fieldType.name);
152707
+ if (keyFields.find((key) => !fieldType.getFields()[key])) {
152708
+ return;
152709
+ }
152710
+ const selections = [...node2.selectionSet.selections];
152711
+ for (const keyField of keyFields) {
152712
+ if (node2.selectionSet.selections.find(
152713
+ (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
152714
+ )) {
152715
+ continue;
152716
+ }
152717
+ selections.push({
152718
+ kind: graphql23.Kind.FIELD,
152719
+ name: {
152720
+ kind: graphql23.Kind.NAME,
152721
+ value: keyField
152722
+ }
152723
+ });
152724
+ }
152725
+ return {
152726
+ ...node2,
152727
+ selectionSet: {
152728
+ ...node2.selectionSet,
152729
+ selections
152730
+ }
152731
+ };
152732
+ }
152723
152733
  var graphql24 = __toESM3(require_graphql22(), 1);
152724
152734
  async function typeCheck(config22, docs) {
152725
152735
  const errors = [];
@@ -209049,9 +209059,7 @@ var CacheInternal3 = class {
209049
209059
  let targetSelection = getFieldsForType3(selection2, data2["__typename"]);
209050
209060
  for (const [field, value2] of Object.entries(data2)) {
209051
209061
  if (!selection2 || !targetSelection[field]) {
209052
- throw new Error(
209053
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
209054
- );
209062
+ continue;
209055
209063
  }
209056
209064
  let {
209057
209065
  type: linkedType,
@@ -274720,9 +274728,7 @@ var CacheInternal4 = class {
274720
274728
  let targetSelection = getFieldsForType4(selection2, data2["__typename"]);
274721
274729
  for (const [field, value2] of Object.entries(data2)) {
274722
274730
  if (!selection2 || !targetSelection[field]) {
274723
- throw new Error(
274724
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
274725
- );
274731
+ continue;
274726
274732
  }
274727
274733
  let {
274728
274734
  type: linkedType,
@@ -304442,6 +304448,13 @@ async function svelteKitGenerator(framework2, { config: config5 }) {
304442
304448
  uniqueLayoutQueries.push(layout);
304443
304449
  }
304444
304450
  }
304451
+ if (!config5.include.some((path5) => path5.includes("js")) && (!plugin_config(config5).static || uniquePageQueries.length > 0 || uniqueLayoutQueries.length > 0)) {
304452
+ console.error(
304453
+ `\u26A0\uFE0F You are using at least one page/layout query but aren't "include"ing .js files in your config.
304454
+
304455
+ This will cause houdini to not pick up the generated files and prevent it from working as expected.`
304456
+ );
304457
+ }
304445
304458
  let skTypeString = await fs_exports.readFile(svelteTypeFilePath);
304446
304459
  if (skTypeString) {
304447
304460
  const pageTypeImports = getTypeImports(houdiniRelative, config5, uniquePageQueries);
@@ -91708,9 +91708,7 @@ var CacheInternal = class {
91708
91708
  let targetSelection = getFieldsForType(selection2, data2["__typename"]);
91709
91709
  for (const [field, value2] of Object.entries(data2)) {
91710
91710
  if (!selection2 || !targetSelection[field]) {
91711
- throw new Error(
91712
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
91713
- );
91711
+ continue;
91714
91712
  }
91715
91713
  let {
91716
91714
  type: linkedType,
@@ -147976,9 +147974,7 @@ var CacheInternal2 = class {
147976
147974
  let targetSelection = getFieldsForType2(selection2, data2["__typename"]);
147977
147975
  for (const [field, value2] of Object.entries(data2)) {
147978
147976
  if (!selection2 || !targetSelection[field]) {
147979
- throw new Error(
147980
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
147981
- );
147977
+ continue;
147982
147978
  }
147983
147979
  let {
147984
147980
  type: linkedType,
@@ -152676,41 +152672,55 @@ async function addID(config22, documents) {
152676
152672
  );
152677
152673
  const field = type.getFields()[node2.name.value];
152678
152674
  const fieldType = unwrapType2(config22, field.type).type;
152679
- if (node2.selectionSet?.selections.length > 0) {
152680
- if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
152681
- return;
152682
- }
152683
- const keyFields = config22.keyFieldsForType(fieldType.name);
152684
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
152685
- return;
152686
- }
152687
- const selections = [...node2.selectionSet.selections];
152688
- for (const keyField of keyFields) {
152689
- if (node2.selectionSet.selections.find(
152690
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
152691
- )) {
152692
- continue;
152693
- }
152694
- selections.push({
152695
- kind: graphql23.Kind.FIELD,
152696
- name: {
152697
- kind: graphql23.Kind.NAME,
152698
- value: keyField
152699
- }
152700
- });
152701
- }
152702
- return {
152703
- ...node2,
152704
- selectionSet: {
152705
- ...node2.selectionSet,
152706
- selections
152707
- }
152708
- };
152675
+ return addKeysToSelection(config22, node2, fieldType);
152676
+ },
152677
+ InlineFragment(node2) {
152678
+ if (!node2.selectionSet || !node2.typeCondition) {
152679
+ return;
152680
+ }
152681
+ const fragmentType = config22.schema.getType(node2.typeCondition.name.value);
152682
+ if (!fragmentType) {
152683
+ return;
152709
152684
  }
152685
+ return addKeysToSelection(config22, node2, fragmentType);
152710
152686
  }
152711
152687
  });
152712
152688
  }
152713
152689
  }
152690
+ function addKeysToSelection(config22, node2, fieldType) {
152691
+ if (!node2.selectionSet || node2.selectionSet.selections.length == 0) {
152692
+ return;
152693
+ }
152694
+ if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
152695
+ return;
152696
+ }
152697
+ const keyFields = config22.keyFieldsForType(fieldType.name);
152698
+ if (keyFields.find((key) => !fieldType.getFields()[key])) {
152699
+ return;
152700
+ }
152701
+ const selections = [...node2.selectionSet.selections];
152702
+ for (const keyField of keyFields) {
152703
+ if (node2.selectionSet.selections.find(
152704
+ (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
152705
+ )) {
152706
+ continue;
152707
+ }
152708
+ selections.push({
152709
+ kind: graphql23.Kind.FIELD,
152710
+ name: {
152711
+ kind: graphql23.Kind.NAME,
152712
+ value: keyField
152713
+ }
152714
+ });
152715
+ }
152716
+ return {
152717
+ ...node2,
152718
+ selectionSet: {
152719
+ ...node2.selectionSet,
152720
+ selections
152721
+ }
152722
+ };
152723
+ }
152714
152724
  var graphql24 = __toESM3(require_graphql22(), 1);
152715
152725
  async function typeCheck(config22, docs) {
152716
152726
  const errors = [];
@@ -209039,9 +209049,7 @@ var CacheInternal3 = class {
209039
209049
  let targetSelection = getFieldsForType3(selection2, data2["__typename"]);
209040
209050
  for (const [field, value2] of Object.entries(data2)) {
209041
209051
  if (!selection2 || !targetSelection[field]) {
209042
- throw new Error(
209043
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
209044
- );
209052
+ continue;
209045
209053
  }
209046
209054
  let {
209047
209055
  type: linkedType,
@@ -274709,9 +274717,7 @@ var CacheInternal4 = class {
274709
274717
  let targetSelection = getFieldsForType4(selection2, data2["__typename"]);
274710
274718
  for (const [field, value2] of Object.entries(data2)) {
274711
274719
  if (!selection2 || !targetSelection[field]) {
274712
- throw new Error(
274713
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
274714
- );
274720
+ continue;
274715
274721
  }
274716
274722
  let {
274717
274723
  type: linkedType,
@@ -304431,6 +304437,13 @@ async function svelteKitGenerator(framework2, { config: config5 }) {
304431
304437
  uniqueLayoutQueries.push(layout);
304432
304438
  }
304433
304439
  }
304440
+ if (!config5.include.some((path5) => path5.includes("js")) && (!plugin_config(config5).static || uniquePageQueries.length > 0 || uniqueLayoutQueries.length > 0)) {
304441
+ console.error(
304442
+ `\u26A0\uFE0F You are using at least one page/layout query but aren't "include"ing .js files in your config.
304443
+
304444
+ This will cause houdini to not pick up the generated files and prevent it from working as expected.`
304445
+ );
304446
+ }
304434
304447
  let skTypeString = await fs_exports.readFile(svelteTypeFilePath);
304435
304448
  if (skTypeString) {
304436
304449
  const pageTypeImports = getTypeImports(houdiniRelative, config5, uniquePageQueries);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-svelte",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "The svelte plugin for houdini",
5
5
  "keywords": [
6
6
  "typescript",
@@ -32,7 +32,7 @@
32
32
  "rollup": "^3.7.4",
33
33
  "svelte": "^3.55.1",
34
34
  "vite": "^4.1.1",
35
- "houdini": "^1.0.4"
35
+ "houdini": "^1.0.6"
36
36
  },
37
37
  "files": [
38
38
  "build"