@sveltekit-i18n/base 3.0.1 → 3.1.0-next.1

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/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { I18n } from './I18n.svelte.js';
1
2
  export declare namespace DotNotation {
2
3
  type Input = any;
3
4
  type Output<V = any, K extends keyof V = keyof V> = {
@@ -48,11 +49,13 @@ export declare namespace Config {
48
49
  } ? L : never;
49
50
  type LocaleSources<C> = (C extends {
50
51
  loaders: readonly {
51
- locale: infer L extends string;
52
+ locale: infer L;
52
53
  }[];
53
- } ? L : never) | (C extends {
54
+ } ? LoaderLocales<L> : never) | (C extends {
54
55
  translations: infer T;
55
56
  } ? keyof T & string : never) | LocaleProp<C, 'initLocale'> | LocaleProp<C, 'fallbackLocale'>;
57
+ /** A loader's `locale`, spelled as one locale or as several. */
58
+ type LoaderLocales<L> = L extends readonly (infer M)[] ? M : L;
56
59
  type ResolveLocales<L> = L extends string ? L : never;
57
60
  /**
58
61
  * The locales a config type spells – loader locales, `initLocale`,
@@ -67,11 +70,11 @@ export declare namespace Config {
67
70
  export type SanitizeLocales = boolean | ((locale: Locale) => Locale);
68
71
  export type T<P extends Parser.Params = Parser.Params, O = Parser.Output, S = any> = {
69
72
  /**
70
- * You can use loaders to define your asyncronous translation load. All loaded data are stored so loader is triggered only once – in case there is no previous version of the translation. It can get triggered again once the `config.cache` window elapses, or after `invalidate()` is called.
73
+ * You can use loaders to define your asyncronous translation load. All loaded data are stored so loader is triggered only once – in case there is no previous version of the translation. It can get triggered again when the params its `routes` capture change, once the `config.cache` window elapses, or after `invalidate()` is called. A loader with `cache: false` runs on every load trigger that selects it.
71
74
  */
72
75
  loaders?: readonly Loader.LoaderModule[];
73
76
  /**
74
- * Locale-indexed translations, which should be in place before loaders will trigger. It's useful for static pages and synchronous translations – for example locally defined language names which are the same for all of the language mutations.
77
+ * Locale-indexed translations, in place before any loader runs. They seed the tables: they record nothing, so the loaders of a namespace they name still run and their data merges in. Useful for static pages and synchronous translations – for example locally defined language names which are the same for all of the language mutations. Hand server-rendered data over with `hydrate()` instead.
75
78
  *
76
79
  * @example {
77
80
  * "en": {"lang": {"en": "English", "cs": "Česky"}}
@@ -80,7 +83,7 @@ export declare namespace Config {
80
83
  */
81
84
  translations?: Translations.T;
82
85
  /**
83
- * If you set this property, translations will be initialized immediately using this locale.
86
+ * If you set this property, translations will be initialized immediately using this locale. `defineI18n()` from `/kit` loads nothing for it: there it is a negotiation candidate. Leave it out of a config whose instance you `hydrate()` by hand – its load starts in the constructor, before the hand-off can be applied.
84
87
  */
85
88
  initLocale?: InitLocale;
86
89
  /**
@@ -133,8 +136,9 @@ export declare namespace Config {
133
136
  * `export const schema = {} as TranslationSchema`. A schema whose keys are not a
134
137
  * closed set (an open index signature, or no keys at all) is ignored and
135
138
  * keys stay plain strings. Read at construction time only: a later
136
- * `loadConfig()` cannot retype the instance, and `config.extensions`
137
- * erases the instance's type parameters entirely.
139
+ * `loadConfig()` cannot retype the instance, and an extension typed by a
140
+ * fixed return type erases the instance's type parameters, while one
141
+ * typed by an `Extension.Operator` (`Extension.Generic`) keeps them.
138
142
  *
139
143
  * @example
140
144
  * import { schema } from './generated/i18n-schema.js';
@@ -143,11 +147,27 @@ export declare namespace Config {
143
147
  */
144
148
  schema?: S;
145
149
  /**
146
- * Time in milliseconds the loaded translations stay fresh for. Once a locale's translations are older, the next load trigger runs its loaders again. By default, loaded translations never expire – call `invalidate()` (or set a finite `cache`) when your translation source can change at runtime, e.g. a CMS.
150
+ * The path the app is served under – SvelteKit's `kit.paths.base`, spelled
151
+ * as it appears in `url.pathname`. Every route handed in (`setRoute()`,
152
+ * `loadTranslations()`) loses it on the way in, on a segment boundary only:
153
+ * under `/repo`, `/repo/about` is `/about` and `/repo` is `/`, while
154
+ * `/repository` and a route without it pass through. So loader `routes`,
155
+ * the `route` a loader receives and the snapshot's route never carry it.
156
+ *
157
+ * @example
158
+ * // .env: PUBLIC_BASE_PATH= (defined even when empty; the build's environment sets it)
159
+ * // svelte.config.js: kit: { paths: { base: process.env.PUBLIC_BASE_PATH ?? '' } }
160
+ * import { PUBLIC_BASE_PATH } from '$env/static/public';
161
+ *
162
+ * const config = { basePath: PUBLIC_BASE_PATH, loaders };
163
+ */
164
+ basePath?: string;
165
+ /**
166
+ * Time in milliseconds the loaded translations stay fresh for. Once a locale's translations are older, the next activating load trigger (`setLocale()`, `setRoute()`, `loadTranslations()`) runs its loaders again; a warm load – `loadTranslations(…, { activate: false })` or `loadNamespace()` – fills the tables without evaluating the window. By default, loaded translations never expire – call `invalidate()` (or set a finite `cache`) when your translation source can change at runtime, e.g. a CMS. A loader with `cache: false` is outside the window.
147
167
  *
148
168
  * @default Number.POSITIVE_INFINITY
149
169
  *
150
- * @tip Set to `0` to treat translations as always stale (refetch on every load trigger).
170
+ * @tip Set to `0` to treat translations as always stale (refetch on every activating load trigger).
151
171
  */
152
172
  cache?: number;
153
173
  /**
@@ -231,53 +251,125 @@ export declare namespace Extension {
231
251
  } ? Apply<O, Instance> : Head extends T<any, infer Out> ? Out : Instance, Rest> : Instance;
232
252
  }
233
253
  export declare namespace Loader {
234
- type Key = string;
235
- type Locale = Config.Locale;
254
+ export type Key = string;
255
+ export type Locale = Config.Locale;
236
256
  /**
237
257
  * Anything with a `test` method can act as a route matcher. It receives the
238
- * bare route path (e.g. `/products/123`), so a matcher built around a full
258
+ * bare route path (e.g. `/products/123`) without `config.basePath`, so a matcher built around a full
239
259
  * URL has to be wrapped in a predicate that supplies the origin itself.
240
260
  */
241
- type RouteMatcher = {
261
+ export type RouteMatcher = {
242
262
  test: (route: string) => boolean;
243
263
  };
244
- type Route = string | RegExp | RouteMatcher;
264
+ export type Route = string | RegExp | RouteMatcher;
265
+ /** The named capture groups a route pattern matched, by name. */
266
+ export type Params = Record<string, string>;
245
267
  /** The load context every loader is called with. */
246
- type Props = {
268
+ export type Props = {
247
269
  /**
248
270
  * Sanitized locale this loader run fetches translations for.
249
271
  */
250
272
  locale: Locale;
251
273
  /**
252
- * Route the load was triggered for.
274
+ * Namespace this loader run fetches translations for – one call per
275
+ * namespace, even when the loader names several.
253
276
  */
254
- route: string;
255
- };
256
- type LoaderModule = {
277
+ namespace: Key;
257
278
  /**
258
- * Represents the translation namespace. This key is used as a translation prefix so it should be module-unique. You can access your translation later using `t('key.yourTranslation')`. It shouldn't include `.` (dot) character.
279
+ * Route the load was triggered for, without `config.basePath`.
259
280
  */
260
- key: Key;
281
+ route: string;
261
282
  /**
262
- * Locale (e.g. `en`, `de`) which is this loader for.
283
+ * The named capture groups of the first route pattern in `routes` that
284
+ * matched `route` – `{}` for a loader without `routes`, for a string route
285
+ * and for a `RouteMatcher`. A loader runs again when they change.
263
286
  */
264
- locale: Locale;
287
+ params: Params;
288
+ };
289
+ type LoaderModuleBody = {
265
290
  /**
266
291
  * Function returning a `Promise` with translation data. You can use it to load files locally, fetch it from your API etc...
292
+ * It must not await a load of the same instance for the route it was called with: that load can be the one waiting for it, which then never settles.
293
+ *
294
+ * Whatever it throws is logged and the rest of the load lands without this loader's data – except SvelteKit's `redirect()` and `error()` below 500,
295
+ * told by their shape: an integer `status` from 300 to 308 with a string `location`, or from 400 to 499 with an object `body`, each an own property
296
+ * of a value that is neither an `Error` of this realm nor tagged `'Error'` (a thrown `Response` fails soft).
297
+ *
298
+ * Those are logged too, and reject the load with the thrown value once its other loaders have settled. The locale does not advance, and the
299
+ * rejected call is undone: its requested locale, route and route params go back to what it replaced – as do those of a call whose control flow it
300
+ * replaced – unless a later call that has not failed came in the meantime. A locale or a route nothing was asked for before stands. The request
301
+ * put back activates at once when its data is already there – or leaves it to its own activating load still in flight, which activates it or
302
+ * fails – and is loaded again otherwise, unless it is the request that failed, or this loader threw for it in the load of a call the undo
303
+ * drops: a failure never runs again by itself. What the other loaders delivered is kept without activating anything; what was
304
+ * fetched for params the route no longer asks for is kept aside, for the trigger that asks for them.
305
+ *
306
+ * An activating load a later call replaced – with another locale, or with other params for this loader, which a route that does not select it
307
+ * asks for none of – resolves without the control flow.
308
+ * Nothing replaces a warm load's, unless it shares the load of an activating call, whose outcome it then gets. What a loader throws is discarded,
309
+ * like its data, when an invalidation, a reconfiguration or `destroy()` severed it before the load settled.
267
310
  */
268
311
  loader: T;
269
312
  /**
270
- * Define routes this loader should be triggered for. You can use Regular expressions or any object with a `test` method too. For example `[/\/.ome/]` will be triggered for `/home` and `/rome` route as well (but still only once). Leave this `undefined` in case you want to load this module with any route (useful for common translations).
313
+ * Define routes this loader should be triggered for. You can use Regular expressions or any object with a `test` method too. For example `[/\/.ome/]` will be triggered for `/home` and `/rome` route as well (but still only once per set of params, unless the loader sets `cache: false`). The routes are matched without `config.basePath`. Leave this `undefined` in case you want to load this module with any route (useful for common translations).
271
314
  *
272
- * Named capture groups in a route `RegExp` are reserved: today they match exactly as any other group does, but a future minor may read their matches as load parameters and re-run the loader when those change. Use a non-capturing group (`(?:...)`) where you only need grouping.
315
+ * Named capture groups in a route `RegExp` are load parameters: their matches reach the loader as `Props.params`, and the loader runs again when they change, its data replacing what it delivered for the previous ones. Use a non-capturing group (`(?:...)`) where you only need grouping.
273
316
  */
274
317
  routes?: readonly Route[];
318
+ /**
319
+ * Set to `false` when the loader's source does the caching – a SvelteKit remote `query`, an SWR layer, an HTTP cache. The core then keeps no freshness of its own for it: it runs on every load trigger that selects it, its data is applied each time like any refetch, and `config.cache` does not apply to it – refreshing the source is the app's business. Data hydrated from a snapshot still holds it back for the pass it arrived with, until an activating trigger asks for another locale or route; `invalidate()` ends that hand-off and discards a fetch of it in flight. Only `false` is accepted.
320
+ */
321
+ cache?: false;
322
+ };
323
+ /**
324
+ * The namespace a loader loads into, under either name. A union rather than
325
+ * two optional properties so the compiler keeps what one required property
326
+ * gave: a loader names exactly one, and naming both is rejected instead of
327
+ * resolved by a precedence rule.
328
+ */
329
+ type Named = {
330
+ /**
331
+ * Represents the translation namespace. It is used as a translation prefix so it should be module-unique. You can access your translation later using `t('namespace.yourTranslation')`. It shouldn't include `.` (dot) character.
332
+ *
333
+ * Several namespaces may be listed: the loader is then called once per namespace (and per locale), with the one it is loading in `Props.namespace`.
334
+ */
335
+ namespace: Key | readonly Key[];
336
+ key?: never;
337
+ } | {
338
+ /**
339
+ * @deprecated Renamed to `namespace`. Still honored; scheduled for removal in the next major.
340
+ */
341
+ key: Key;
342
+ namespace?: never;
343
+ };
344
+ export type LoaderModule = LoaderModuleBody & Named & {
345
+ /**
346
+ * Locale (e.g. `en`, `de`) which is this loader for. Several locales may be listed: the loader is then called once per locale (and per namespace), with the one it is loading in `Props.locale`.
347
+ */
348
+ locale: Locale | readonly Locale[];
275
349
  };
276
350
  /**
277
- * Loads translation data. Receives the load context (`locale`, `route`) –
351
+ * A loader module after `resolveLoaders`: one per locale and namespace pair
352
+ * the module names, with its namespace settled under one name and its locale
353
+ * sanitized.
354
+ */
355
+ export type Resolved = LoaderModuleBody & {
356
+ locale: Locale;
357
+ namespace: Key;
358
+ /**
359
+ * Names this loader outside the process that resolved it, derived by base
360
+ * from the loader's locale, namespace and routes – never declared by a
361
+ * loader. Equal for equal content, across processes. `null` when another
362
+ * loader resolves to the same content (a `RouteMatcher` contributes its
363
+ * form, not its behavior), so the name would not tell the two apart.
364
+ */
365
+ id: string | null;
366
+ };
367
+ /**
368
+ * Loads translation data. Receives the load context (`locale`, `namespace`, `route`, `params`) –
278
369
  * loaders that don't need it can simply take no parameters.
279
370
  */
280
- type T = (props: Props) => Promise<Translations.Input>;
371
+ export type T = (props: Props) => Promise<Translations.Input>;
372
+ export {};
281
373
  }
282
374
  export declare namespace Parser {
283
375
  type Value = any;
@@ -351,7 +443,7 @@ export declare namespace Parser {
351
443
  * with anything yields the other kind. `'date'` covers both date and time
352
444
  * formatting and means `Date | number`. `'function'` is a rich-text callback,
353
445
  * the shape ICU tags require. `'boolean'` is here for parsers that can prove
354
- * it – neither official parser can, since both compare stringified values.
446
+ * it – no official parser can, since each compares stringified values.
355
447
  */
356
448
  type ParamKind = 'unknown' | 'string' | 'number' | 'boolean' | 'date' | 'function';
357
449
  /**
@@ -371,7 +463,7 @@ export declare namespace Parser {
371
463
  kind?: ParamKind | readonly ParamKind[];
372
464
  /**
373
465
  * Values the message names explicitly – a hint for authoring tools, never
374
- * an exhaustive set. Both official parsers fall back to a default branch
466
+ * an exhaustive set. Every official parser falls back to a default branch
375
467
  * for anything unlisted, so this must not be used to close a union. Omit it
376
468
  * where the listed values are not values at all (numeric thresholds, plural
377
469
  * categories) or mean the opposite (an inequality's operands).
@@ -394,7 +486,7 @@ export declare namespace Parser {
394
486
  branch: string;
395
487
  }[];
396
488
  };
397
- /** Diagnostic context for an extractor. Neither official parser needs it to extract. */
489
+ /** Diagnostic context for an extractor. No official parser needs it to extract. */
398
490
  type ExtractContext = {
399
491
  key?: Key;
400
492
  locale?: Locale;
@@ -430,6 +522,17 @@ export declare namespace Schema {
430
522
  export type FromConfig<C> = C extends {
431
523
  schema?: infer S extends object;
432
524
  } ? (HasClosedKeys<S> extends true ? S : never) : never;
525
+ /**
526
+ * The key schema an instance was built with; `never` when it carries none.
527
+ * The counterpart of `FromConfig` for code handed a constructed surface
528
+ * rather than a config — an extension typing its own output, for instance.
529
+ *
530
+ * Read off the class type parameter rather than off the shape of `t`: an
531
+ * extension that retypes `t` by intersection leaves a structural read
532
+ * unable to pick the schema out of the intersected signature, while the
533
+ * instance itself stays a member of that intersection.
534
+ */
535
+ export type FromInstance<I> = I extends I18n<any, any, infer S, any> ? S : never;
433
536
  /** The keys a schema allows; any string when there is no schema. */
434
537
  export type Key<S> = [S] extends [never] ? string : keyof S & string;
435
538
  type IsAny<T> = 0 extends 1 & T ? true : false;
@@ -466,6 +569,49 @@ export declare namespace Schema {
466
569
  export type Params<S, K extends string, P extends Parser.Params> = [S] extends [never] ? P : [K] extends [keyof S] ? Payload<P, PayloadOf<S, K>, undefined extends S[K & keyof S] ? true : false> : P;
467
570
  export {};
468
571
  }
572
+ export declare namespace Snapshot {
573
+ /**
574
+ * A loader that delivered on the instance a snapshot was taken of: its
575
+ * `Loader.Resolved.id`, and the signature of the route params it delivered
576
+ * for – left out when its routes captured none.
577
+ */
578
+ type LoadRecord = {
579
+ id: string;
580
+ signature?: string;
581
+ };
582
+ /**
583
+ * What `snapshot({ records: true })` returns and `hydrate()` applies. Plain
584
+ * data throughout – strings, arrays and plain objects – so `devalue`, the
585
+ * serializer SvelteKit hands load data to, accepts it. Its locales are held
586
+ * sanitized and are not sanitized again, and `locale` and `route` are applied
587
+ * as they are, so take it from the server: the whole envelope from
588
+ * `snapshot({ records: true })`, or for a plain hand-off the data of
589
+ * `snapshot()` with the server's `i18n.locale`.
590
+ */
591
+ type Envelope = {
592
+ /** What the instance held for its active locale and the fallback locale, shaped like `config.translations`. */
593
+ translations: Translations.SerializedTranslations;
594
+ /**
595
+ * The loaders that delivered, which `hydrate()` keeps from running again
596
+ * for the same params – one with `cache: false` only for the pass the
597
+ * envelope arrived with. Without it, the data is handed over as plain data:
598
+ * it keeps every loader without params of every namespace it names from
599
+ * running, and holds one with `cache: false` back for that pass.
600
+ */
601
+ records?: LoadRecord[];
602
+ /**
603
+ * What was seeded into the namespace of a loader whose routes capture
604
+ * params – repeated where `translations` carries the namespace, and
605
+ * carried where the payload leaves it out, so that it outlives the
606
+ * delivery new params replace. Read with `records` only.
607
+ */
608
+ seeds?: Translations.SerializedTranslations;
609
+ /** The active locale. */
610
+ locale?: string;
611
+ /** The current route, without `config.basePath`. */
612
+ route?: string;
613
+ };
614
+ }
469
615
  export declare namespace Translations {
470
616
  type Locales<T = string> = T[];
471
617
  type SerializedTranslations = LocaleIndexed<DotNotation.Input>;
package/dist/utils.d.ts CHANGED
@@ -14,13 +14,91 @@ type Sanitizer = (...locales: any[]) => Config.Locale[];
14
14
  export declare const sanitizeLocales: Sanitizer;
15
15
  export declare const sanitizerFactory: (sanitize?: Config.SanitizeLocales) => Sanitizer;
16
16
  export declare const sanitizeTranslationLocales: (input: Translations.SerializedTranslations, sanitize: Sanitizer) => Translations.SerializedTranslations;
17
+ /**
18
+ * Matches what a visitor asked for against the locales an app actually has.
19
+ *
20
+ * `requested` is an `Accept-Language` field value, a single locale, or a
21
+ * preference list such as `navigator.languages`; `available` is the configured
22
+ * set, and the winner is returned as IT spells it. A miss is `undefined` rather
23
+ * than a guess – what a miss means is the caller's to decide.
24
+ */
25
+ export declare const matchLocale: <const L extends string>(requested: string | readonly string[] | null | undefined, available: readonly L[]) => L | undefined;
26
+ /**
27
+ * The direction `locale` is written in, for `dir` and `<html dir>`.
28
+ *
29
+ * Decided by the script alone: the one the tag spells (`az-Arab`, `pa-Guru`),
30
+ * or else the one `Intl.Locale#maximize()` adds (`dv` is `Thaa`, `pa-PK` is
31
+ * `Arab`). That likely script is the engine's CLDR data and can differ between
32
+ * engines (`prs` has none in JavaScriptCore), so a locale whose direction
33
+ * matters spells its script. The engines' own text info is not read –
34
+ * JavaScriptCore reports `dv` and `az-Arab` as left to right. A tag
35
+ * `Intl.Locale` rejects, and a missing locale, is `'ltr'`.
36
+ */
37
+ export declare const textDirection: (locale: string | undefined) => "ltr" | "rtl";
38
+ /**
39
+ * `route` without `basePath` in front of it, cut on a segment boundary only:
40
+ * under `/repo`, `/repo/about` is `/about`, `/repo` is `/` and `/repo?tab=1`
41
+ * is `/?tab=1`, while `/repository` and a route without the prefix pass
42
+ * through unchanged.
43
+ */
44
+ export declare const withoutBasePath: (route: string, basePath: string | undefined) => string;
45
+ /**
46
+ * What stands in front of the part of `pathname` that SvelteKit's `routeId`
47
+ * matched: `''` when nothing does, `undefined` when the id fits no suffix of
48
+ * it, when it is `null` (a 404), or when the pathname is too long to examine.
49
+ * Param matchers cannot run here, so an optional param on the first segment
50
+ * absorbs a prefix. No regex runs on the pathname.
51
+ */
52
+ export declare const routePrefix: (pathname: string, routeId: string | null) => string | undefined;
17
53
  export declare const toDotNotation: DotNotation.T;
18
- export declare const resolveLoaders: (input?: readonly Loader.LoaderModule[]) => Loader.LoaderModule[];
54
+ export declare const unique: <V>(values: readonly V[]) => V[];
55
+ export declare const resolveLoaders: (input?: readonly Loader.LoaderModule[], sanitizeLocales?: Config.SanitizeLocales) => Loader.Resolved[];
19
56
  export declare const mergeTranslations: (target: any, source: any, path: string, onConflict?: (path: string) => void) => any;
20
57
  export declare const omitProtoKeys: (value: any) => any;
21
- export declare const serialize: (input: Array<Loader.LoaderModule & {
58
+ export declare const serialize: (input: Array<Loader.Resolved & {
22
59
  data: any;
23
60
  }>) => Translations.SerializedTranslations;
24
- export declare const fetchTranslations: (loaders: Loader.LoaderModule[], route: string) => Promise<Translations.SerializedTranslations>;
61
+ /** The locales the loaders serve, then the ones the tables hold. */
62
+ export declare const servedLocales: (loaders: readonly Loader.Resolved[], tables: Translations.SerializedTranslations) => Config.Locale[];
63
+ /**
64
+ * The locales a config serves, sanitized as an instance built from it
65
+ * sanitizes them. Resolving the loaders logs what is wrong with them, so a
66
+ * caller runs this once per config.
67
+ */
68
+ export declare const configLocales: ({ loaders, translations, sanitizeLocales: strategy }: Pick<Config.T, "loaders" | "translations" | "sanitizeLocales">) => Config.Locale[];
69
+ /** A loader selected for a load, with the params its route yielded. */
70
+ export type LoadRequest = {
71
+ loader: Loader.Resolved;
72
+ params: Loader.Params;
73
+ signature: string;
74
+ };
75
+ /** What a loader delivered. A loader that threw has no entry; one that returned nothing delivered no keys. */
76
+ export type Delivery = {
77
+ loader: Loader.Resolved;
78
+ signature: string;
79
+ data: Translations.Input;
80
+ };
81
+ /** SvelteKit's control flow a loader threw instead of delivering: `redirect()`, and `error()` below 500. */
82
+ export type ControlFlow = {
83
+ loader: Loader.Resolved;
84
+ signature: string;
85
+ value: unknown;
86
+ };
87
+ /** What a fetch returns: the deliveries, and the control flow thrown instead of one. */
88
+ export type Fetched = {
89
+ deliveries: Delivery[];
90
+ controlFlow: ControlFlow[];
91
+ };
92
+ /** A loader as a message names it. `String`, since interpolating a Symbol namespace throws. */
93
+ export declare const loaderName: ({ locale, namespace }: Loader.Resolved) => string;
94
+ export declare const fetchTranslation: ({ loader: resolved, params, signature }: LoadRequest, route: string) => Promise<Fetched>;
95
+ /** The fetches of a load as one. */
96
+ export declare const mergeFetched: (fetched: Fetched[]) => Fetched;
97
+ export declare const matchRoute: (route: string) => (input: Loader.Route) => Loader.Params | undefined;
25
98
  export declare const testRoute: (route: string) => (input: Loader.Route) => boolean;
99
+ /** The params a loader loads with on `route` – its first matching route's – or `undefined` when none matches. */
100
+ export declare const routeParams: (routes: readonly Loader.Route[] | undefined, route: string) => Loader.Params | undefined;
101
+ /** Whether any of `routes` can yield params. */
102
+ export declare const capturesParams: (routes: readonly Loader.Route[] | undefined) => boolean;
103
+ export declare const paramsSignature: (params: Loader.Params) => string;
26
104
  export {};