@tanstack/router-core 1.168.2 → 1.168.3

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.
@@ -13,6 +13,7 @@ const require_stores = require("./stores.cjs");
13
13
  const require_router = require("./router.cjs");
14
14
  const require_defer = require("./defer.cjs");
15
15
  const require_link = require("./link.cjs");
16
+ const require_manifest = require("./manifest.cjs");
16
17
  const require_Matches = require("./Matches.cjs");
17
18
  const require_route = require("./route.cjs");
18
19
  const require_config = require("./config.cjs");
@@ -52,6 +53,7 @@ exports.escapeHtml = require_utils.escapeHtml;
52
53
  exports.exactPathTest = require_path.exactPathTest;
53
54
  exports.executeRewriteInput = require_rewrite.executeRewriteInput;
54
55
  exports.functionalUpdate = require_utils.functionalUpdate;
56
+ exports.getAssetCrossOrigin = require_manifest.getAssetCrossOrigin;
55
57
  exports.getCssSelector = require_scroll_restoration.getCssSelector;
56
58
  exports.getInitialRouterState = require_router.getInitialRouterState;
57
59
  exports.getLocationChangeInfo = require_router.getLocationChangeInfo;
@@ -78,6 +80,7 @@ exports.preloadWarning = require_link.preloadWarning;
78
80
  exports.redirect = require_redirect.redirect;
79
81
  exports.removeTrailingSlash = require_path.removeTrailingSlash;
80
82
  exports.replaceEqualDeep = require_utils.replaceEqualDeep;
83
+ exports.resolveManifestAssetLink = require_manifest.resolveManifestAssetLink;
81
84
  exports.resolvePath = require_path.resolvePath;
82
85
  exports.restoreScroll = require_scroll_restoration.restoreScroll;
83
86
  exports.retainSearchParams = require_searchMiddleware.retainSearchParams;
