@tanstack/react-router 1.81.10 → 1.81.13

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.
@@ -554,6 +554,7 @@ export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailing
554
554
  hydrate: () => void;
555
555
  injectedHtml: Array<() => string>;
556
556
  injectHtml: (html: string) => void;
557
+ injectScript: (script: string) => void;
557
558
  streamedKeys: Set<string>;
558
559
  getStreamedValue: <T>(key: string) => T | undefined;
559
560
  streamValue: (key: string, value: any) => void;
@@ -554,6 +554,7 @@ export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailing
554
554
  hydrate: () => void;
555
555
  injectedHtml: Array<() => string>;
556
556
  injectHtml: (html: string) => void;
557
+ injectScript: (script: string) => void;
557
558
  streamedKeys: Set<string>;
558
559
  getStreamedValue: <T>(key: string) => T | undefined;
559
560
  streamValue: (key: string, value: any) => void;
@@ -1363,6 +1363,12 @@ class Router {
1363
1363
  };
1364
1364
  this.injectedHtml.push(cb);
1365
1365
  };
1366
+ this.injectScript = (script) => {
1367
+ this.injectHtml(
1368
+ `<script class='tsr-once'>${script}${process.env.NODE_ENV === "development" ? `; console.info(\`Injected From Server:
1369
+ ${script}\`)` : ""}; __TSR__.cleanScripts()<\/script>`
1370
+ );
1371
+ };
1366
1372
  this.streamedKeys = /* @__PURE__ */ new Set();
1367
1373
  this.getStreamedValue = (key) => {
1368
1374
  var _a;
@@ -1385,10 +1391,8 @@ class Router {
1385
1391
  "Key has already been streamed: " + key
1386
1392
  );
1387
1393
  this.streamedKeys.add(key);
1388
- const children = `__TSR__.streamedValues['${key}'] = { value: ${(_a = this.serializer) == null ? void 0 : _a.call(this, this.options.transformer.stringify(value))}}`;
1389
- this.injectHtml(
1390
- `<script class='tsr-once'>${children}${process.env.NODE_ENV === "development" ? `; console.info(\`Injected From Server:
1391
- ${children}\`)` : ""}; __TSR__.cleanScripts()<\/script>`
1394
+ this.injectScript(
1395
+ `__TSR__.streamedValues['${key}'] = { value: ${(_a = this.serializer) == null ? void 0 : _a.call(this, this.options.transformer.stringify(value))}}`
1392
1396
  );
1393
1397
  };
1394
1398
  this._handleNotFound = (matches, err, {