@tanstack/react-router 1.43.4 → 1.43.10

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.
@@ -1,5 +1,6 @@
1
1
  export type Manifest = {
2
2
  routes: Record<string, {
3
+ filePath?: string;
3
4
  preloads?: Array<string>;
4
5
  assets?: Array<RouterManagedTag>;
5
6
  }>;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const history = require("@tanstack/history");
4
4
  const reactStore = require("@tanstack/react-store");
5
5
  const invariant = require("tiny-invariant");
6
+ const warning = require("tiny-warning");
6
7
  const root = require("./root.cjs");
7
8
  const searchParams = require("./searchParams.cjs");
8
9
  const utils = require("./utils.cjs");
@@ -1236,6 +1237,14 @@ class Router {
1236
1237
  this.manifest = ctx.router.manifest;
1237
1238
  };
1238
1239
  this.injectedHtml = [];
1240
+ this.injectHtml = (html) => {
1241
+ const cb = () => {
1242
+ this.injectedHtml = this.injectedHtml.filter((d) => d !== cb);
1243
+ return html;
1244
+ };
1245
+ this.injectedHtml.push(cb);
1246
+ };
1247
+ this.streamedKeys = /* @__PURE__ */ new Set();
1239
1248
  this.getStreamedValue = (key) => {
1240
1249
  var _a;
1241
1250
  if (this.isServer) {
@@ -1252,10 +1261,15 @@ class Router {
1252
1261
  };
1253
1262
  this.streamValue = (key, value) => {
1254
1263
  var _a;
1255
- const children = `window.__TSR__.streamedValues['${key}'] = { value: ${(_a = this.serializer) == null ? void 0 : _a.call(this, this.options.transformer.stringify(value))}}`;
1256
- this.injectedHtml.push(
1264
+ warning(
1265
+ !this.streamedKeys.has(key),
1266
+ "Key has already been streamed: " + key
1267
+ );
1268
+ this.streamedKeys.add(key);
1269
+ const children = `__TSR__.streamedValues['${key}'] = { value: ${(_a = this.serializer) == null ? void 0 : _a.call(this, this.options.transformer.stringify(value))}}`;
1270
+ this.injectHtml(
1257
1271
  `<script class='tsr-once'>${children}${process.env.NODE_ENV === "development" ? `; console.info(\`Injected From Server:
1258
- ${children}\`)` : ""}<\/script>`
1272
+ ${children}\`)` : ""}; __TSR__.cleanScripts()<\/script>`
1259
1273
  );
1260
1274
  };
1261
1275
  this.handleNotFound = (matches, err) => {