@@ -7,7 +7,8 @@ export type { IsRequiredParams, AddTrailingSlash, RemoveTrailingSlashes, AddLead
7
7
  export type { RouteToPath, TrailingSlashOptionByRouter, ParseRoute, CodeRouteToPath, RouteIds, FullSearchSchema, FullSearchSchemaInput, AllParams, RouteById, AllContext, RoutePaths, RoutesById, RoutesByPath, AllLoaderData, RouteByPath, } from './routeInfo.cjs';
8
8
  export type { InferFileRouteTypes, FileRouteTypes, FileRoutesByPath, CreateFileRoute, LazyRoute, LazyRouteOptions, CreateLazyFileRoute, } from './fileRoute.cjs';
9
9
  export type { ParsedLocation } from './location.cjs';
10
- export type { Manifest, RouterManagedTag } from './manifest.cjs';
10
+ export type { Manifest, RouterManagedTag, AssetCrossOrigin, AssetCrossOriginConfig, ManifestAssetLink, } from './manifest.cjs';
11
+ export { getAssetCrossOrigin, resolveManifestAssetLink } from './manifest.cjs';
11
12
  export { isMatch } from './Matches.cjs';
12
13
  export type { AnyMatchAndValue, FindValueByIndex, FindValueByKey, CreateMatchAndValue, NextMatchAndValue, IsMatchKeyOf, IsMatchPath, IsMatchResult, IsMatchParse, IsMatch, RouteMatch, RouteMatchExtensions, MakeRouteMatchUnion, MakeRouteMatch, AnyRouteMatch, MakeRouteMatchFromRoute, MatchRouteOptions, } from './Matches.cjs';
13
14
  export { joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, removeTrailingSlash, exactPathTest, resolvePath, interpolatePath, } from './path.cjs';
@@ -0,0 +1,18 @@
1
+ //#region src/manifest.ts
2
+ function getAssetCrossOrigin(assetCrossOrigin, kind) {
3
+ if (!assetCrossOrigin) return;
4
+ if (typeof assetCrossOrigin === "string") return assetCrossOrigin;
5
+ return assetCrossOrigin[kind];
6
+ }
7
+ function resolveManifestAssetLink(link) {
8
+ if (typeof link === "string") return {
9
+ href: link,
10
+ crossOrigin: void 0
11
+ };
12
+ return link;
13
+ }
14
+ //#endregion
15
+ exports.getAssetCrossOrigin = getAssetCrossOrigin;
16
+ exports.resolveManifestAssetLink = resolveManifestAssetLink;
17
+
18
+ //# sourceMappingURL=manifest.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.cjs","names":[],"sources":["../../src/manifest.ts"],"sourcesContent":["export type AssetCrossOrigin = 'anonymous' | 'use-credentials'\n\nexport type AssetCrossOriginConfig =\n | AssetCrossOrigin\n | Partial<Record<'modulepreload' | 'stylesheet', AssetCrossOrigin>>\n\nexport type ManifestAssetLink =\n | string\n | {\n href: string\n crossOrigin?: AssetCrossOrigin\n }\n\nexport function getAssetCrossOrigin(\n assetCrossOrigin: AssetCrossOriginConfig | undefined,\n kind: 'modulepreload' | 'stylesheet',\n): AssetCrossOrigin | undefined {\n if (!assetCrossOrigin) {\n return undefined\n }\n\n if (typeof assetCrossOrigin === 'string') {\n return assetCrossOrigin\n }\n\n return assetCrossOrigin[kind]\n}\n\nexport function resolveManifestAssetLink(link: ManifestAssetLink) {\n if (typeof link === 'string') {\n return { href: link, crossOrigin: undefined }\n }\n\n return link\n}\n\nexport type Manifest = {\n routes: Record<\n string,\n {\n filePath?: string\n preloads?: Array<ManifestAssetLink>\n assets?: Array<RouterManagedTag>\n }\n >\n}\n\nexport type RouterManagedTag =\n | {\n tag: 'title'\n attrs?: Record<string, any>\n children: string\n }\n | {\n tag: 'meta' | 'link'\n attrs?: Record<string, any>\n children?: never\n }\n | {\n tag: 'script'\n attrs?: Record<string, any>\n children?: string\n }\n | {\n tag: 'style'\n attrs?: Record<string, any>\n children?: string\n }\n"],"mappings":";AAaA,SAAgB,oBACd,kBACA,MAC8B;AAC9B,KAAI,CAAC,iBACH;AAGF,KAAI,OAAO,qBAAqB,SAC9B,QAAO;AAGT,QAAO,iBAAiB;;AAG1B,SAAgB,yBAAyB,MAAyB;AAChE,KAAI,OAAO,SAAS,SAClB,QAAO;EAAE,MAAM;EAAM,aAAa,KAAA;EAAW;AAG/C,QAAO"}
@@ -1,7 +1,18 @@
1
+ export type AssetCrossOrigin = 'anonymous' | 'use-credentials';
2
+ export type AssetCrossOriginConfig = AssetCrossOrigin | Partial<Record<'modulepreload' | 'stylesheet', AssetCrossOrigin>>;
3
+ export type ManifestAssetLink = string | {
4
+ href: string;
5
+ crossOrigin?: AssetCrossOrigin;
6
+ };
7
+ export declare function getAssetCrossOrigin(assetCrossOrigin: AssetCrossOriginConfig | undefined, kind: 'modulepreload' | 'stylesheet'): AssetCrossOrigin | undefined;
8
+ export declare function resolveManifestAssetLink(link: ManifestAssetLink): {
9
+ href: string;
10
+ crossOrigin?: AssetCrossOrigin;
11
+ };
1
12
  export type Manifest = {
2
13
  routes: Record<string, {
3
14
  filePath?: string;
4
- preloads?: Array<string>;
15
+ preloads?: Array<ManifestAssetLink>;
5
16
  assets?: Array<RouterManagedTag>;
6
17
  }>;
7
18
  };
@@ -7,7 +7,8 @@ export type { IsRequiredParams, AddTrailingSlash, RemoveTrailingSlashes, AddLead
7
7
  export type { RouteToPath, TrailingSlashOptionByRouter, ParseRoute, CodeRouteToPath, RouteIds, FullSearchSchema, FullSearchSchemaInput, AllParams, RouteById, AllContext, RoutePaths, RoutesById, RoutesByPath, AllLoaderData, RouteByPath, } from './routeInfo.js';
8
8
  export type { InferFileRouteTypes, FileRouteTypes, FileRoutesByPath, CreateFileRoute, LazyRoute, LazyRouteOptions, CreateLazyFileRoute, } from './fileRoute.js';
9
9
  export type { ParsedLocation } from './location.js';
10
- export type { Manifest, RouterManagedTag } from './manifest.js';
10
+ export type { Manifest, RouterManagedTag, AssetCrossOrigin, AssetCrossOriginConfig, ManifestAssetLink, } from './manifest.js';
11
+ export { getAssetCrossOrigin, resolveManifestAssetLink } from './manifest.js';
11
12
  export { isMatch } from './Matches.js';
12
13
  export type { AnyMatchAndValue, FindValueByIndex, FindValueByKey, CreateMatchAndValue, NextMatchAndValue, IsMatchKeyOf, IsMatchPath, IsMatchResult, IsMatchParse, IsMatch, RouteMatch, RouteMatchExtensions, MakeRouteMatchUnion, MakeRouteMatch, AnyRouteMatch, MakeRouteMatchFromRoute, MatchRouteOptions, } from './Matches.js';
13
14
  export { joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, removeTrailingSlash, exactPathTest, resolvePath, interpolatePath, } from './path.js';
package/dist/esm/index.js CHANGED
@@ -12,6 +12,7 @@ import { createNonReactiveMutableStore, createNonReactiveReadonlyStore } from ".
12
12
  import { PathParamError, RouterCore, SearchParamError, defaultSerializeError, getInitialRouterState, getLocationChangeInfo, getMatchedRoutes, lazyFn, trailingSlashOptions } from "./router.js";
13
13
  import { TSR_DEFERRED_PROMISE, defer } from "./defer.js";
14
14
  import { preloadWarning } from "./link.js";
15
+ import { getAssetCrossOrigin, resolveManifestAssetLink } from "./manifest.js";
15
16
  import { isMatch } from "./Matches.js";
16
17
  import { BaseRootRoute, BaseRoute, BaseRouteApi } from "./route.js";
17
18
  import { createRouterConfig } from "./config.js";
@@ -19,4 +20,4 @@ import { retainSearchParams, stripSearchParams } from "./searchMiddleware.js";
19
20
  import { createSerializationAdapter, makeSerovalPlugin, makeSsrSerovalPlugin } from "./ssr/serializer/transformer.js";
20
21
  import { RawStream, createRawStreamDeserializePlugin, createRawStreamRPCPlugin } from "./ssr/serializer/RawStream.js";
21
22
  import { defaultSerovalPlugins } from "./ssr/serializer/seroval-plugins.js";
22
- export { BaseRootRoute, BaseRoute, BaseRouteApi, DEFAULT_PROTOCOL_ALLOWLIST, PathParamError, RawStream, RouterCore, SearchParamError, TSR_DEFERRED_PROMISE, buildDevStylesUrl, cleanPath, composeRewrites, createControlledPromise, createNonReactiveMutableStore, createNonReactiveReadonlyStore, createRawStreamDeserializePlugin, createRawStreamRPCPlugin, createRouterConfig, createSerializationAdapter, decode, deepEqual, defaultGetScrollRestorationKey, defaultParseSearch, defaultSerializeError, defaultSerovalPlugins, defaultStringifySearch, defer, encode, escapeHtml, exactPathTest, executeRewriteInput, functionalUpdate, getCssSelector, getInitialRouterState, getLocationChangeInfo, getMatchedRoutes, handleHashScroll, interpolatePath, invariant, isDangerousProtocol, isMatch, isModuleNotFoundError, isNotFound, isPlainArray, isPlainObject, isRedirect, isResolvedRedirect, joinPaths, lazyFn, makeSerovalPlugin, makeSsrSerovalPlugin, notFound, parseRedirect, parseSearchWith, preloadWarning, redirect, removeTrailingSlash, replaceEqualDeep, resolvePath, restoreScroll, retainSearchParams, rootRouteId, scrollRestorationCache, setupScrollRestoration, storageKey, stringifySearchWith, stripSearchParams, trailingSlashOptions, trimPath, trimPathLeft, trimPathRight };
23
+ export { BaseRootRoute, BaseRoute, BaseRouteApi, DEFAULT_PROTOCOL_ALLOWLIST, PathParamError, RawStream, RouterCore, SearchParamError, TSR_DEFERRED_PROMISE, buildDevStylesUrl, cleanPath, composeRewrites, createControlledPromise, createNonReactiveMutableStore, createNonReactiveReadonlyStore, createRawStreamDeserializePlugin, createRawStreamRPCPlugin, createRouterConfig, createSerializationAdapter, decode, deepEqual, defaultGetScrollRestorationKey, defaultParseSearch, defaultSerializeError, defaultSerovalPlugins, defaultStringifySearch, defer, encode, escapeHtml, exactPathTest, executeRewriteInput, functionalUpdate, getAssetCrossOrigin, getCssSelector, getInitialRouterState, getLocationChangeInfo, getMatchedRoutes, handleHashScroll, interpolatePath, invariant, isDangerousProtocol, isMatch, isModuleNotFoundError, isNotFound, isPlainArray, isPlainObject, isRedirect, isResolvedRedirect, joinPaths, lazyFn, makeSerovalPlugin, makeSsrSerovalPlugin, notFound, parseRedirect, parseSearchWith, preloadWarning, redirect, removeTrailingSlash, replaceEqualDeep, resolveManifestAssetLink, resolvePath, restoreScroll, retainSearchParams, rootRouteId, scrollRestorationCache, setupScrollRestoration, storageKey, stringifySearchWith, stripSearchParams, trailingSlashOptions, trimPath, trimPathLeft, trimPathRight };
@@ -1,7 +1,18 @@
1
+ export type AssetCrossOrigin = 'anonymous' | 'use-credentials';
2
+ export type AssetCrossOriginConfig = AssetCrossOrigin | Partial<Record<'modulepreload' | 'stylesheet', AssetCrossOrigin>>;
3
+ export type ManifestAssetLink = string | {
4
+ href: string;
5
+ crossOrigin?: AssetCrossOrigin;
6
+ };
7
+ export declare function getAssetCrossOrigin(assetCrossOrigin: AssetCrossOriginConfig | undefined, kind: 'modulepreload' | 'stylesheet'): AssetCrossOrigin | undefined;
8
+ export declare function resolveManifestAssetLink(link: ManifestAssetLink): {
9
+ href: string;
10
+ crossOrigin?: AssetCrossOrigin;
11
+ };
1
12
  export type Manifest = {
2
13
  routes: Record<string, {
3
14
  filePath?: string;
4
- preloads?: Array<string>;
15
+ preloads?: Array<ManifestAssetLink>;
5
16
  assets?: Array<RouterManagedTag>;
6
17
  }>;
7
18
  };
@@ -0,0 +1,17 @@
1
+ //#region src/manifest.ts
2
+ function getAssetCrossOrigin(assetCrossOrigin, kind) {
3
+ if (!assetCrossOrigin) return;
4
+ if (typeof assetCrossOrigin === "string") return assetCrossOrigin;
5
+ return assetCrossOrigin[kind];
6
+ }
7
+ function resolveManifestAssetLink(link) {
8
+ if (typeof link === "string") return {
9
+ href: link,
10
+ crossOrigin: void 0
11
+ };
12
+ return link;
13
+ }
14
+ //#endregion
15
+ export { getAssetCrossOrigin, resolveManifestAssetLink };
16
+
17
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","names":[],"sources":["../../src/manifest.ts"],"sourcesContent":["export type AssetCrossOrigin = 'anonymous' | 'use-credentials'\n\nexport type AssetCrossOriginConfig =\n | AssetCrossOrigin\n | Partial<Record<'modulepreload' | 'stylesheet', AssetCrossOrigin>>\n\nexport type ManifestAssetLink =\n | string\n | {\n href: string\n crossOrigin?: AssetCrossOrigin\n }\n\nexport function getAssetCrossOrigin(\n assetCrossOrigin: AssetCrossOriginConfig | undefined,\n kind: 'modulepreload' | 'stylesheet',\n): AssetCrossOrigin | undefined {\n if (!assetCrossOrigin) {\n return undefined\n }\n\n if (typeof assetCrossOrigin === 'string') {\n return assetCrossOrigin\n }\n\n return assetCrossOrigin[kind]\n}\n\nexport function resolveManifestAssetLink(link: ManifestAssetLink) {\n if (typeof link === 'string') {\n return { href: link, crossOrigin: undefined }\n }\n\n return link\n}\n\nexport type Manifest = {\n routes: Record<\n string,\n {\n filePath?: string\n preloads?: Array<ManifestAssetLink>\n assets?: Array<RouterManagedTag>\n }\n >\n}\n\nexport type RouterManagedTag =\n | {\n tag: 'title'\n attrs?: Record<string, any>\n children: string\n }\n | {\n tag: 'meta' | 'link'\n attrs?: Record<string, any>\n children?: never\n }\n | {\n tag: 'script'\n attrs?: Record<string, any>\n children?: string\n }\n | {\n tag: 'style'\n attrs?: Record<string, any>\n children?: string\n }\n"],"mappings":";AAaA,SAAgB,oBACd,kBACA,MAC8B;AAC9B,KAAI,CAAC,iBACH;AAGF,KAAI,OAAO,qBAAqB,SAC9B,QAAO;AAGT,QAAO,iBAAiB;;AAG1B,SAAgB,yBAAyB,MAAyB;AAChE,KAAI,OAAO,SAAS,SAClB,QAAO;EAAE,MAAM;EAAM,aAAa,KAAA;EAAW;AAG/C,QAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/router-core",
3
- "version": "1.168.2",
3
+ "version": "1.168.3",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -68,7 +68,14 @@ export type {
68
68
  } from './fileRoute'
69
69
 
70
70
  export type { ParsedLocation } from './location'
71
- export type { Manifest, RouterManagedTag } from './manifest'
71
+ export type {
72
+ Manifest,
73
+ RouterManagedTag,
74
+ AssetCrossOrigin,
75
+ AssetCrossOriginConfig,
76
+ ManifestAssetLink,
77
+ } from './manifest'
78
+ export { getAssetCrossOrigin, resolveManifestAssetLink } from './manifest'
72
79
  export { isMatch } from './Matches'
73
80
  export type {
74
81
  AnyMatchAndValue,
package/src/manifest.ts CHANGED
@@ -1,9 +1,45 @@
1
+ export type AssetCrossOrigin = 'anonymous' | 'use-credentials'
2
+
3
+ export type AssetCrossOriginConfig =
4
+ | AssetCrossOrigin
5
+ | Partial<Record<'modulepreload' | 'stylesheet', AssetCrossOrigin>>
6
+
7
+ export type ManifestAssetLink =
8
+ | string
9
+ | {
10
+ href: string
11
+ crossOrigin?: AssetCrossOrigin
12
+ }
13
+
14
+ export function getAssetCrossOrigin(
15
+ assetCrossOrigin: AssetCrossOriginConfig | undefined,
16
+ kind: 'modulepreload' | 'stylesheet',
17
+ ): AssetCrossOrigin | undefined {
18
+ if (!assetCrossOrigin) {
19
+ return undefined
20
+ }
21
+
22
+ if (typeof assetCrossOrigin === 'string') {
23
+ return assetCrossOrigin
24
+ }
25
+
26
+ return assetCrossOrigin[kind]
27
+ }
28
+
29
+ export function resolveManifestAssetLink(link: ManifestAssetLink) {
30
+ if (typeof link === 'string') {
31
+ return { href: link, crossOrigin: undefined }
32
+ }
33
+
34
+ return link
35
+ }
36
+
1
37
  export type Manifest = {
2
38
  routes: Record<
3
39
  string,
4
40
  {
5
41
  filePath?: string
6
- preloads?: Array<string>
42
+ preloads?: Array<ManifestAssetLink>
7
43
  assets?: Array<RouterManagedTag>
8
44
  }
9
45
  >