houdini 1.2.45 → 1.2.47

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 (32) hide show
  1. package/build/cmd-cjs/index.js +42 -12
  2. package/build/cmd-esm/index.js +42 -12
  3. package/build/codegen-cjs/index.js +40 -10
  4. package/build/codegen-esm/index.js +40 -10
  5. package/build/lib-cjs/index.js +91 -12
  6. package/build/lib-esm/index.js +91 -12
  7. package/build/runtime/cache/cache.d.ts +1 -1
  8. package/build/runtime/cache/subscription.d.ts +1 -0
  9. package/build/runtime/router/match.d.ts +3 -2
  10. package/build/runtime-cjs/cache/cache.d.ts +1 -1
  11. package/build/runtime-cjs/cache/cache.js +7 -4
  12. package/build/runtime-cjs/cache/subscription.d.ts +1 -0
  13. package/build/runtime-cjs/cache/subscription.js +20 -2
  14. package/build/runtime-cjs/client/plugins/cache.js +1 -1
  15. package/build/runtime-cjs/client/plugins/fetchParams.js +1 -1
  16. package/build/runtime-cjs/router/match.d.ts +3 -2
  17. package/build/runtime-cjs/router/match.js +13 -2
  18. package/build/runtime-cjs/router/server.js +1 -1
  19. package/build/runtime-esm/cache/cache.d.ts +1 -1
  20. package/build/runtime-esm/cache/cache.js +7 -4
  21. package/build/runtime-esm/cache/subscription.d.ts +1 -0
  22. package/build/runtime-esm/cache/subscription.js +20 -2
  23. package/build/runtime-esm/client/plugins/cache.js +1 -1
  24. package/build/runtime-esm/client/plugins/fetchParams.js +1 -1
  25. package/build/runtime-esm/router/match.d.ts +3 -2
  26. package/build/runtime-esm/router/match.js +13 -2
  27. package/build/runtime-esm/router/server.js +1 -1
  28. package/build/test-cjs/index.js +40 -10
  29. package/build/test-esm/index.js +40 -10
  30. package/build/vite-cjs/index.js +52 -11
  31. package/build/vite-esm/index.js +52 -11
  32. package/package.json +1 -1
@@ -45,4 +45,5 @@ export declare class InMemorySubscriptions {
45
45
  reset(): SubscriptionSpec[];
46
46
  private removeSubscribers;
47
47
  removeAllSubscribers(id: string, targets?: SubscriptionSpec[], visited?: string[]): void;
48
+ get size(): number;
48
49
  }
@@ -230,9 +230,12 @@ class InMemorySubscriptions {
230
230
  removeSubscribers(id, fieldName, specs) {
231
231
  let targets = [];
232
232
  const subscriber = this.subscribers.get(id);
233
- const subscriberField = subscriber?.get(fieldName);
233
+ if (!subscriber) {
234
+ return;
235
+ }
236
+ const subscriberField = subscriber.get(fieldName);
234
237
  for (const spec of specs) {
235
- const counts = subscriber?.get(fieldName)?.referenceCounts;
238
+ const counts = subscriber.get(fieldName)?.referenceCounts;
236
239
  if (!counts?.has(spec.set)) {
237
240
  continue;
238
241
  }
@@ -242,12 +245,18 @@ class InMemorySubscriptions {
242
245
  targets.push(spec.set);
243
246
  counts.delete(spec.set);
244
247
  }
248
+ if (counts.size === 0) {
249
+ subscriber.delete(fieldName);
250
+ }
245
251
  }
246
252
  if (subscriberField) {
247
253
  subscriberField.selections = this.get(id, fieldName).filter(
248
254
  ([{ set }]) => !targets.includes(set)
249
255
  );
250
256
  }
257
+ if (subscriber.size === 0) {
258
+ this.subscribers.delete(id);
259
+ }
251
260
  }
252
261
  removeAllSubscribers(id, targets, visited = []) {
253
262
  visited.push(id);
@@ -268,6 +277,15 @@ class InMemorySubscriptions {
268
277
  }
269
278
  }
270
279
  }
