@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++) {
@@ -2601,7 +2601,7 @@ var untransformValue = function(json, type, superJson) {
2601
2601
  }
2602
2602
  };
2603
2603
 
2604
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/accessDeep.js
2604
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/accessDeep.js
2605
2605
  var getNthKey = function(value, n) {
2606
2606
  var keys = value.keys();
2607
2607
  while (n > 0) {
@@ -2715,7 +2715,7 @@ var setDeep = function(object, path, mapper) {
2715
2715
  return object;
2716
2716
  };
2717
2717
 
2718
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/plainer.js
2718
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/plainer.js
2719
2719
  var __read3 = function(o, n) {
2720
2720
  var m = typeof Symbol === "function" && o[Symbol.iterator];
2721
2721
  if (!m)
@@ -2806,22 +2806,25 @@ function addIdentity(object, path, identities) {
2806
2806
  identities.set(object, [path]);
2807
2807
  }
2808
2808
  }
2809
- function generateReferentialEqualityAnnotations(identitites) {
2809
+ function generateReferentialEqualityAnnotations(identitites, dedupe) {
2810
2810
  var result = {};
2811
2811
  var rootEqualityPaths = void 0;
2812
2812
  identitites.forEach(function(paths) {
2813
2813
  if (paths.length <= 1) {
2814
2814
  return;
2815
2815
  }
2816
- var _a = __read3(paths.map(function(path) {
2817
- return path.map(String);
2818
- }).sort(function(a, b) {
2819
- return a.length - b.length;
2820
- })), shortestPath = _a[0], identicalPaths = _a.slice(1);
2821
- if (shortestPath.length === 0) {
2816
+ if (!dedupe) {
2817
+ paths = paths.map(function(path) {
2818
+ return path.map(String);
2819
+ }).sort(function(a, b) {
2820
+ return a.length - b.length;
2821
+ });
2822
+ }
2823
+ var _a = __read3(paths), representativePath = _a[0], identicalPaths = _a.slice(1);
2824
+ if (representativePath.length === 0) {
2822
2825
  rootEqualityPaths = identicalPaths.map(stringifyPath);
2823
2826
  } else {
2824
- result[stringifyPath(shortestPath)] = identicalPaths.map(stringifyPath);
2827
+ result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
2825
2828
  }
2826
2829
  });
2827
2830
  if (rootEqualityPaths) {
@@ -2834,7 +2837,7 @@ function generateReferentialEqualityAnnotations(identitites) {
2834
2837
  return isEmptyObject(result) ? void 0 : result;
2835
2838
  }
2836
2839
  }
2837
- var walker = function(object, identities, superJson, path, objectsInThisPath) {
2840
+ var walker = function(object, identities, superJson, dedupe, path, objectsInThisPath, seenObjects) {
2838
2841
  var _a;
2839
2842
  if (path === void 0) {
2840
2843
  path = [];
@@ -2842,21 +2845,31 @@ var walker = function(object, identities, superJson, path, objectsInThisPath) {
2842
2845
  if (objectsInThisPath === void 0) {
2843
2846
  objectsInThisPath = [];
2844
2847
  }
2845
- if (!isPrimitive(object)) {
2848
+ if (seenObjects === void 0) {
2849
+ seenObjects = /* @__PURE__ */ new Map();
2850
+ }
2851
+ var primitive = isPrimitive(object);
2852
+ if (!primitive) {
2846
2853
  addIdentity(object, path, identities);
2854
+ var seen = seenObjects.get(object);
2855
+ if (seen) {
2856
+ return dedupe ? {
2857
+ transformedValue: null
2858
+ } : seen;
2859
+ }
2847
2860
  }
2848
2861
  if (!isDeep(object, superJson)) {
2849
2862
  var transformed_1 = transformValue(object, superJson);
2850
- if (transformed_1) {
2851
- return {
2852
- transformedValue: transformed_1.value,
2853
- annotations: [transformed_1.type]
2854
- };
2855
- } else {
2856
- return {
2857
- transformedValue: object
2858
- };
2863
+ var result_1 = transformed_1 ? {
2864
+ transformedValue: transformed_1.value,
2865
+ annotations: [transformed_1.type]
2866
+ } : {
2867
+ transformedValue: object
2868
+ };
2869
+ if (!primitive) {
2870
+ seenObjects.set(object, result_1);
2859
2871
  }
2872
+ return result_1;
2860
2873
  }
2861
2874
  if (includes(objectsInThisPath, object)) {
2862
2875
  return {
@@ -2865,13 +2878,10 @@ var walker = function(object, identities, superJson, path, objectsInThisPath) {
2865
2878
  }
2866
2879
  var transformationResult = transformValue(object, superJson);
2867
2880
  var transformed = (_a = transformationResult === null || transformationResult === void 0 ? void 0 : transformationResult.value) !== null && _a !== void 0 ? _a : object;
2868
- if (!isPrimitive(object)) {
2869
- objectsInThisPath = __spreadArray2(__spreadArray2([], __read3(objectsInThisPath)), [object]);
2870
- }
2871
2881
  var transformedValue = isArray(transformed) ? [] : {};
2872
2882
  var innerAnnotations = {};
2873
2883
  forEach(transformed, function(value, index) {
2874
- var recursiveResult = walker(value, identities, superJson, __spreadArray2(__spreadArray2([], __read3(path)), [index]), objectsInThisPath);
2884
+ var recursiveResult = walker(value, identities, superJson, dedupe, __spreadArray2(__spreadArray2([], __read3(path)), [index]), __spreadArray2(__spreadArray2([], __read3(objectsInThisPath)), [object]), seenObjects);
2875
2885
  transformedValue[index] = recursiveResult.transformedValue;
2876
2886
  if (isArray(recursiveResult.annotations)) {
2877
2887
  innerAnnotations[index] = recursiveResult.annotations;
@@ -2881,17 +2891,17 @@ var walker = function(object, identities, superJson, path, objectsInThisPath) {
2881
2891
  });
2882
2892
  }
2883
2893
  });
2884
- if (isEmptyObject(innerAnnotations)) {
2885
- return {
2886
- transformedValue,
2887
- annotations: !!transformationResult ? [transformationResult.type] : void 0
2888
- };
2889
- } else {
2890
- return {
2891
- transformedValue,
2892
- annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
2893
- };
2894
+ var result = isEmptyObject(innerAnnotations) ? {
2895
+ transformedValue,
2896
+ annotations: !!transformationResult ? [transformationResult.type] : void 0
2897
+ } : {
2898
+ transformedValue,
2899
+ annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
2900
+ };
2901
+ if (!primitive) {
2902
+ seenObjects.set(object, result);
2894
2903
  }
2904
+ return result;
2895
2905
  };
2896
2906
 
2897
2907
  // ../../node_modules/.pnpm/is-what@4.1.15/node_modules/is-what/dist/index.js
@@ -2942,7 +2952,7 @@ function copy(target, options = {}) {
2942
2952
  }, {});
2943
2953
  }
2944
2954
 
2945
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/index.js
2955
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/index.js
2946
2956
  var __assign2 = function() {
2947
2957
  __assign2 = Object.assign || function(t) {
2948
2958
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -2984,25 +2994,27 @@ var __spreadArray3 = function(to, from) {
2984
2994
  var SuperJSON = (
2985
2995
  /** @class */
2986
2996
  function() {
2987
- function SuperJSON2() {
2997
+ function SuperJSON2(_a) {
2998
+ var _b = _a === void 0 ? {} : _a, _c = _b.dedupe, dedupe = _c === void 0 ? false : _c;
2988
2999
  this.classRegistry = new ClassRegistry();
2989
3000
  this.symbolRegistry = new Registry(function(s) {
2990
- var _a;
2991
- return (_a = s.description) !== null && _a !== void 0 ? _a : "";
3001
+ var _a2;
3002
+ return (_a2 = s.description) !== null && _a2 !== void 0 ? _a2 : "";
2992
3003
  });
2993
3004
  this.customTransformerRegistry = new CustomTransformerRegistry();
2994
3005
  this.allowedErrorProps = [];
3006
+ this.dedupe = dedupe;
2995
3007
  }
2996
3008
  SuperJSON2.prototype.serialize = function(object) {
2997
3009
  var identities = /* @__PURE__ */ new Map();
2998
- var output = walker(object, identities, this);
3010
+ var output = walker(object, identities, this, this.dedupe);
2999
3011
  var res = {
3000
3012
  json: output.transformedValue
3001
3013
  };
3002
3014
  if (output.annotations) {
3003
3015
  res.meta = __assign2(__assign2({}, res.meta), { values: output.annotations });
3004
3016
  }
3005
- var equalityAnnotations = generateReferentialEqualityAnnotations(identities);
3017
+ var equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
3006
3018
  if (equalityAnnotations) {
3007
3019
  res.meta = __assign2(__assign2({}, res.meta), { referentialEqualities: equalityAnnotations });
3008
3020
  }
@@ -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++) {
@@ -2602,7 +2602,7 @@ var untransformValue = function(json, type, superJson) {
2602
2602
  }
2603
2603
  };
2604
2604
 
2605
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/accessDeep.js
2605
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/accessDeep.js
2606
2606
  var getNthKey = function(value, n) {
2607
2607
  var keys = value.keys();
2608
2608
  while (n > 0) {
@@ -2716,7 +2716,7 @@ var setDeep = function(object, path, mapper) {
2716
2716
  return object;
2717
2717
  };
2718
2718
 
2719
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/plainer.js
2719
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/plainer.js
2720
2720
  var __read3 = function(o, n) {
2721
2721
  var m = typeof Symbol === "function" && o[Symbol.iterator];
2722
2722
  if (!m)
@@ -2807,22 +2807,25 @@ function addIdentity(object, path, identities) {
2807
2807
  identities.set(object, [path]);
2808
2808
  }
2809
2809
  }
2810
- function generateReferentialEqualityAnnotations(identitites) {
2810
+ function generateReferentialEqualityAnnotations(identitites, dedupe) {
2811
2811
  var result = {};
2812
2812
  var rootEqualityPaths = void 0;
2813
2813
  identitites.forEach(function(paths) {
2814
2814
  if (paths.length <= 1) {
2815
2815
  return;
2816
2816
  }
2817
- var _a = __read3(paths.map(function(path) {
2818
- return path.map(String);
2819
- }).sort(function(a, b) {
2820
- return a.length - b.length;
2821
- })), shortestPath = _a[0], identicalPaths = _a.slice(1);
2822
- if (shortestPath.length === 0) {
2817
+ if (!dedupe) {
2818
+ paths = paths.map(function(path) {
2819
+ return path.map(String);
2820
+ }).sort(function(a, b) {
2821
+ return a.length - b.length;
2822
+ });
2823
+ }
2824
+ var _a = __read3(paths), representativePath = _a[0], identicalPaths = _a.slice(1);
2825
+ if (representativePath.length === 0) {
2823
2826
  rootEqualityPaths = identicalPaths.map(stringifyPath);
2824
2827
  } else {
2825
- result[stringifyPath(shortestPath)] = identicalPaths.map(stringifyPath);
2828
+ result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
2826
2829
  }
2827
2830
  });
2828
2831
  if (rootEqualityPaths) {
@@ -2835,7 +2838,7 @@ function generateReferentialEqualityAnnotations(identitites) {
2835
2838
  return isEmptyObject(result) ? void 0 : result;
2836
2839
  }
2837
2840
  }
2838
- var walker = function(object, identities, superJson, path, objectsInThisPath) {
2841
+ var walker = function(object, identities, superJson, dedupe, path, objectsInThisPath, seenObjects) {
2839
2842
  var _a;
2840
2843
  if (path === void 0) {
2841
2844
  path = [];
@@ -2843,21 +2846,31 @@ var walker = function(object, identities, superJson, path, objectsInThisPath) {
2843
2846
  if (objectsInThisPath === void 0) {
2844
2847
  objectsInThisPath = [];
2845
2848
  }
2846
- if (!isPrimitive(object)) {
2849
+ if (seenObjects === void 0) {
2850
+ seenObjects = /* @__PURE__ */ new Map();
2851
+ }
2852
+ var primitive = isPrimitive(object);
2853
+ if (!primitive) {
2847
2854
  addIdentity(object, path, identities);
2855
+ var seen = seenObjects.get(object);
2856
+ if (seen) {
2857
+ return dedupe ? {
2858
+ transformedValue: null
2859
+ } : seen;
2860
+ }
2848
2861
  }
2849
2862
  if (!isDeep(object, superJson)) {
2850
2863
  var transformed_1 = transformValue(object, superJson);
2851
- if (transformed_1) {
2852
- return {
2853
- transformedValue: transformed_1.value,
2854
- annotations: [transformed_1.type]
2855
- };
2856
- } else {
2857
- return {
2858
- transformedValue: object
2859
- };
2864
+ var result_1 = transformed_1 ? {
2865
+ transformedValue: transformed_1.value,
2866
+ annotations: [transformed_1.type]
2867
+ } : {
2868
+ transformedValue: object
2869
+ };
2870
+ if (!primitive) {
2871
+ seenObjects.set(object, result_1);
2860
2872
  }
2873
+ return result_1;
2861
2874
  }
2862
2875
  if (includes(objectsInThisPath, object)) {
2863
2876
  return {
@@ -2866,13 +2879,10 @@ var walker = function(object, identities, superJson, path, objectsInThisPath) {
2866
2879
  }
2867
2880
  var transformationResult = transformValue(object, superJson);
2868
2881
  var transformed = (_a = transformationResult === null || transformationResult === void 0 ? void 0 : transformationResult.value) !== null && _a !== void 0 ? _a : object;
2869
- if (!isPrimitive(object)) {
2870
- objectsInThisPath = __spreadArray2(__spreadArray2([], __read3(objectsInThisPath)), [object]);
2871
- }
2872
2882
  var transformedValue = isArray(transformed) ? [] : {};
2873
2883
  var innerAnnotations = {};
2874
2884
  forEach(transformed, function(value, index) {
2875
- var recursiveResult = walker(value, identities, superJson, __spreadArray2(__spreadArray2([], __read3(path)), [index]), objectsInThisPath);
2885
+ var recursiveResult = walker(value, identities, superJson, dedupe, __spreadArray2(__spreadArray2([], __read3(path)), [index]), __spreadArray2(__spreadArray2([], __read3(objectsInThisPath)), [object]), seenObjects);
2876
2886
  transformedValue[index] = recursiveResult.transformedValue;
2877
2887
  if (isArray(recursiveResult.annotations)) {
2878
2888
  innerAnnotations[index] = recursiveResult.annotations;
@@ -2882,17 +2892,17 @@ var walker = function(object, identities, superJson, path, objectsInThisPath) {
2882
2892
  });
2883
2893
  }
2884
2894
  });
2885
- if (isEmptyObject(innerAnnotations)) {
2886
- return {
2887
- transformedValue,
2888
- annotations: !!transformationResult ? [transformationResult.type] : void 0
2889
- };
2890
- } else {
2891
- return {
2892
- transformedValue,
2893
- annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
2894
- };
2895
+ var result = isEmptyObject(innerAnnotations) ? {
2896
+ transformedValue,
2897
+ annotations: !!transformationResult ? [transformationResult.type] : void 0
2898
+ } : {
2899
+ transformedValue,
2900
+ annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
2901
+ };
2902
+ if (!primitive) {
2903
+ seenObjects.set(object, result);
2895
2904
  }
2905
+ return result;
2896
2906
  };
2897
2907
 
2898
2908
  // ../../node_modules/.pnpm/is-what@4.1.15/node_modules/is-what/dist/index.js
@@ -2953,7 +2963,7 @@ function copy(target, options = {}) {
2953
2963
  }, {});
2954
2964
  }
2955
2965
 
2956
- // ../../node_modules/.pnpm/superjson@1.12.4/node_modules/superjson/dist/esm/index.js
2966
+ // ../../node_modules/.pnpm/superjson@1.13.3/node_modules/superjson/dist/esm/index.js
2957
2967
  var __assign2 = function() {
2958
2968
  __assign2 = Object.assign || function(t) {
2959
2969
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -2995,25 +3005,27 @@ var __spreadArray3 = function(to, from) {
2995
3005
  var SuperJSON = (
2996
3006
  /** @class */
2997
3007
  function() {
2998
- function SuperJSON2() {
3008
+ function SuperJSON2(_a) {
3009
+ var _b = _a === void 0 ? {} : _a, _c = _b.dedupe, dedupe = _c === void 0 ? false : _c;
2999
3010
  this.classRegistry = new ClassRegistry();
3000
3011
  this.symbolRegistry = new Registry(function(s) {
3001
- var _a;
3002
- return (_a = s.description) !== null && _a !== void 0 ? _a : "";
3012
+ var _a2;
3013
+ return (_a2 = s.description) !== null && _a2 !== void 0 ? _a2 : "";
3003
3014
  });
3004
3015
  this.customTransformerRegistry = new CustomTransformerRegistry();
3005
3016
  this.allowedErrorProps = [];
3017
+ this.dedupe = dedupe;
3006
3018
  }
3007
3019
  SuperJSON2.prototype.serialize = function(object) {
3008
3020
  var identities = /* @__PURE__ */ new Map();
3009
- var output = walker(object, identities, this);
3021
+ var output = walker(object, identities, this, this.dedupe);
3010
3022
  var res = {
3011
3023
  json: output.transformedValue
3012
3024
  };
3013
3025
  if (output.annotations) {
3014
3026
  res.meta = __assign2(__assign2({}, res.meta), { values: output.annotations });
3015
3027
  }
3016
- var equalityAnnotations = generateReferentialEqualityAnnotations(identities);
3028
+ var equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
3017
3029
  if (equalityAnnotations) {
3018
3030
  res.meta = __assign2(__assign2({}, res.meta), { referentialEqualities: equalityAnnotations });
3019
3031
  }