@tanstack/query-devtools 5.13.5 → 5.14.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.
@@ -2030,7 +2030,7 @@ function Dynamic(props) {
2030
2030
  });
2031
2031
  }
2032
2032
 
2033
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/double-indexed-kv.js
2033
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/double-indexed-kv.js
2034
2034
  var DoubleIndexedKV = (
2035
2035
  /** @class */
2036
2036
  function() {
@@ -2056,7 +2056,7 @@ var DoubleIndexedKV = (
2056
2056
  }()
2057
2057
  );
2058
2058
 
2059
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/registry.js
2059
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/registry.js
2060
2060
  var Registry = (
2061
2061
  /** @class */
2062
2062
  function() {
@@ -2086,7 +2086,7 @@ var Registry = (
2086
2086
  }()
2087
2087
  );
2088
2088
 
2089
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/class-registry.js
2089
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/class-registry.js
2090
2090
  var __extends = function() {
2091
2091
  var extendStatics = function(d, b) {
2092
2092
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
@@ -2136,7 +2136,7 @@ var ClassRegistry = (
2136
2136
  }(Registry)
2137
2137
  );
2138
2138
 
2139
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/util.js
2139
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/util.js
2140
2140
  var __read = function(o, n) {
2141
2141
  var m = typeof Symbol === "function" && o[Symbol.iterator];
2142
2142
  if (!m)
@@ -2203,7 +2203,7 @@ function findArr(record, predicate) {
2203
2203
  return void 0;
2204
2204
  }
2205
2205
 
2206
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/custom-transformer-registry.js
2206
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/custom-transformer-registry.js
2207
2207
  var CustomTransformerRegistry = (
2208
2208
  /** @class */
2209
2209
  function() {
@@ -2225,7 +2225,7 @@ var CustomTransformerRegistry = (
2225
2225
  }()
2226
2226
  );
2227
2227
 
2228
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/is.js
2228
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/is.js
2229
2229
  var getType = function(payload) {
2230
2230
  return Object.prototype.toString.call(payload).slice(8, -1);
2231
2231
  };
@@ -2296,7 +2296,7 @@ var isURL = function(payload) {
2296
2296
  return payload instanceof URL;
2297
2297
  };
2298
2298
 
2299
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/pathstringifier.js
2299
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/pathstringifier.js
2300
2300
  var escapeKey = function(key) {
2301
2301
  return key.replace(/\./g, "\\.");
2302
2302
  };
@@ -2327,7 +2327,7 @@ var parsePath = function(string) {
2327
2327
  return result;
2328
2328
  };
2329
2329
 
2330
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/transformer.js
2330
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/transformer.js
2331
2331
  var __assign = function() {
2332
2332
  __assign = Object.assign || function(t) {
2333
2333
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -2600,7 +2600,7 @@ var untransformValue = function(json, type, superJson) {
2600
2600
  }
2601
2601
  };
2602
2602
 
2603
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/accessDeep.js
2603
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/accessDeep.js
2604
2604
  var getNthKey = function(value, n) {
2605
2605
  var keys = value.keys();
2606
2606
  while (n > 0) {
@@ -2714,7 +2714,7 @@ var setDeep = function(object, path, mapper) {
2714
2714
  return object;
2715
2715
  };
2716
2716
 
2717
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/plainer.js
2717
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/plainer.js
2718
2718
  var __read3 = function(o, n) {
2719
2719
  var m = typeof Symbol === "function" && o[Symbol.iterator];
2720
2720
  if (!m)
@@ -2805,22 +2805,25 @@ function addIdentity(object, path, identities) {
2805
2805
  identities.set(object, [path]);
2806
2806
  }
2807
2807
  }
2808
- function generateReferentialEqualityAnnotations(identitites) {
2808
+ function generateReferentialEqualityAnnotations(identitites, dedupe) {
2809
2809
  var result = {};
2810
2810
  var rootEqualityPaths = void 0;
2811
2811
  identitites.forEach(function(paths) {
2812
2812
  if (paths.length <= 1) {
2813
2813
  return;
2814
2814
  }
2815
- var _a = __read3(paths.map(function(path) {
2816
- return path.map(String);
2817
- }).sort(function(a, b) {
2818
- return a.length - b.length;
2819
- })), shortestPath = _a[0], identicalPaths = _a.slice(1);
2820
- if (shortestPath.length === 0) {
2815
+ if (!dedupe) {
2816
+ paths = paths.map(function(path) {
2817
+ return path.map(String);
2818
+ }).sort(function(a, b) {
2819
+ return a.length - b.length;
2820
+ });
2821
+ }
2822
+ var _a = __read3(paths), representativePath = _a[0], identicalPaths = _a.slice(1);
2823
+ if (representativePath.length === 0) {
2821
2824
  rootEqualityPaths = identicalPaths.map(stringifyPath);
2822
2825
  } else {
2823
- result[stringifyPath(shortestPath)] = identicalPaths.map(stringifyPath);
2826
+ result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
2824
2827
  }
2825
2828
  });
2826
2829
  if (rootEqualityPaths) {
@@ -2833,7 +2836,7 @@ function generateReferentialEqualityAnnotations(identitites) {
2833
2836
  return isEmptyObject(result) ? void 0 : result;
2834
2837
  }
2835
2838
  }
2836
- var walker = function(object, identities, superJson, path, objectsInThisPath) {
2839
+ var walker = function(object, identities, superJson, dedupe, path, objectsInThisPath, seenObjects) {
2837
2840
  var _a;
2838
2841
  if (path === void 0) {
2839
2842
  path = [];
@@ -2841,21 +2844,31 @@ var walker = function(object, identities, superJson, path, objectsInThisPath) {
2841
2844
  if (objectsInThisPath === void 0) {
2842
2845
  objectsInThisPath = [];
2843
2846
  }
2844
- if (!isPrimitive(object)) {
2847
+ if (seenObjects === void 0) {
2848
+ seenObjects = /* @__PURE__ */ new Map();
2849
+ }
2850
+ var primitive = isPrimitive(object);
2851
+ if (!primitive) {
2845
2852
  addIdentity(object, path, identities);
2853
+ var seen = seenObjects.get(object);
2854
+ if (seen) {
2855
+ return dedupe ? {
2856
+ transformedValue: null
2857
+ } : seen;
2858
+ }
2846
2859
  }
2847
2860
  if (!isDeep(object, superJson)) {
2848
2861
  var transformed_1 = transformValue(object, superJson);
2849
- if (transformed_1) {
2850
- return {
2851
- transformedValue: transformed_1.value,
2852
- annotations: [transformed_1.type]
2853
- };
2854
- } else {
2855
- return {
2856
- transformedValue: object
2857
- };
2862
+ var result_1 = transformed_1 ? {
2863
+ transformedValue: transformed_1.value,
2864
+ annotations: [transformed_1.type]
2865
+ } : {
2866
+ transformedValue: object
2867
+ };
2868
+ if (!primitive) {
2869
+ seenObjects.set(object, result_1);
2858
2870
  }
2871
+ return result_1;
2859
2872
  }
2860
2873
  if (includes(objectsInThisPath, object)) {
2861
2874
  return {
@@ -2864,13 +2877,10 @@ var walker = function(object, identities, superJson, path, objectsInThisPath) {
2864
2877
  }
2865
2878
  var transformationResult = transformValue(object, superJson);
2866
2879
  var transformed = (_a = transformationResult === null || transformationResult === void 0 ? void 0 : transformationResult.value) !== null && _a !== void 0 ? _a : object;
2867
- if (!isPrimitive(object)) {
2868
- objectsInThisPath = __spreadArray2(__spreadArray2([], __read3(objectsInThisPath)), [object]);
2869
- }
2870
2880
  var transformedValue = isArray(transformed) ? [] : {};
2871
2881
  var innerAnnotations = {};
2872
2882
  forEach(transformed, function(value, index) {
2873
- var recursiveResult = walker(value, identities, superJson, __spreadArray2(__spreadArray2([], __read3(path)), [index]), objectsInThisPath);
2883
+ var recursiveResult = walker(value, identities, superJson, dedupe, __spreadArray2(__spreadArray2([], __read3(path)), [index]), __spreadArray2(__spreadArray2([], __read3(objectsInThisPath)), [object]), seenObjects);
2874
2884
  transformedValue[index] = recursiveResult.transformedValue;
2875
2885
  if (isArray(recursiveResult.annotations)) {
2876
2886
  innerAnnotations[index] = recursiveResult.annotations;
@@ -2880,17 +2890,17 @@ var walker = function(object, identities, superJson, path, objectsInThisPath) {
2880
2890
  });
2881
2891
  }
2882
2892
  });
2883
- if (isEmptyObject(innerAnnotations)) {
2884
- return {
2885
- transformedValue,
2886
- annotations: !!transformationResult ? [transformationResult.type] : void 0
2887
- };
2888
- } else {
2889
- return {
2890
- transformedValue,
2891
- annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
2892
- };
2893
+ var result = isEmptyObject(innerAnnotations) ? {
2894
+ transformedValue,
2895
+ annotations: !!transformationResult ? [transformationResult.type] : void 0
2896
+ } : {
2897
+ transformedValue,
2898
+ annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
2899
+ };
2900
+ if (!primitive) {
2901
+ seenObjects.set(object, result);
2893
2902
  }
2903
+ return result;
2894
2904
  };
2895
2905
 
2896
2906
  // ../../node_modules/.pnpm/is-what@4.1.15/node_modules/is-what/dist/index.js
@@ -2941,7 +2951,7 @@ function copy(target, options = {}) {
2941
2951
  }, {});
2942
2952
  }
2943
2953
 
2944
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/index.js
2954
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/index.js
2945
2955
  var __assign2 = function() {
2946
2956
  __assign2 = Object.assign || function(t) {
2947
2957
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -2983,25 +2993,27 @@ var __spreadArray3 = function(to, from) {
2983
2993
  var SuperJSON = (
2984
2994
  /** @class */
2985
2995
  function() {
2986
- function SuperJSON2() {
2996
+ function SuperJSON2(_a) {
2997
+ var _b = _a === void 0 ? {} : _a, _c = _b.dedupe, dedupe = _c === void 0 ? false : _c;
2987
2998
  this.classRegistry = new ClassRegistry();
2988
2999
  this.symbolRegistry = new Registry(function(s) {
2989
- var _a;
2990
- return (_a = s.description) !== null && _a !== void 0 ? _a : "";
3000
+ var _a2;
3001
+ return (_a2 = s.description) !== null && _a2 !== void 0 ? _a2 : "";
2991
3002
  });
2992
3003
  this.customTransformerRegistry = new CustomTransformerRegistry();
2993
3004
  this.allowedErrorProps = [];
3005
+ this.dedupe = dedupe;
2994
3006
  }
2995
3007
  SuperJSON2.prototype.serialize = function(object) {
2996
3008
  var identities = /* @__PURE__ */ new Map();
2997
- var output = walker(object, identities, this);
3009
+ var output = walker(object, identities, this, this.dedupe);
2998
3010
  var res = {
2999
3011
  json: output.transformedValue
3000
3012
  };
3001
3013
  if (output.annotations) {
3002
3014
  res.meta = __assign2(__assign2({}, res.meta), { values: output.annotations });
3003
3015
  }
3004
- var equalityAnnotations = generateReferentialEqualityAnnotations(identities);
3016
+ var equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
3005
3017
  if (equalityAnnotations) {
3006
3018
  res.meta = __assign2(__assign2({}, res.meta), { referentialEqualities: equalityAnnotations });
3007
3019
  }
@@ -2032,7 +2032,7 @@ function Dynamic(props) {
2032
2032
  });
2033
2033
  }
2034
2034
 
2035
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/double-indexed-kv.js
2035
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/double-indexed-kv.js
2036
2036
  var DoubleIndexedKV = (
2037
2037
  /** @class */
2038
2038
  function() {
@@ -2058,7 +2058,7 @@ var DoubleIndexedKV = (
2058
2058
  }()
2059
2059
  );
2060
2060
 
2061
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/registry.js
2061
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/registry.js
2062
2062
  var Registry = (
2063
2063
  /** @class */
2064
2064
  function() {
@@ -2088,7 +2088,7 @@ var Registry = (
2088
2088
  }()
2089
2089
  );
2090
2090
 
2091
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/class-registry.js
2091
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/class-registry.js
2092
2092
  var __extends = function() {
2093
2093
  var extendStatics = function(d, b) {
2094
2094
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
@@ -2138,7 +2138,7 @@ var ClassRegistry = (
2138
2138
  }(Registry)
2139
2139
  );
2140
2140
 
2141
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/util.js
2141
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/util.js
2142
2142
  var __read = function(o, n) {
2143
2143
  var m = typeof Symbol === "function" && o[Symbol.iterator];
2144
2144
  if (!m)
@@ -2205,7 +2205,7 @@ function findArr(record, predicate) {
2205
2205
  return void 0;
2206
2206
  }
2207
2207
 
2208
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/custom-transformer-registry.js
2208
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/custom-transformer-registry.js
2209
2209
  var CustomTransformerRegistry = (
2210
2210
  /** @class */
2211
2211
  function() {
@@ -2227,7 +2227,7 @@ var CustomTransformerRegistry = (
2227
2227
  }()
2228
2228
  );
2229
2229
 
2230
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/is.js
2230
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/is.js
2231
2231
  var getType = function(payload) {
2232
2232
  return Object.prototype.toString.call(payload).slice(8, -1);
2233
2233
  };
@@ -2298,7 +2298,7 @@ var isURL = function(payload) {
2298
2298
  return payload instanceof URL;
2299
2299
  };
2300
2300
 
2301
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/pathstringifier.js
2301
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/pathstringifier.js
2302
2302
  var escapeKey = function(key) {
2303
2303
  return key.replace(/\./g, "\\.");
2304
2304
  };
@@ -2329,7 +2329,7 @@ var parsePath = function(string) {
2329
2329
  return result;
2330
2330
  };
2331
2331
 
2332
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/transformer.js
2332
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/transformer.js
2333
2333
  var __assign = function() {
2334
2334
  __assign = Object.assign || function(t) {
2335
2335
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -2603,7 +2603,7 @@ var untransformValue = function(json, type, superJson) {
2603
2603
  }
2604
2604
  };
2605
2605
 
2606
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/accessDeep.js
2606
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/accessDeep.js
2607
2607
  var getNthKey = function(value, n) {
2608
2608
  var keys = value.keys();
2609
2609
  while (n > 0) {
@@ -2717,7 +2717,7 @@ var setDeep = function(object, path, mapper) {
2717
2717
  return object;
2718
2718
  };
2719
2719
 
2720
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/plainer.js
2720
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/plainer.js
2721
2721
  var __read3 = function(o, n) {
2722
2722
  var m = typeof Symbol === "function" && o[Symbol.iterator];
2723
2723
  if (!m)
@@ -2808,22 +2808,25 @@ function addIdentity(object, path, identities) {
2808
2808
  identities.set(object, [path]);
2809
2809
  }
2810
2810
  }
2811
- function generateReferentialEqualityAnnotations(identitites) {
2811
+ function generateReferentialEqualityAnnotations(identitites, dedupe) {
2812
2812
  var result = {};
2813
2813
  var rootEqualityPaths = void 0;
2814
2814
  identitites.forEach(function(paths) {
2815
2815
  if (paths.length <= 1) {
2816
2816
  return;
2817
2817
  }
2818
- var _a = __read3(paths.map(function(path) {
2819
- return path.map(String);
2820
- }).sort(function(a, b) {
2821
- return a.length - b.length;
2822
- })), shortestPath = _a[0], identicalPaths = _a.slice(1);
2823
- if (shortestPath.length === 0) {
2818
+ if (!dedupe) {
2819
+ paths = paths.map(function(path) {
2820
+ return path.map(String);
2821
+ }).sort(function(a, b) {
2822
+ return a.length - b.length;
2823
+ });
2824
+ }
2825
+ var _a = __read3(paths), representativePath = _a[0], identicalPaths = _a.slice(1);
2826
+ if (representativePath.length === 0) {
2824
2827
  rootEqualityPaths = identicalPaths.map(stringifyPath);
2825
2828
  } else {
2826
- result[stringifyPath(shortestPath)] = identicalPaths.map(stringifyPath);
2829
+ result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
2827
2830
  }
2828
2831
  });
2829
2832
  if (rootEqualityPaths) {
@@ -2836,7 +2839,7 @@ function generateReferentialEqualityAnnotations(identitites) {
2836
2839
  return isEmptyObject(result) ? void 0 : result;
2837
2840
  }
2838
2841
  }
2839
- var walker = function(object, identities, superJson, path, objectsInThisPath) {
2842
+ var walker = function(object, identities, superJson, dedupe, path, objectsInThisPath, seenObjects) {
2840
2843
  var _a;
2841
2844
  if (path === void 0) {
2842
2845
  path = [];
@@ -2844,21 +2847,31 @@ var walker = function(object, identities, superJson, path, objectsInThisPath) {
2844
2847
  if (objectsInThisPath === void 0) {
2845
2848
  objectsInThisPath = [];
2846
2849
  }
2847
- if (!isPrimitive(object)) {
2850
+ if (seenObjects === void 0) {
2851
+ seenObjects = /* @__PURE__ */ new Map();
2852
+ }
2853
+ var primitive = isPrimitive(object);
2854
+ if (!primitive) {
2848
2855
  addIdentity(object, path, identities);
2856
+ var seen = seenObjects.get(object);
2857
+ if (seen) {
2858
+ return dedupe ? {
2859
+ transformedValue: null
2860
+ } : seen;
2861
+ }
2849
2862
  }
2850
2863
  if (!isDeep(object, superJson)) {
2851
2864
  var transformed_1 = transformValue(object, superJson);
2852
- if (transformed_1) {
2853
- return {
2854
- transformedValue: transformed_1.value,
2855
- annotations: [transformed_1.type]
2856
- };
2857
- } else {
2858
- return {
2859
- transformedValue: object
2860
- };
2865
+ var result_1 = transformed_1 ? {
2866
+ transformedValue: transformed_1.value,
2867
+ annotations: [transformed_1.type]
2868
+ } : {
2869
+ transformedValue: object
2870
+ };
2871
+ if (!primitive) {
2872
+ seenObjects.set(object, result_1);
2861
2873
  }
2874
+ return result_1;
2862
2875
  }
2863
2876
  if (includes(objectsInThisPath, object)) {
2864
2877
  return {
@@ -2867,13 +2880,10 @@ var walker = function(object, identities, superJson, path, objectsInThisPath) {
2867
2880
  }
2868
2881
  var transformationResult = transformValue(object, superJson);
2869
2882
  var transformed = (_a = transformationResult === null || transformationResult === void 0 ? void 0 : transformationResult.value) !== null && _a !== void 0 ? _a : object;
2870
- if (!isPrimitive(object)) {
2871
- objectsInThisPath = __spreadArray2(__spreadArray2([], __read3(objectsInThisPath)), [object]);
2872
- }
2873
2883
  var transformedValue = isArray(transformed) ? [] : {};
2874
2884
  var innerAnnotations = {};
2875
2885
  forEach(transformed, function(value, index) {
2876
- var recursiveResult = walker(value, identities, superJson, __spreadArray2(__spreadArray2([], __read3(path)), [index]), objectsInThisPath);
2886
+ var recursiveResult = walker(value, identities, superJson, dedupe, __spreadArray2(__spreadArray2([], __read3(path)), [index]), __spreadArray2(__spreadArray2([], __read3(objectsInThisPath)), [object]), seenObjects);
2877
2887
  transformedValue[index] = recursiveResult.transformedValue;
2878
2888
  if (isArray(recursiveResult.annotations)) {
2879
2889
  innerAnnotations[index] = recursiveResult.annotations;
@@ -2883,17 +2893,17 @@ var walker = function(object, identities, superJson, path, objectsInThisPath) {
2883
2893
  });
2884
2894
  }
2885
2895
  });
2886
- if (isEmptyObject(innerAnnotations)) {
2887
- return {
2888
- transformedValue,
2889
- annotations: !!transformationResult ? [transformationResult.type] : void 0
2890
- };
2891
- } else {
2892
- return {
2893
- transformedValue,
2894
- annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
2895
- };
2896
+ var result = isEmptyObject(innerAnnotations) ? {
2897
+ transformedValue,
2898
+ annotations: !!transformationResult ? [transformationResult.type] : void 0
2899
+ } : {
2900
+ transformedValue,
2901
+ annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
2902
+ };
2903
+ if (!primitive) {
2904
+ seenObjects.set(object, result);
2896
2905
  }
2906
+ return result;
2897
2907
  };
2898
2908
 
2899
2909
  // ../../node_modules/.pnpm/is-what@4.1.15/node_modules/is-what/dist/index.js
@@ -2954,7 +2964,7 @@ function copy(target, options = {}) {
2954
2964
  }, {});
2955
2965
  }
2956
2966
 
2957
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/index.js
2967
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/index.js
2958
2968
  var __assign2 = function() {
2959
2969
  __assign2 = Object.assign || function(t) {
2960
2970
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -2996,25 +3006,27 @@ var __spreadArray3 = function(to, from) {
2996
3006
  var SuperJSON = (
2997
3007
  /** @class */
2998
3008
  function() {
2999
- function SuperJSON2() {
3009
+ function SuperJSON2(_a) {
3010
+ var _b = _a === void 0 ? {} : _a, _c = _b.dedupe, dedupe = _c === void 0 ? false : _c;
3000
3011
  this.classRegistry = new ClassRegistry();
3001
3012
  this.symbolRegistry = new Registry(function(s) {
3002
- var _a;
3003
- return (_a = s.description) !== null && _a !== void 0 ? _a : "";
3013
+ var _a2;
3014
+ return (_a2 = s.description) !== null && _a2 !== void 0 ? _a2 : "";
3004
3015
  });
3005
3016
  this.customTransformerRegistry = new CustomTransformerRegistry();
3006
3017
  this.allowedErrorProps = [];
3018
+ this.dedupe = dedupe;
3007
3019
  }
3008
3020
  SuperJSON2.prototype.serialize = function(object) {
3009
3021
  var identities = /* @__PURE__ */ new Map();
3010
- var output = walker(object, identities, this);
3022
+ var output = walker(object, identities, this, this.dedupe);
3011
3023
  var res = {
3012
3024
  json: output.transformedValue
3013
3025
  };
3014
3026
  if (output.annotations) {
3015
3027
  res.meta = __assign2(__assign2({}, res.meta), { values: output.annotations });
3016
3028
  }
3017
- var equalityAnnotations = generateReferentialEqualityAnnotations(identities);
3029
+ var equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
3018
3030
  if (equalityAnnotations) {
3019
3031
  res.meta = __assign2(__assign2({}, res.meta), { referentialEqualities: equalityAnnotations });
3020
3032
  }