@koine/i18n 2.0.0-beta.85 → 2.0.0-beta.87

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.
Files changed (67) hide show
  1. package/adapter-js/code/_routesSlimLookup.d.ts +1 -0
  2. package/adapter-js/code/createT.d.ts +3 -0
  3. package/adapter-js/code/getAlternates.d.ts +3 -0
  4. package/adapter-js/code/getAlternatesFromDom.d.ts +3 -0
  5. package/adapter-js/code/getI18nDictionaries.d.ts +3 -0
  6. package/adapter-js/code/getT.d.ts +3 -0
  7. package/adapter-js/code/index.d.ts +2 -2
  8. package/adapter-js/code/loadTranslations.d.ts +3 -0
  9. package/adapter-js/code/pathnames.d.ts +3 -0
  10. package/adapter-js/index.d.ts +5 -0
  11. package/adapter-js/options.d.ts +4 -0
  12. package/adapter-next/code/I18nAlternates.d.ts +3 -0
  13. package/adapter-next/code/I18nApp.d.ts +3 -0
  14. package/adapter-next/code/I18nHead.d.ts +3 -0
  15. package/adapter-next/code/I18nLayout.d.ts +3 -0
  16. package/adapter-next/code/I18nPage.d.ts +3 -0
  17. package/adapter-next/code/I18nRoot.d.ts +3 -0
  18. package/adapter-next/code/getI18nMetadata.d.ts +3 -0
  19. package/adapter-next/code/i18nProps.d.ts +3 -0
  20. package/adapter-next/code/index.d.ts +2 -2
  21. package/adapter-next/code/useRouteId.d.ts +1 -1
  22. package/adapter-next/index.d.ts +5 -0
  23. package/adapter-next/options.d.ts +4 -0
  24. package/adapter-next/plugin-async.d.ts +1 -1
  25. package/adapter-next/plugin-legacy.d.ts +3 -4
  26. package/adapter-next/redirects.d.ts +1 -0
  27. package/adapter-next/rewrites.d.ts +1 -0
  28. package/adapter-next-translate/code/index.d.ts +2 -2
  29. package/adapter-next-translate/index.d.ts +5 -0
  30. package/adapter-next-translate/options.d.ts +3 -0
  31. package/adapter-react/code/I18nAlternatesContext.d.ts +3 -0
  32. package/adapter-react/code/I18nAlternatesProvider.d.ts +3 -0
  33. package/adapter-react/code/I18nAlternatesSetter.d.ts +3 -0
  34. package/adapter-react/code/I18nContext.d.ts +3 -0
  35. package/adapter-react/code/I18nEffects.d.ts +3 -0
  36. package/adapter-react/code/I18nProvider.d.ts +3 -0
  37. package/adapter-react/code/I18nRouteContext.d.ts +3 -0
  38. package/adapter-react/code/I18nRouteProvider.d.ts +3 -0
  39. package/adapter-react/code/T.d.ts +3 -0
  40. package/adapter-react/code/TransText.d.ts +3 -0
  41. package/adapter-react/code/formatElements.d.ts +3 -0
  42. package/adapter-react/code/index.d.ts +2 -0
  43. package/adapter-react/code/useAlternates.d.ts +3 -0
  44. package/adapter-react/code/useLocale.d.ts +3 -0
  45. package/adapter-react/code/useT.d.ts +3 -0
  46. package/adapter-react/index.d.ts +5 -0
  47. package/adapter-react/options.d.ts +2 -0
  48. package/api.cjs.js +1784 -352
  49. package/api.esm.js +1792 -362
  50. package/compiler/api.d.ts +9 -8
  51. package/compiler/code/data-translations.d.ts +8 -5
  52. package/compiler/code/data.d.ts +14 -32
  53. package/compiler/code/generate.d.ts +4 -8
  54. package/compiler/code/index.d.ts +2 -2
  55. package/compiler/code/write.d.ts +2 -3
  56. package/compiler/config.d.ts +13 -5
  57. package/compiler/createAdapter.d.ts +5 -0
  58. package/compiler/helpers.d.ts +1 -0
  59. package/compiler/summary/generate.d.ts +1 -2
  60. package/compiler/summary/index.d.ts +0 -1
  61. package/compiler/summary/write.d.ts +3 -3
  62. package/compiler/types.d.ts +19 -25
  63. package/next.cjs.js +77 -171
  64. package/next.esm.js +78 -172
  65. package/package.json +3 -3
  66. /package/adapter-js/code/{tFns.d.ts → t.d.ts} +0 -0
  67. /package/adapter-next/code/{useLocale.d.ts → deprecated_useLocale.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({ config, options }: I18nCompiler.AdapterArg<"js">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"js">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"js">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"js">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"js">) => string;
3
+ export default _default;
@@ -1,3 +1,3 @@
1
1
  import type { I18nCompiler } from "../../compiler/types";
2
- declare const adapter: I18nCompiler.AdpaterCreator<"js">;
3
- export default adapter;
2
+ declare const _default: (data: I18nCompiler.DataCode, adapterOptions: import("type-fest/source/partial-deep").PartialObjectDeep<import("../options").AdapterJsOptions, {}>) => I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate"> | Promise<I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate">>;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"js">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({ routes }: I18nCompiler.AdapterArg<"js">) => string;
3
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { AdapterJsOptions } from "./options";
2
+ export type AdapterJs = {
3
+ name: "js";
4
+ options: AdapterJsOptions;
5
+ };
@@ -0,0 +1,4 @@
1
+ export declare const adapterJsOptions: AdapterJsOptions;
2
+ export type AdapterJsOptions = {
3
+ modularized: boolean;
4
+ };
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"next">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"next">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"next">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"next">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"next">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"next">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"next">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"next">) => string;
3
+ export default _default;
@@ -1,3 +1,3 @@
1
1
  import type { I18nCompiler } from "../../compiler/types";
