@tanstack/router-core 1.132.30 → 1.132.33
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/index.cjs +0 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/router.cjs +35 -13
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +2 -16
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/router.d.ts +2 -16
- package/dist/esm/router.js +36 -14
- package/dist/esm/router.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +0 -1
- package/src/router.ts +51 -31
package/dist/cjs/index.cjs
CHANGED
|
@@ -87,5 +87,4 @@ exports.defaultSerovalPlugins = serovalPlugins.defaultSerovalPlugins;
|
|
|
87
87
|
exports.composeRewrites = rewrite.composeRewrites;
|
|
88
88
|
exports.executeRewriteInput = rewrite.executeRewriteInput;
|
|
89
89
|
exports.executeRewriteOutput = rewrite.executeRewriteOutput;
|
|
90
|
-
exports.rewriteBasepath = rewrite.rewriteBasepath;
|
|
91
90
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -46,5 +46,5 @@ export type { ValidateFromPath, ValidateToPath, ValidateSearch, ValidateParams,
|
|
|
46
46
|
export type { AnySerializationAdapter, SerializationAdapter, ValidateSerializableInput, ValidateSerializableInputResult, SerializerExtensions, ValidateSerializable, RegisteredSerializableInput, SerializableExtensions, DefaultSerializable, Serializable, } from './ssr/serializer/transformer.cjs';
|
|
47
47
|
export { createSerializationAdapter, makeSerovalPlugin, makeSsrSerovalPlugin, } from './ssr/serializer/transformer.cjs';
|
|
48
48
|
export { defaultSerovalPlugins } from './ssr/serializer/seroval-plugins.cjs';
|
|
49
|
-
export {
|
|
49
|
+
export { composeRewrites, executeRewriteInput, executeRewriteOutput, } from './rewrite.cjs';
|
|
50
50
|
export type { LocationRewrite, LocationRewriteFunction } from './router.cjs';
|
package/dist/cjs/router.cjs
CHANGED
|
@@ -57,8 +57,12 @@ class RouterCore {
|
|
|
57
57
|
"The notFoundRoute API is deprecated and will be removed in the next major version. See https://tanstack.com/router/v1/docs/framework/react/guide/not-found-errors#migrating-from-notfoundroute for more info."
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
|
+
const prevOptions = this.options;
|
|
61
|
+
const prevBasepath = this.basepath ?? prevOptions?.basepath ?? "/";
|
|
62
|
+
const basepathWasUnset = this.basepath === void 0;
|
|
63
|
+
const prevRewriteOption = prevOptions?.rewrite;
|
|
60
64
|
this.options = {
|
|
61
|
-
...
|
|
65
|
+
...prevOptions,
|
|
62
66
|
...newOptions
|
|
63
67
|
};
|
|
64
68
|
this.isServer = this.options.isServer ?? typeof document === "undefined";
|
|
@@ -77,18 +81,6 @@ class RouterCore {
|
|
|
77
81
|
this.history = this.options.history;
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
|
-
if (this.options.basepath) {
|
|
81
|
-
const basepathRewrite = rewrite.rewriteBasepath({
|
|
82
|
-
basepath: this.options.basepath
|
|
83
|
-
});
|
|
84
|
-
if (this.options.rewrite) {
|
|
85
|
-
this.rewrite = rewrite.composeRewrites([basepathRewrite, this.options.rewrite]);
|
|
86
|
-
} else {
|
|
87
|
-
this.rewrite = basepathRewrite;
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
this.rewrite = this.options.rewrite;
|
|
91
|
-
}
|
|
92
84
|
this.origin = this.options.origin;
|
|
93
85
|
if (!this.origin) {
|
|
94
86
|
if (!this.isServer) {
|
|
@@ -117,6 +109,36 @@ class RouterCore {
|
|
|
117
109
|
});
|
|
118
110
|
scrollRestoration.setupScrollRestoration(this);
|
|
119
111
|
}
|
|
112
|
+
let needsLocationUpdate = false;
|
|
113
|
+
const nextBasepath = this.options.basepath ?? "/";
|
|
114
|
+
const nextRewriteOption = this.options.rewrite;
|
|
115
|
+
const basepathChanged = basepathWasUnset || prevBasepath !== nextBasepath;
|
|
116
|
+
const rewriteChanged = prevRewriteOption !== nextRewriteOption;
|
|
117
|
+
if (basepathChanged || rewriteChanged) {
|
|
118
|
+
this.basepath = nextBasepath;
|
|
119
|
+
const rewrites = [];
|
|
120
|
+
if (path.trimPath(nextBasepath) !== "") {
|
|
121
|
+
rewrites.push(
|
|
122
|
+
rewrite.rewriteBasepath({
|
|
123
|
+
basepath: nextBasepath
|
|
124
|
+
})
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
if (nextRewriteOption) {
|
|
128
|
+
rewrites.push(nextRewriteOption);
|
|
129
|
+
}
|
|
130
|
+
this.rewrite = rewrites.length === 0 ? void 0 : rewrites.length === 1 ? rewrites[0] : rewrite.composeRewrites(rewrites);
|
|
131
|
+
if (this.history) {
|
|
132
|
+
this.updateLatestLocation();
|
|
133
|
+
}
|
|
134
|
+
needsLocationUpdate = true;
|
|
135
|
+
}
|
|
136
|
+
if (needsLocationUpdate && this.__store) {
|
|
137
|
+
this.__store.state = {
|
|
138
|
+
...this.state,
|
|
139
|
+
location: this.latestLocation
|
|
140
|
+
};
|
|
141
|
+
}
|
|
120
142
|
if (typeof window !== "undefined" && "CSS" in window && typeof window.CSS?.supports === "function") {
|
|
121
143
|
this.isViewTransitionTypesSupported = window.CSS.supports(
|
|
122
144
|
"selector(:active-view-transition-type(a)"
|