280
+ get size() {
281
+ let size = 0;
282
+ for (const [, nodeCounts] of this.subscribers) {
283
+ for (const [, { referenceCounts }] of nodeCounts) {
284
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
285
+ }
286
+ }
287
+ return size;
288
+ }
271
289
  }
272
290
  export {
273
291
  InMemorySubscriptions
@@ -9,7 +9,7 @@ const cachePolicy = ({
9
9
  serverSideFallback = true
10
10
  }) => () => {
11
11
  return {
12
- network(ctx, { initialValue, next, resolve, marshalVariables }) {
12
+ beforeNetwork(ctx, { initialValue, next, resolve, marshalVariables }) {
13
13
  const { policy, artifact } = ctx;
14
14
  let useCache = false;
15
15
  if (enabled && (artifact.kind === ArtifactKind.Query || artifact.kind === ArtifactKind.Fragment) && !ctx.cacheParams?.disableRead) {
@@ -1,5 +1,5 @@
1
1
  const fetchParams = (fn = () => ({})) => () => ({
2
- beforeNetwork(ctx, { next, marshalVariables }) {
2
+ start(ctx, { next, marshalVariables }) {
3
3
  next({
4
4
  ...ctx,
5
5
  fetchParams: fn({
@@ -1,4 +1,5 @@
1
1
  import type { GraphQLVariables } from '$houdini/runtime/lib/types';
2
+ import { type ConfigFile } from '../lib';
2
3
  import type { RouterManifest, RouterPageManifest } from './types';
3
4
  export type RouteParam = {
4
5
  name: string;
@@ -10,8 +11,8 @@ export type RouteParam = {
10
11
  export interface ParamMatcher {
11
12
  (param: string): boolean;
12
13
  }
13
- export declare function find_match<_ComponentType>(manifest: RouterManifest<_ComponentType>, current: string, allowNull: true): [RouterPageManifest<_ComponentType> | null, GraphQLVariables];
14
- export declare function find_match<_ComponentType>(manifest: RouterManifest<_ComponentType>, current: string, allowNull?: false): [RouterPageManifest<_ComponentType>, GraphQLVariables];
14
+ export declare function find_match<_ComponentType>(config: ConfigFile, manifest: RouterManifest<_ComponentType>, current: string, allowNull: true): [RouterPageManifest<_ComponentType> | null, GraphQLVariables];
15
+ export declare function find_match<_ComponentType>(config: ConfigFile, manifest: RouterManifest<_ComponentType>, current: string, allowNull?: false): [RouterPageManifest<_ComponentType>, GraphQLVariables];
15
16
  /**
16
17
  * Creates the regex pattern, extracts parameter names, and generates types for a route
17
18
  */
@@ -1,5 +1,6 @@
1
+ import { parseScalar } from "../lib";
1
2
  const param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
2
- function find_match(manifest, current, allowNull = true) {
3
+ function find_match(config, manifest, current, allowNull = true) {
3
4
  let match = null;
4
5
  let matchVariables = null;
5
6
  for (const page of Object.values(manifest.pages)) {
@@ -14,7 +15,17 @@ function find_match(manifest, current, allowNull = true) {
14
15
  if (!match && !allowNull) {
15
16
  throw new Error("404");
16
17
  }
17
- return [match, matchVariables];
18
+ let variables = {
19
+ ...matchVariables
20
+ };
21
+ for (const document of Object.values(match?.documents ?? {})) {
22
+ for (const [variable, { type }] of Object.entries(document.variables)) {
23
+ if (matchVariables?.[variable]) {
24
+ variables[variable] = parseScalar(config, type, matchVariables[variable]);
25
+ }
26
+ }
27
+ }
28
+ return [match, variables];
18
29
  }
19
30
  function parse_page_pattern(id) {
20
31
  const params = [];
@@ -49,7 +49,7 @@ function _serverHandler({
49
49
  if (authResponse) {
50
50
  return authResponse;
51
51
  }
52
- const [match] = find_match(manifest, url);
52
+ const [match] = find_match(config_file, manifest, url);
53
53
  const rendered = await on_render({
54
54
  url,
55
55
  match,
@@ -55646,9 +55646,12 @@ var InMemorySubscriptions = class {
55646
55646
  removeSubscribers(id, fieldName, specs) {
55647
55647
  let targets = [];
55648
55648
  const subscriber = this.subscribers.get(id);
55649
- const subscriberField = subscriber?.get(fieldName);
55649
+ if (!subscriber) {
55650
+ return;
55651
+ }
55652
+ const subscriberField = subscriber.get(fieldName);
55650
55653
  for (const spec of specs) {
55651
- const counts = subscriber?.get(fieldName)?.referenceCounts;
55654
+ const counts = subscriber.get(fieldName)?.referenceCounts;
55652
55655
  if (!counts?.has(spec.set)) {
55653
55656
  continue;
55654
55657
  }
@@ -55658,12 +55661,18 @@ var InMemorySubscriptions = class {
55658
55661
  targets.push(spec.set);
55659
55662
  counts.delete(spec.set);
55660
55663
  }
55664
+ if (counts.size === 0) {
55665
+ subscriber.delete(fieldName);
55666
+ }
55661
55667
  }
55662
55668
  if (subscriberField) {
55663
55669
  subscriberField.selections = this.get(id, fieldName).filter(
55664
55670
  ([{ set }]) => !targets.includes(set)
55665
55671
  );
55666
55672
  }
55673
+ if (subscriber.size === 0) {
55674
+ this.subscribers.delete(id);
55675
+ }
55667
55676
  }
55668
55677
  removeAllSubscribers(id, targets, visited = []) {
55669
55678
  visited.push(id);
@@ -55684,6 +55693,15 @@ var InMemorySubscriptions = class {
55684
55693
  }
55685
55694
  }
55686
55695
  }
55696
+ get size() {
55697
+ let size = 0;
55698
+ for (const [, nodeCounts] of this.subscribers) {
55699
+ for (const [, { referenceCounts }] of nodeCounts) {
55700
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
55701
+ }
55702
+ }
55703
+ return size;
55704
+ }
55687
55705
  };
55688
55706
 
55689
55707
  // src/runtime/cache/cache.ts
@@ -55732,6 +55750,9 @@ var Cache = class {
55732
55750
  };
55733
55751
  }
55734
55752
  subscribe(spec, variables = {}) {
55753
+ if (this._internal_unstable.disabled) {
55754
+ return;
55755
+ }
55735
55756
  return this._internal_unstable.subscriptions.add({
55736
55757
  parent: spec.parentID || rootID,
55737
55758
  spec,
@@ -55871,7 +55892,7 @@ var Cache = class {
55871
55892
  }
55872
55893
  };
55873
55894
  var CacheInternal = class {
55874
- _disabled = false;
55895
+ disabled = false;
55875
55896
  _config;
55876
55897
  storage;
55877
55898
  subscriptions;
@@ -55902,10 +55923,10 @@ var CacheInternal = class {
55902
55923
  this._config = config;
55903
55924
  this.componentCache = componentCache ?? {};
55904
55925
  this.createComponent = createComponent ?? (() => ({}));
55905
- this._disabled = disabled;
55926
+ this.disabled = disabled;
55906
55927
  try {
55907
55928
  if (process.env.HOUDINI_TEST === "true") {
55908
- this._disabled = false;
55929
+ this.disabled = false;
55909
55930
  }
55910
55931
  } catch {
55911
55932
  }
@@ -55927,7 +55948,7 @@ var CacheInternal = class {
55927
55948
  forceNotify,
55928
55949
  forceStale
55929
55950
  }) {
55930
- if (this._disabled) {
55951
+ if (this.disabled) {
55931
55952
  return [];
55932
55953
  }
55933
55954
  let targetSelection = getFieldsForType(
@@ -57486,7 +57507,12 @@ function deepMerge2(filepath, ...targets) {
57486
57507
  // src/lib/parse.ts
57487
57508
  function parseJS(str, config) {
57488
57509
  const defaultConfig = {
57489
- plugins: ["typescript", "importAssertions", "decorators-legacy"],
57510
+ plugins: [
57511
+ "typescript",
57512
+ "importAssertions",
57513
+ "decorators-legacy",
57514
+ "explicitResourceManagement"
57515
+ ],
57490
57516
  sourceType: "module"
57491
57517
  };
57492
57518
  return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
@@ -58788,7 +58814,11 @@ function operationsByPath(config, filepath, definition, filterTypes) {
58788
58814
  const pathOperations = {};
58789
58815
  graphql11.visit(definition, {
58790
58816
  FragmentSpread(node, _, __, ___, ancestors) {
58791
- if (!config.isListFragment(node.name.value)) {
58817
+ let nameWithoutHash = node.name.value;
58818
+ if (node.directives && node.directives.find((directive) => directive.name.value === "with")) {
58819
+ nameWithoutHash = nameWithoutHash.substring(0, nameWithoutHash.lastIndexOf("_"));
58820
+ }
58821
+ if (!config.isListFragment(nameWithoutHash)) {
58792
58822
  return;
58793
58823
  }
58794
58824
  const path2 = ancestorKey(ancestors);
@@ -58799,8 +58829,8 @@ function operationsByPath(config, filepath, definition, filterTypes) {
58799
58829
  operationObject({
58800
58830
  config,
58801
58831
  filepath,
58802
- listName: config.listNameFromFragment(node.name.value),
58803
- operationKind: config.listOperationFromFragment(node.name.value),
58832
+ listName: config.listNameFromFragment(nameWithoutHash),
58833
+ operationKind: config.listOperationFromFragment(nameWithoutHash),
58804
58834
  type: parentTypeFromAncestors(config.schema, filepath, ancestors).name,
58805
58835
  selection: node
58806
58836
  })
@@ -55643,9 +55643,12 @@ var InMemorySubscriptions = class {
55643
55643
  removeSubscribers(id, fieldName, specs) {
55644
55644
  let targets = [];
55645
55645
  const subscriber = this.subscribers.get(id);
55646
- const subscriberField = subscriber?.get(fieldName);
55646
+ if (!subscriber) {
55647
+ return;
55648
+ }
55649
+ const subscriberField = subscriber.get(fieldName);
55647
55650
  for (const spec of specs) {
55648
- const counts = subscriber?.get(fieldName)?.referenceCounts;
55651
+ const counts = subscriber.get(fieldName)?.referenceCounts;
55649
55652
  if (!counts?.has(spec.set)) {
55650
55653
  continue;
55651
55654
  }
@@ -55655,12 +55658,18 @@ var InMemorySubscriptions = class {
55655
55658
  targets.push(spec.set);
55656
55659
  counts.delete(spec.set);
55657
55660
  }
55661
+ if (counts.size === 0) {
55662
+ subscriber.delete(fieldName);
55663
+ }
55658
55664
  }
55659
55665
  if (subscriberField) {
55660
55666
  subscriberField.selections = this.get(id, fieldName).filter(
55661
55667
  ([{ set }]) => !targets.includes(set)
55662
55668
  );
55663
55669
  }
55670
+ if (subscriber.size === 0) {
55671
+ this.subscribers.delete(id);
55672
+ }
55664
55673
  }
55665
55674
  removeAllSubscribers(id, targets, visited = []) {
55666
55675
  visited.push(id);
@@ -55681,6 +55690,15 @@ var InMemorySubscriptions = class {
55681
55690
  }
55682
55691
  }
55683
55692
  }
55693
+ get size() {
55694
+ let size = 0;
55695
+ for (const [, nodeCounts] of this.subscribers) {
55696
+ for (const [, { referenceCounts }] of nodeCounts) {
55697
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
55698
+ }
55699
+ }
55700
+ return size;
55701
+ }
55684
55702
  };
55685
55703
 
55686
55704
  // src/runtime/cache/cache.ts
@@ -55729,6 +55747,9 @@ var Cache = class {
55729
55747
  };
55730
55748
  }
55731
55749
  subscribe(spec, variables = {}) {
55750
+ if (this._internal_unstable.disabled) {
55751
+ return;
55752
+ }
55732
55753
  return this._internal_unstable.subscriptions.add({
55733
55754
  parent: spec.parentID || rootID,
55734
55755
  spec,
@@ -55868,7 +55889,7 @@ var Cache = class {
55868
55889
  }
55869
55890
  };
55870
55891
  var CacheInternal = class {
55871
- _disabled = false;
55892
+ disabled = false;
55872
55893
  _config;
55873
55894
  storage;
55874
55895
  subscriptions;
@@ -55899,10 +55920,10 @@ var CacheInternal = class {
55899
55920
  this._config = config;
55900
55921
  this.componentCache = componentCache ?? {};
55901
55922
  this.createComponent = createComponent ?? (() => ({}));
55902
- this._disabled = disabled;
55923
+ this.disabled = disabled;
55903
55924
  try {
55904
55925
  if (process.env.HOUDINI_TEST === "true") {
55905
- this._disabled = false;
55926
+ this.disabled = false;
55906
55927
  }
55907
55928
  } catch {
55908
55929
  }
@@ -55924,7 +55945,7 @@ var CacheInternal = class {
55924
55945
  forceNotify,
55925
55946
  forceStale
55926
55947
  }) {
55927
- if (this._disabled) {
55948
+ if (this.disabled) {
55928
55949
  return [];
55929
55950
  }
55930
55951
  let targetSelection = getFieldsForType(
@@ -57482,7 +57503,12 @@ function deepMerge2(filepath, ...targets) {
57482
57503
  // src/lib/parse.ts
57483
57504
  function parseJS(str, config) {
57484
57505
  const defaultConfig = {
57485
- plugins: ["typescript", "importAssertions", "decorators-legacy"],
57506
+ plugins: [
57507
+ "typescript",
57508
+ "importAssertions",
57509
+ "decorators-legacy",
57510
+ "explicitResourceManagement"
57511
+ ],
57486
57512
  sourceType: "module"
57487
57513
  };
57488
57514
  return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
@@ -58784,7 +58810,11 @@ function operationsByPath(config, filepath, definition, filterTypes) {
58784
58810
  const pathOperations = {};
58785
58811
  graphql11.visit(definition, {
58786
58812
  FragmentSpread(node, _, __, ___, ancestors) {
58787
- if (!config.isListFragment(node.name.value)) {
58813
+ let nameWithoutHash = node.name.value;
58814
+ if (node.directives && node.directives.find((directive) => directive.name.value === "with")) {
58815
+ nameWithoutHash = nameWithoutHash.substring(0, nameWithoutHash.lastIndexOf("_"));
58816
+ }
58817
+ if (!config.isListFragment(nameWithoutHash)) {
58788
58818
  return;
58789
58819
  }
58790
58820
  const path2 = ancestorKey(ancestors);
@@ -58795,8 +58825,8 @@ function operationsByPath(config, filepath, definition, filterTypes) {
58795
58825
  operationObject({
58796
58826
  config,
58797
58827
  filepath,
58798
- listName: config.listNameFromFragment(node.name.value),
58799
- operationKind: config.listOperationFromFragment(node.name.value),
58828
+ listName: config.listNameFromFragment(nameWithoutHash),
58829
+ operationKind: config.listOperationFromFragment(nameWithoutHash),
58800
58830
  type: parentTypeFromAncestors(config.schema, filepath, ancestors).name,
58801
58831
  selection: node
58802
58832
  })
@@ -67402,9 +67402,12 @@ var InMemorySubscriptions = class {
67402
67402
  removeSubscribers(id, fieldName, specs) {
67403
67403
  let targets = [];
67404
67404
  const subscriber = this.subscribers.get(id);
67405
- const subscriberField = subscriber?.get(fieldName);
67405
+ if (!subscriber) {
67406
+ return;
67407
+ }
67408
+ const subscriberField = subscriber.get(fieldName);
67406
67409
  for (const spec of specs) {
67407
- const counts = subscriber?.get(fieldName)?.referenceCounts;
67410
+ const counts = subscriber.get(fieldName)?.referenceCounts;
67408
67411
  if (!counts?.has(spec.set)) {
67409
67412
  continue;
67410
67413
  }
@@ -67414,12 +67417,18 @@ var InMemorySubscriptions = class {
67414
67417
  targets.push(spec.set);
67415
67418
  counts.delete(spec.set);
67416
67419
  }
67420
+ if (counts.size === 0) {
67421
+ subscriber.delete(fieldName);
67422
+ }
67417
67423
  }
67418
67424
  if (subscriberField) {
67419
67425
  subscriberField.selections = this.get(id, fieldName).filter(
67420
67426
  ([{ set }]) => !targets.includes(set)
67421
67427
  );
67422
67428
  }
67429
+ if (subscriber.size === 0) {
67430
+ this.subscribers.delete(id);
67431
+ }
67423
67432
  }
67424
67433
  removeAllSubscribers(id, targets, visited = []) {
67425
67434
  visited.push(id);
@@ -67440,6 +67449,15 @@ var InMemorySubscriptions = class {
67440
67449
  }
67441
67450
  }
67442
67451
  }
67452
+ get size() {
67453
+ let size = 0;
67454
+ for (const [, nodeCounts] of this.subscribers) {
67455
+ for (const [, { referenceCounts }] of nodeCounts) {
67456
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
67457
+ }
67458
+ }
67459
+ return size;
67460
+ }
67443
67461
  };
67444
67462
 
67445
67463
  // src/runtime/cache/cache.ts
@@ -67488,6 +67506,9 @@ var Cache = class {
67488
67506
  };
67489
67507
  }
67490
67508
  subscribe(spec, variables = {}) {
67509
+ if (this._internal_unstable.disabled) {
67510
+ return;
67511
+ }
67491
67512
  return this._internal_unstable.subscriptions.add({
67492
67513
  parent: spec.parentID || rootID,
67493
67514
  spec,
@@ -67627,7 +67648,7 @@ var Cache = class {
67627
67648
  }
67628
67649
  };
67629
67650
  var CacheInternal = class {
67630
- _disabled = false;
67651
+ disabled = false;
67631
67652
  _config;
67632
67653
  storage;
67633
67654
  subscriptions;
@@ -67658,10 +67679,10 @@ var CacheInternal = class {
67658
67679
  this._config = config2;
67659
67680
  this.componentCache = componentCache ?? {};
67660
67681
  this.createComponent = createComponent ?? (() => ({}));
67661
- this._disabled = disabled;
67682
+ this.disabled = disabled;
67662
67683
  try {
67663
67684
  if (process.env.HOUDINI_TEST === "true") {
67664
- this._disabled = false;
67685
+ this.disabled = false;
67665
67686
  }
67666
67687
  } catch {
67667
67688
  }
@@ -67683,7 +67704,7 @@ var CacheInternal = class {
67683
67704
  forceNotify,
67684
67705
  forceStale
67685
67706
  }) {
67686
- if (this._disabled) {
67707
+ if (this.disabled) {
67687
67708
  return [];
67688
67709
  }
67689
67710
  let targetSelection = getFieldsForType(
@@ -69480,7 +69501,12 @@ function deepMerge2(filepath, ...targets) {
69480
69501
  // src/lib/parse.ts
69481
69502
  function parseJS(str, config2) {
69482
69503
  const defaultConfig = {
69483
- plugins: ["typescript", "importAssertions", "decorators-legacy"],
69504
+ plugins: [
69505
+ "typescript",
69506
+ "importAssertions",
69507
+ "decorators-legacy",
69508
+ "explicitResourceManagement"
69509
+ ],
69484
69510
  sourceType: "module"
69485
69511
  };
69486
69512
  return (0, import_parser.parse)(str || "", config2 ? deepMerge2("", defaultConfig, config2) : defaultConfig).program;
@@ -70463,7 +70489,18 @@ async function extractQueries(source) {
70463
70489
  } else {
70464
70490
  return [];
70465
70491
  }
70466
- return props.filter((p) => p !== "children");
70492
+ return props.reduce((queries, query2) => {
70493
+ if (query2 === "children") {
70494
+ return queries;
70495
+ }
70496
+ if (query2.endsWith("$handle")) {
70497
+ query2 = query2.substring(0, query2.length - "$handle".length);
70498
+ }
70499
+ if (queries.includes(query2)) {
70500
+ return queries;
70501
+ }
70502
+ return queries.concat([query2]);
70503
+ }, []);
70467
70504
  }
70468
70505
 
70469
70506
  // src/lib/router/server.ts
@@ -71581,7 +71618,11 @@ function operationsByPath(config2, filepath, definition, filterTypes) {
71581
71618
  const pathOperations = {};
71582
71619
  graphql11.visit(definition, {
71583
71620
  FragmentSpread(node, _, __, ___, ancestors) {
71584
- if (!config2.isListFragment(node.name.value)) {
71621
+ let nameWithoutHash = node.name.value;
71622
+ if (node.directives && node.directives.find((directive) => directive.name.value === "with")) {
71623
+ nameWithoutHash = nameWithoutHash.substring(0, nameWithoutHash.lastIndexOf("_"));
71624
+ }
71625
+ if (!config2.isListFragment(nameWithoutHash)) {
71585
71626
  return;
71586
71627
  }
71587
71628
  const path3 = ancestorKey(ancestors);
@@ -71592,8 +71633,8 @@ function operationsByPath(config2, filepath, definition, filterTypes) {
71592
71633
  operationObject({
71593
71634
  config: config2,
71594
71635
  filepath,
71595
- listName: config2.listNameFromFragment(node.name.value),
71596
- operationKind: config2.listOperationFromFragment(node.name.value),
71636
+ listName: config2.listNameFromFragment(nameWithoutHash),
71637
+ operationKind: config2.listOperationFromFragment(nameWithoutHash),
71597
71638
  type: parentTypeFromAncestors(config2.schema, filepath, ancestors).name,
71598
71639
  selection: node
71599
71640
  })
@@ -67396,9 +67396,12 @@ var InMemorySubscriptions = class {
67396
67396
  removeSubscribers(id, fieldName, specs) {
67397
67397
  let targets = [];
67398
67398
  const subscriber = this.subscribers.get(id);
67399
- const subscriberField = subscriber?.get(fieldName);
67399
+ if (!subscriber) {
67400
+ return;
67401
+ }
67402
+ const subscriberField = subscriber.get(fieldName);
67400
67403
  for (const spec of specs) {
67401
- const counts = subscriber?.get(fieldName)?.referenceCounts;
67404
+ const counts = subscriber.get(fieldName)?.referenceCounts;
67402
67405
  if (!counts?.has(spec.set)) {
67403
67406
  continue;
67404
67407
  }
@@ -67408,12 +67411,18 @@ var InMemorySubscriptions = class {
67408
67411
  targets.push(spec.set);
67409
67412
  counts.delete(spec.set);
67410
67413
  }
67414
+ if (counts.size === 0) {
67415
+ subscriber.delete(fieldName);
67416
+ }
67411
67417
  }
67412
67418
  if (subscriberField) {
67413
67419
  subscriberField.selections = this.get(id, fieldName).filter(
67414
67420
  ([{ set }]) => !targets.includes(set)
67415
67421
  );
67416
67422
  }
67423
+ if (subscriber.size === 0) {
67424
+ this.subscribers.delete(id);
67425
+ }
67417
67426
  }
67418
67427
  removeAllSubscribers(id, targets, visited = []) {
67419
67428
  visited.push(id);
@@ -67434,6 +67443,15 @@ var InMemorySubscriptions = class {
67434
67443
  }
67435
67444
  }
67436
67445
  }
67446
+ get size() {
67447
+ let size = 0;
67448
+ for (const [, nodeCounts] of this.subscribers) {
67449
+ for (const [, { referenceCounts }] of nodeCounts) {
67450
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
67451
+ }
67452
+ }
67453
+ return size;
67454
+ }
67437
67455
  };
67438
67456
 
67439
67457
  // src/runtime/cache/cache.ts
@@ -67482,6 +67500,9 @@ var Cache = class {
67482
67500
  };
67483
67501
  }
67484
67502
  subscribe(spec, variables = {}) {
67503
+ if (this._internal_unstable.disabled) {
67504
+ return;
67505
+ }
67485
67506
  return this._internal_unstable.subscriptions.add({
67486
67507
  parent: spec.parentID || rootID,
67487
67508
  spec,
@@ -67621,7 +67642,7 @@ var Cache = class {
67621
67642
  }
67622
67643
  };
67623
67644
  var CacheInternal = class {
67624
- _disabled = false;
67645
+ disabled = false;
67625
67646
  _config;
67626
67647
  storage;
67627
67648
  subscriptions;
@@ -67652,10 +67673,10 @@ var CacheInternal = class {
67652
67673
  this._config = config2;
67653
67674
  this.componentCache = componentCache ?? {};
67654
67675
  this.createComponent = createComponent ?? (() => ({}));
67655
- this._disabled = disabled;
67676
+ this.disabled = disabled;
67656
67677
  try {
67657
67678
  if (process.env.HOUDINI_TEST === "true") {
67658
- this._disabled = false;
67679
+ this.disabled = false;
67659
67680
  }
67660
67681
  } catch {
67661
67682
  }
@@ -67677,7 +67698,7 @@ var CacheInternal = class {
67677
67698
  forceNotify,
67678
67699
  forceStale
67679
67700
  }) {
67680
- if (this._disabled) {
67701
+ if (this.disabled) {
67681
67702
  return [];
67682
67703
  }
67683
67704
  let targetSelection = getFieldsForType(
@@ -69473,7 +69494,12 @@ function deepMerge2(filepath, ...targets) {
69473
69494
  // src/lib/parse.ts
69474
69495
  function parseJS(str, config2) {
69475
69496
  const defaultConfig = {
69476
- plugins: ["typescript", "importAssertions", "decorators-legacy"],
69497
+ plugins: [
69498
+ "typescript",
69499
+ "importAssertions",
69500
+ "decorators-legacy",
69501
+ "explicitResourceManagement"
69502
+ ],
69477
69503
  sourceType: "module"
69478
69504
  };
69479
69505
  return (0, import_parser.parse)(str || "", config2 ? deepMerge2("", defaultConfig, config2) : defaultConfig).program;
@@ -70456,7 +70482,18 @@ async function extractQueries(source) {
70456
70482
  } else {
70457
70483
  return [];
70458
70484
  }
70459
- return props.filter((p) => p !== "children");
70485
+ return props.reduce((queries, query2) => {
70486
+ if (query2 === "children") {
70487
+ return queries;
70488
+ }
70489
+ if (query2.endsWith("$handle")) {
70490
+ query2 = query2.substring(0, query2.length - "$handle".length);
70491
+ }
70492
+ if (queries.includes(query2)) {
70493
+ return queries;
70494
+ }
70495
+ return queries.concat([query2]);
70496
+ }, []);
70460
70497
  }
70461
70498
 
70462
70499
  // src/lib/router/server.ts
@@ -71574,7 +71611,11 @@ function operationsByPath(config2, filepath, definition, filterTypes) {
71574
71611
  const pathOperations = {};
71575
71612
  graphql11.visit(definition, {
71576
71613
  FragmentSpread(node, _, __, ___, ancestors) {
71577
- if (!config2.isListFragment(node.name.value)) {
71614
+ let nameWithoutHash = node.name.value;
71615
+ if (node.directives && node.directives.find((directive) => directive.name.value === "with")) {
71616
+ nameWithoutHash = nameWithoutHash.substring(0, nameWithoutHash.lastIndexOf("_"));
71617
+ }
71618
+ if (!config2.isListFragment(nameWithoutHash)) {
71578
71619
  return;
71579
71620
  }
71580
71621
  const path3 = ancestorKey(ancestors);
@@ -71585,8 +71626,8 @@ function operationsByPath(config2, filepath, definition, filterTypes) {
71585
71626
  operationObject({
71586
71627
  config: config2,
71587
71628
  filepath,
71588
- listName: config2.listNameFromFragment(node.name.value),
71589
- operationKind: config2.listOperationFromFragment(node.name.value),
71629
+ listName: config2.listNameFromFragment(nameWithoutHash),
71630
+ operationKind: config2.listOperationFromFragment(nameWithoutHash),
71590
71631
  type: parentTypeFromAncestors(config2.schema, filepath, ancestors).name,
71591
71632
  selection: node
71592
71633
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini",
3
- "version": "1.2.45",
3
+ "version": "1.2.47",
4
4
  "description": "The disappearing GraphQL clients",
5
5
  "keywords": [
6
6
  "typescript",