2
- declare const adapter: I18nCompiler.AdpaterCreator<"next">;
3
- export default adapter;
2
+ declare const _default: (data: I18nCompiler.DataCode, adapterOptions: import("type-fest/source/partial-deep").PartialObjectDeep<import("../options").AdapterNextOptions, {}>) => I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate"> | Promise<I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate">>;
3
+ export default _default;
@@ -1,3 +1,3 @@
1
1
  import type { I18nCompiler } from "../../compiler/types";
2
- declare const _default: ({ options: { routes: { localeParamName }, }, }: I18nCompiler.AdapterArg<"next">) => string;
2
+ declare const _default: ({ options: { routes: { localeParamName }, }, adapterOptions: { router }, }: I18nCompiler.AdapterArg<"next">) => string;
3
3
  export default _default;
@@ -0,0 +1,5 @@
1
+ import type { AdapterNextOptions } from "./options";
2
+ export type AdapterNext = {
3
+ name: "next";
4
+ options: AdapterNextOptions;
5
+ };
@@ -0,0 +1,4 @@
1
+ export declare const adapterNextOptions: AdapterNextOptions;
2
+ export type AdapterNextOptions = {
3
+ router: "app" | "pages" | "migrating";
4
+ };
@@ -4,5 +4,5 @@ type NextConfigFn = (phase: string, context?: any) => Promise<NextConfig> | Next
4
4
  export type WithI18nAsyncOptions = NextConfig & {
5
5
  i18nCompiler?: I18nCompilerOptions;
6
6
  };
7
- export declare let withI18nAsync: <TAdapterName extends "js" | "next" | "next-translate">(config?: WithI18nAsyncOptions) => NextConfigFn;
7
+ export declare let withI18nAsync: <TAdapterName extends "js" | "react" | "next" | "next-translate">(config?: WithI18nAsyncOptions) => NextConfigFn;
8
8
  export {};
@@ -8,15 +8,14 @@ type Routes = Record<Locale, RoutesByLocale>;
8
8
  type I18nRoutesOptions = {
9
9
  routes: Routes;
10
10
  permanent?: boolean;
11
- locales: Locale[];
12
- defaultLocale: Locale;
11
+ locales?: Locale[];
12
+ defaultLocale?: Locale;
13
13
  hideDefaultLocaleInUrl?: boolean;
14
14
  localeParam?: string;
15
15
  debug?: boolean;
16
16
  };
