@tanstack/router-core 1.131.23 → 1.131.25
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 +25 -25
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/utils.cjs +0 -7
- package/dist/cjs/utils.cjs.map +1 -1
- package/dist/cjs/utils.d.cts +0 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/router.js +26 -26
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/utils.d.ts +0 -1
- package/dist/esm/utils.js +0 -7
- package/dist/esm/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -1
- package/src/router.ts +26 -30
- package/src/utils.ts +0 -10
package/dist/cjs/index.cjs
CHANGED
|
@@ -62,7 +62,6 @@ exports.isModuleNotFoundError = utils.isModuleNotFoundError;
|
|
|
62
62
|
exports.isPlainArray = utils.isPlainArray;
|
|
63
63
|
exports.isPlainObject = utils.isPlainObject;
|
|
64
64
|
exports.last = utils.last;
|
|
65
|
-
exports.pick = utils.pick;
|
|
66
65
|
exports.replaceEqualDeep = utils.replaceEqualDeep;
|
|
67
66
|
exports.shallow = utils.shallow;
|
|
68
67
|
exports.isRedirect = redirect.isRedirect;
|
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
|
@@ -24,7 +24,7 @@ export { retainSearchParams, stripSearchParams } from './searchMiddleware.cjs';
|
|
|
24
24
|
export { defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, } from './searchParams.cjs';
|
|
25
25
|
export type { SearchSerializer, SearchParser } from './searchParams.cjs';
|
|
26
26
|
export type { OptionalStructuralSharing } from './structuralSharing.cjs';
|
|
27
|
-
export { last, functionalUpdate,
|
|
27
|
+
export { last, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, escapeJSON, shallow, createControlledPromise, isModuleNotFoundError, } from './utils.cjs';
|
|
28
28
|
export type { NoInfer, IsAny, PickAsRequired, PickRequired, PickOptional, WithoutEmpty, Expand, DeepPartial, MakeDifferenceOptional, IsUnion, IsNonEmptyObject, Assign, IntersectAssign, Timeout, Updater, NonNullableUpdater, StringLiteral, ThrowOrOptional, ThrowConstraint, ControlledPromise, ExtractObjects, PartialMergeAllObject, MergeAllPrimitive, ExtractPrimitives, PartialMergeAll, Constrain, ConstrainLiteral, UnionToIntersection, MergeAllObjects, MergeAll, ValidateJSON, StrictOrFrom, LooseReturnType, LooseAsyncReturnType, Awaitable, } from './utils.cjs';
|
|
29
29
|
export type { StandardSchemaValidatorProps, StandardSchemaValidator, AnyStandardSchemaValidator, StandardSchemaValidatorTypes, AnyStandardSchemaValidateSuccess, AnyStandardSchemaValidateFailure, AnyStandardSchemaValidateIssue, AnyStandardSchemaValidateInput, AnyStandardSchemaValidate, ValidatorObj, AnyValidatorObj, ValidatorAdapter, AnyValidatorAdapter, AnyValidatorFn, ValidatorFn, Validator, AnyValidator, AnySchema, DefaultValidator, ResolveSearchValidatorInputFn, ResolveSearchValidatorInput, ResolveValidatorInputFn, ResolveValidatorInput, ResolveValidatorOutputFn, ResolveValidatorOutput, } from './validators.cjs';
|
|
30
30
|
export type { UseRouteContextBaseOptions, UseRouteContextOptions, UseRouteContextResult, } from './useRouteContext.cjs';
|
package/dist/cjs/router.cjs
CHANGED
|
@@ -231,7 +231,7 @@ class RouterCore {
|
|
|
231
231
|
};
|
|
232
232
|
this.buildLocation = (opts) => {
|
|
233
233
|
const build = (dest = {}) => {
|
|
234
|
-
var _a;
|
|
234
|
+
var _a, _b;
|
|
235
235
|
const currentLocation = dest._fromLocation || this.latestLocation;
|
|
236
236
|
const allCurrentLocationMatches = this.matchRoutes(currentLocation, {
|
|
237
237
|
_buildLocation: true
|
|
@@ -264,51 +264,51 @@ class RouterCore {
|
|
|
264
264
|
const fromSearch = lastMatch.search;
|
|
265
265
|
const fromParams = { ...lastMatch.params };
|
|
266
266
|
const nextTo = dest.to ? this.resolvePathWithBase(fromPath, `${dest.to}`) : this.resolvePathWithBase(fromPath, ".");
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
267
|
+
const nextParams = dest.params === false || dest.params === null ? {} : (dest.params ?? true) === true ? fromParams : Object.assign(
|
|
268
|
+
fromParams,
|
|
269
|
+
utils.functionalUpdate(dest.params, fromParams)
|
|
270
|
+
);
|
|
271
271
|
const interpolatedNextTo = path.interpolatePath({
|
|
272
272
|
path: nextTo,
|
|
273
|
-
params: nextParams
|
|
273
|
+
params: nextParams,
|
|
274
274
|
parseCache: this.parsePathnameCache
|
|
275
275
|
}).interpolatedPath;
|
|
276
276
|
const destRoutes = this.matchRoutes(interpolatedNextTo, void 0, {
|
|
277
277
|
_buildLocation: true
|
|
278
278
|
}).map((d) => this.looseRoutesById[d.routeId]);
|
|
279
279
|
if (Object.keys(nextParams).length > 0) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
280
|
+
for (const route of destRoutes) {
|
|
281
|
+
const fn = ((_a = route.options.params) == null ? void 0 : _a.stringify) ?? route.options.stringifyParams;
|
|
282
|
+
if (fn) {
|
|
283
|
+
Object.assign(nextParams, fn(nextParams));
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
286
|
}
|
|
287
287
|
const nextPathname = path.interpolatePath({
|
|
288
288
|
// Use the original template path for interpolation
|
|
289
289
|
// This preserves the original parameter syntax including optional parameters
|
|
290
290
|
path: nextTo,
|
|
291
|
-
params: nextParams
|
|
291
|
+
params: nextParams,
|
|
292
292
|
leaveWildcards: false,
|
|
293
293
|
leaveParams: opts.leaveParams,
|
|
294
294
|
decodeCharMap: this.pathParamsDecodeCharMap,
|
|
295
295
|
parseCache: this.parsePathnameCache
|
|
296
296
|
}).interpolatedPath;
|
|
297
297
|
let nextSearch = fromSearch;
|
|
298
|
-
if (opts._includeValidateSearch && ((
|
|
299
|
-
|
|
298
|
+
if (opts._includeValidateSearch && ((_b = this.options.search) == null ? void 0 : _b.strict)) {
|
|
299
|
+
const validatedSearch = {};
|
|
300
300
|
destRoutes.forEach((route) => {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
301
|
+
if (route.options.validateSearch) {
|
|
302
|
+
try {
|
|
303
|
+
Object.assign(
|
|
304
|
+
validatedSearch,
|
|
305
|
+
validateSearch(route.options.validateSearch, {
|
|
306
306
|
...validatedSearch,
|
|
307
307
|
...nextSearch
|
|
308
|
-
})
|
|
309
|
-
|
|
308
|
+
})
|
|
309
|
+
);
|
|
310
|
+
} catch {
|
|
310
311
|
}
|
|
311
|
-
} catch {
|
|
312
312
|
}
|
|
313
313
|
});
|
|
314
314
|
nextSearch = validatedSearch;
|
|
@@ -361,7 +361,7 @@ class RouterCore {
|
|
|
361
361
|
if (foundMask) {
|
|
362
362
|
const { from: _from, ...maskProps } = foundMask;
|
|
363
363
|
maskedDest = {
|
|
364
|
-
|
|
364
|
+
from: opts.from,
|
|
365
365
|
...maskProps,
|
|
366
366
|
params
|
|
367
367
|
};
|
|
@@ -376,7 +376,7 @@ class RouterCore {
|
|
|
376
376
|
};
|
|
377
377
|
if (opts.mask) {
|
|
378
378
|
return buildWithMatches(opts, {
|
|
379
|
-
|
|
379
|
+
from: opts.from,
|
|
380
380
|
...opts.mask
|
|
381
381
|
});
|
|
382
382
|
}
|