@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.
- package/dist/cjs/manifest.d.cts +1 -0
- package/dist/cjs/router.cjs +17 -3
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +3 -1
- package/dist/esm/manifest.d.ts +1 -0
- package/dist/esm/router.d.ts +3 -1
- package/dist/esm/router.js +17 -3
- package/dist/esm/router.js.map +1 -1
- package/package.json +1 -1
- package/src/manifest.ts +1 -0
- package/src/router.ts +22 -5
package/dist/cjs/manifest.d.cts
CHANGED
package/dist/cjs/router.cjs
CHANGED
|
@@ -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
|
-
|
|
1256
|
-
|
|
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) => {
|