17
- type I18nRoutesNextOptions = Omit<I18nRoutesOptions, "locales" | "defaultLocale">;
18
17
  export type WithI18nLegacyOptions = NextConfig & {
19
- i18nRoutes?: I18nRoutesNextOptions;
18
+ i18nRoutes?: I18nRoutesOptions;
20
19
  };
21
20
  export declare let withI18nLegacy: (config: WithI18nLegacyOptions) => NextConfig;
22
21
  export {};
@@ -1,4 +1,5 @@
1
1
  import type { Redirect } from "next/dist/lib/load-custom-routes";
2
2
  import type { CodeDataRoutesOptions } from "../compiler/code/data-routes";
3
3
  import type { I18nCompiler } from "../compiler/types";
4
+ export declare function generateRedirectForPathname(config: Pick<I18nCompiler.Config, "defaultLocale" | "hideDefaultLocaleInUrl">, localeParam: string | undefined, locale: string, template: string, pathname: string, redirects: (Redirect | undefined)[], permanentRedirects?: boolean): void;
4
5
  export declare let generateRedirects: (config: I18nCompiler.Config, routes: I18nCompiler.DataRoutes["byId"], options: CodeDataRoutesOptions) => Redirect[];
@@ -1,4 +1,5 @@
1
1
  import type { Rewrite } from "next/dist/lib/load-custom-routes";
2
2
  import type { CodeDataRoutesOptions } from "../compiler/code/data-routes";
3
3
  import type { I18nCompiler } from "../compiler/types";
4
+ export declare const generateRewriteForPathname: (config: Pick<I18nCompiler.Config, "defaultLocale" | "hideDefaultLocaleInUrl">, localeParam: string | undefined, locale: string, template: string, pathname: string, rewrites: (Rewrite | undefined)[]) => void;
4
5
  export declare let generateRewrites: (config: I18nCompiler.Config, routes: I18nCompiler.DataRoutes["byId"], options: CodeDataRoutesOptions) => Rewrite[];
@@ -1,3 +1,3 @@
1
1
  import type { I18nCompiler } from "../../compiler/types";
2
- declare const adapter: I18nCompiler.AdpaterCreator<"next-translate">;
3
- export default adapter;
2
+ declare const _default: (data: I18nCompiler.DataCode, adapterOptions: import("type-fest/source/partial-deep").PartialObjectDeep<Partial<Pick<import("next-translate").I18nConfig, "loader">>, {}>) => I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate"> | Promise<I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate">>;
3
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { AdapterNextTranslateOptions } from "./options";
2
+ export type AdapterNextTranslate = {
3
+ name: "next-translate";
4
+ options: AdapterNextTranslateOptions;
5
+ };
@@ -0,0 +1,3 @@
1
+ import type { I18nConfig } from "next-translate";
2
+ export declare const adapterNextTranslateOptions: AdapterNextTranslateOptions;
3
+ export type AdapterNextTranslateOptions = Partial<Pick<I18nConfig, "loader">>;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"react">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"react">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"react">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"react">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"react">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"react">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"react">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"react">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"react">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"react">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"react">) => string;
3
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: (data: import("../../compiler-sync").I18nCompiler.DataCode, adapterOptions: import("type-fest/source/partial-deep").PartialObjectDeep<import("../options").AdapterReactOptions, {}>) => import("../../compiler-sync").I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate"> | Promise<import("../../compiler-sync").I18nCompiler.Adapter<"js" | "react" | "next" | "next-translate">>;
2
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"react">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({ config }: I18nCompiler.AdapterArg<"react">) => string;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type { I18nCompiler } from "../../compiler/types";
2
+ declare const _default: ({}: I18nCompiler.AdapterArg<"react">) => string;
3
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { AdapterReactOptions } from "./options";
2
+ export type AdapterReact = {
3
+ name: "react";
4
+ options: AdapterReactOptions;
5
+ };
@@ -0,0 +1,2 @@
1
+ export declare const adapterReactOptions: AdapterReactOptions;
2
+ export type AdapterReactOptions = {};