@koine/i18n 2.0.0-beta.104 → 2.0.0-beta.105
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/adapter-next/code/I18nDocument.d.ts +3 -0
- package/api.cjs.js +108 -26
- package/api.esm.js +108 -26
- package/package.json +3 -3
package/api.cjs.js
CHANGED
|
@@ -535,7 +535,7 @@ export const routes = ${e} as const;
|
|
|
535
535
|
`;
|
|
536
536
|
});
|
|
537
537
|
|
|
538
|
-
var u$
|
|
538
|
+
var u$3 = (({})=>`
|
|
539
539
|
|
|
540
540
|
export type RouteIdError = (typeof routesError)[number];
|
|
541
541
|
|
|
@@ -961,7 +961,7 @@ let c$2 = (e, a)=>!utils.isArray(a) && utils.isObject(a) && hasPlurals(a) ? hasO
|
|
|
961
961
|
} else o += "";
|
|
962
962
|
return(// adjust syntax
|
|
963
963
|
(o = o.replace(/;\[\];/g, "[];")).replace(/;+/g, ";"));
|
|
964
|
-
}, u$
|
|
964
|
+
}, u$2 = (e, t)=>{
|
|
965
965
|
let { translationFiles: a } = t, { defaultLocale: s } = e, n = a.filter((e)=>e.locale === s), o = [];
|
|
966
966
|
for(let e = 0; e < n.length; e++){
|
|
967
967
|
let { path: t, data: a } = n[e], s = t.replace(".json", "");
|
|
@@ -1090,7 +1090,7 @@ export namespace I18n {
|
|
|
1090
1090
|
* more sophisticated than the type result of \`typeof "./en/messages.json"\`
|
|
1091
1091
|
*/
|
|
1092
1092
|
export type TranslationsDictionary = {
|
|
1093
|
-
${u$
|
|
1093
|
+
${u$2(e, t).join("\n ")}
|
|
1094
1094
|
}
|
|
1095
1095
|
|
|
1096
1096
|
/**
|
|
@@ -1436,7 +1436,7 @@ var t$1 = createAdapter(adapterJsOptions, ({})=>({
|
|
|
1436
1436
|
},
|
|
1437
1437
|
{
|
|
1438
1438
|
name: "routesError",
|
|
1439
|
-
fn: u$
|
|
1439
|
+
fn: u$3,
|
|
1440
1440
|
ext: "ts"
|
|
1441
1441
|
},
|
|
1442
1442
|
{
|
|
@@ -1792,6 +1792,82 @@ export const I18nApp = (props: I18nAppProps) => {
|
|
|
1792
1792
|
export default I18nApp;
|
|
1793
1793
|
`);
|
|
1794
1794
|
|
|
1795
|
+
var o$6 = (({})=>`
|
|
1796
|
+
"use client";
|
|
1797
|
+
|
|
1798
|
+
import type { AppProps } from "next/app";
|
|
1799
|
+
import { defaultI18nMetadata } from "./defaultI18nMetadata";
|
|
1800
|
+
import { defaultLocale } from "./defaultLocale";
|
|
1801
|
+
import { I18nProvider } from "./I18nProvider";
|
|
1802
|
+
import { I18nMetadataProvider } from "./I18nMetadataProvider";
|
|
1803
|
+
import { I18nEffects } from "./I18nEffects";
|
|
1804
|
+
import { I18nHead } from "./I18nHead";
|
|
1805
|
+
import type { I18n } from "./types";
|
|
1806
|
+
|
|
1807
|
+
/**
|
|
1808
|
+
* @internal
|
|
1809
|
+
*/
|
|
1810
|
+
export type I18nAppPropsData = {
|
|
1811
|
+
i18n: {
|
|
1812
|
+
locale: I18n.Locale;
|
|
1813
|
+
dictionaries: I18n.Dictionaries;
|
|
1814
|
+
metadata: I18n.Metadata;
|
|
1815
|
+
}
|
|
1816
|
+
};
|
|
1817
|
+
|
|
1818
|
+
const i18nDefaults: I18nAppPropsData["i18n"] = {
|
|
1819
|
+
locale: defaultLocale,
|
|
1820
|
+
dictionaries: {},
|
|
1821
|
+
metadata: defaultI18nMetadata
|
|
1822
|
+
};
|
|
1823
|
+
|
|
1824
|
+
type I18nAppProps = React.PropsWithChildren<
|
|
1825
|
+
AppProps<I18nAppPropsData>["pageProps"]
|
|
1826
|
+
>;
|
|
1827
|
+
|
|
1828
|
+
/**
|
|
1829
|
+
* To use in \`_app.tsx\` file wrapping your component
|
|
1830
|
+
*
|
|
1831
|
+
* **For Pages Router only**
|
|
1832
|
+
*
|
|
1833
|
+
* NB: Consider that when using ISR with \`fallback: true\` the first load
|
|
1834
|
+
* will not have any useful i18n data (App's \`pageProps\` is an empty object),
|
|
1835
|
+
* hence we provide a \`i18nDefaults\` object.
|
|
1836
|
+
*
|
|
1837
|
+
* @usage
|
|
1838
|
+
* \`\`\`ts
|
|
1839
|
+
* export default function App(props: AppProps) {
|
|
1840
|
+
* const { Component, pageProps } = props;
|
|
1841
|
+
*
|
|
1842
|
+
* return (
|
|
1843
|
+
* <I18nApp {...pageProps}>
|
|
1844
|
+
* <Component {...pageProps} />
|
|
1845
|
+
* </I18nApp>
|
|
1846
|
+
* );
|
|
1847
|
+
* }
|
|
1848
|
+
* \`\`\`
|
|
1849
|
+
*/
|
|
1850
|
+
export const I18nApp = (props: I18nAppProps) => {
|
|
1851
|
+
const { i18n, children } = props;
|
|
1852
|
+
const { locale, dictionaries, metadata } = i18n || i18nDefaults;
|
|
1853
|
+
|
|
1854
|
+
return (
|
|
1855
|
+
<I18nProvider
|
|
1856
|
+
locale={locale}
|
|
1857
|
+
dictionaries={dictionaries}
|
|
1858
|
+
>
|
|
1859
|
+
<I18nHead metadata={metadata} />
|
|
1860
|
+
<I18nMetadataProvider metadata={metadata}>
|
|
1861
|
+
{children}
|
|
1862
|
+
</I18nMetadataProvider>
|
|
1863
|
+
<I18nEffects />
|
|
1864
|
+
</I18nProvider>
|
|
1865
|
+
);
|
|
1866
|
+
};
|
|
1867
|
+
|
|
1868
|
+
export default I18nApp;
|
|
1869
|
+
`);
|
|
1870
|
+
|
|
1795
1871
|
/**
|
|
1796
1872
|
* We cannot re-use `I18nHeadTags` as NextHead component does needs HTML tags
|
|
1797
1873
|
* to be its immediate children.
|
|
@@ -1839,7 +1915,7 @@ export const I18nHead = (props: I18nHeadProps) => {
|
|
|
1839
1915
|
// export default I18nHead;
|
|
1840
1916
|
`);
|
|
1841
1917
|
|
|
1842
|
-
var
|
|
1918
|
+
var m$3 = (({})=>`
|
|
1843
1919
|
import { I18nProvider } from "./I18nProvider";
|
|
1844
1920
|
import { defaultLocale } from "./defaultLocale";
|
|
1845
1921
|
// import { getI18nDictionaries } from "./getI18nDictionaries";
|
|
@@ -1878,7 +1954,7 @@ export const I18nLayout = async ({
|
|
|
1878
1954
|
export default I18nLayout;
|
|
1879
1955
|
`);
|
|
1880
1956
|
|
|
1881
|
-
var
|
|
1957
|
+
var i$4 = (({ config: { single: t }, options: { routes: { localeParamName: a } } })=>`
|
|
1882
1958
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1883
1959
|
import { notFound } from "next/navigation";
|
|
1884
1960
|
import { I18nMetadataSetter } from "./I18nMetadataSetter";
|
|
@@ -1980,7 +2056,7 @@ I18nPage.metadata = <TRouteId extends I18n.RouteId>(
|
|
|
1980
2056
|
export default I18nPage;
|
|
1981
2057
|
`);
|
|
1982
2058
|
|
|
1983
|
-
var
|
|
2059
|
+
var x$2 = (({})=>`
|
|
1984
2060
|
import { defaultI18nMetadata } from "./defaultI18nMetadata";
|
|
1985
2061
|
import { I18nMetadataProvider } from "./I18nMetadataProvider";
|
|
1986
2062
|
import { I18nRouteProvider } from "./I18nRouteProvider";
|
|
@@ -2007,7 +2083,7 @@ export const I18nRoot = ({ children }: I18nRootProps) => {
|
|
|
2007
2083
|
export default I18nRoot;
|
|
2008
2084
|
`);
|
|
2009
2085
|
|
|
2010
|
-
var
|
|
2086
|
+
var a$3 = (({})=>`
|
|
2011
2087
|
"use client";
|
|
2012
2088
|
|
|
2013
2089
|
import { useContext, useEffect } from "react";
|
|
@@ -2052,7 +2128,7 @@ export const I18nSetter = <TRouteId extends I18n.RouteId>(
|
|
|
2052
2128
|
export default I18nSetter;
|
|
2053
2129
|
`);
|
|
2054
2130
|
|
|
2055
|
-
var
|
|
2131
|
+
var f$2 = (({ options: { routes: { localeParamName: a } } })=>`
|
|
2056
2132
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2057
2133
|
import type { GetStaticPathsContext, GetStaticPropsContext } from "next";
|
|
2058
2134
|
import type { I18nAppPropsData } from "./I18nApp";
|
|
@@ -2368,12 +2444,12 @@ const generateRewriteForPathname = (e, t, r, a, l)=>{
|
|
|
2368
2444
|
e.source.localeCompare(t.source));
|
|
2369
2445
|
};
|
|
2370
2446
|
|
|
2371
|
-
var
|
|
2447
|
+
var s$4 = (({ config: e, routes: t, options: o })=>{
|
|
2372
2448
|
let l = JSON.stringify(generateRewrites(e, o.routes, t.byId), null, 2);
|
|
2373
2449
|
return `module.exports = ${l}`;
|
|
2374
2450
|
});
|
|
2375
2451
|
|
|
2376
|
-
var
|
|
2452
|
+
var d$4 = (({ options: { routes: { localeParamName: t } }, adapterOptions: { router: e } })=>{
|
|
2377
2453
|
let o = t ? `.replace("[${t}]/", "")` : "";
|
|
2378
2454
|
switch(e){
|
|
2379
2455
|
case "app":
|
|
@@ -2432,7 +2508,7 @@ export default useRouteId;
|
|
|
2432
2508
|
}
|
|
2433
2509
|
});
|
|
2434
2510
|
|
|
2435
|
-
var
|
|
2511
|
+
var I$2 = (({})=>`
|
|
2436
2512
|
"use client";
|
|
2437
2513
|
|
|
2438
2514
|
import { to } from "./to";
|
|
@@ -2459,7 +2535,7 @@ export const useTo = () => {
|
|
|
2459
2535
|
export default useTo;
|
|
2460
2536
|
`);
|
|
2461
2537
|
|
|
2462
|
-
var
|
|
2538
|
+
var u$1 = (({})=>`
|
|
2463
2539
|
"use client";
|
|
2464
2540
|
|
|
2465
2541
|
import { toSpa } from "./toSpa";
|
|
@@ -2495,7 +2571,7 @@ export default useToSpa;
|
|
|
2495
2571
|
`);
|
|
2496
2572
|
|
|
2497
2573
|
var n$4 = createAdapter(adapterNextOptions, ({ adapterOptions: e })=>{
|
|
2498
|
-
let { router: t } = e,
|
|
2574
|
+
let { router: t } = e, c = [
|
|
2499
2575
|
// TODO: maybe remove these files, they are useful for debugging for now
|
|
2500
2576
|
// but probably will be useless
|
|
2501
2577
|
{
|
|
@@ -2505,51 +2581,51 @@ var n$4 = createAdapter(adapterNextOptions, ({ adapterOptions: e })=>{
|
|
|
2505
2581
|
},
|
|
2506
2582
|
{
|
|
2507
2583
|
name: "next-rewrites",
|
|
2508
|
-
fn:
|
|
2584
|
+
fn: s$4,
|
|
2509
2585
|
ext: "js"
|
|
2510
2586
|
},
|
|
2511
2587
|
{
|
|
2512
2588
|
name: "useRouteId",
|
|
2513
|
-
fn:
|
|
2589
|
+
fn: d$4,
|
|
2514
2590
|
ext: "ts",
|
|
2515
2591
|
index: !0
|
|
2516
2592
|
},
|
|
2517
2593
|
{
|
|
2518
2594
|
name: "useTo",
|
|
2519
|
-
fn:
|
|
2595
|
+
fn: I$2,
|
|
2520
2596
|
ext: "ts",
|
|
2521
2597
|
index: !0
|
|
2522
2598
|
},
|
|
2523
2599
|
{
|
|
2524
2600
|
name: "useToSpa",
|
|
2525
|
-
fn:
|
|
2601
|
+
fn: u$1,
|
|
2526
2602
|
ext: "ts",
|
|
2527
2603
|
index: !0
|
|
2528
2604
|
}
|
|
2529
2605
|
];
|
|
2530
|
-
return ("app" === t || "migrating" === t) && (
|
|
2606
|
+
return ("app" === t || "migrating" === t) && (c = c.concat([
|
|
2531
2607
|
{
|
|
2532
2608
|
name: "I18nLayout",
|
|
2533
|
-
fn:
|
|
2609
|
+
fn: m$3,
|
|
2534
2610
|
ext: "tsx",
|
|
2535
2611
|
index: !0
|
|
2536
2612
|
},
|
|
2537
2613
|
{
|
|
2538
2614
|
name: "I18nPage",
|
|
2539
|
-
fn:
|
|
2615
|
+
fn: i$4,
|
|
2540
2616
|
ext: "tsx",
|
|
2541
2617
|
index: !0
|
|
2542
2618
|
},
|
|
2543
2619
|
{
|
|
2544
2620
|
name: "I18nRoot",
|
|
2545
|
-
fn:
|
|
2621
|
+
fn: x$2,
|
|
2546
2622
|
ext: "tsx",
|
|
2547
2623
|
index: !0
|
|
2548
2624
|
}
|
|
2549
|
-
])), ("pages" === t || "migrating" === t) && (
|
|
2625
|
+
])), ("pages" === t || "migrating" === t) && (c = c.concat([
|
|
2550
2626
|
{
|
|
2551
2627
|
name: "I18nSetter",
|
|
2552
|
-
fn:
|
|
2628
|
+
fn: a$3,
|
|
2553
2629
|
ext: "tsx",
|
|
2554
2630
|
index: !0
|
|
2555
2631
|
},
|
|
@@ -2559,6 +2635,12 @@ var n$4 = createAdapter(adapterNextOptions, ({ adapterOptions: e })=>{
|
|
|
2559
2635
|
ext: "tsx",
|
|
2560
2636
|
index: !0
|
|
2561
2637
|
},
|
|
2638
|
+
{
|
|
2639
|
+
name: "I18nDocument",
|
|
2640
|
+
fn: o$6,
|
|
2641
|
+
ext: "tsx",
|
|
2642
|
+
index: !0
|
|
2643
|
+
},
|
|
2562
2644
|
{
|
|
2563
2645
|
name: "I18nHead",
|
|
2564
2646
|
fn: r$3,
|
|
@@ -2566,7 +2648,7 @@ var n$4 = createAdapter(adapterNextOptions, ({ adapterOptions: e })=>{
|
|
|
2566
2648
|
},
|
|
2567
2649
|
{
|
|
2568
2650
|
name: "i18nGet",
|
|
2569
|
-
fn:
|
|
2651
|
+
fn: f$2,
|
|
2570
2652
|
ext: "ts",
|
|
2571
2653
|
index: !0
|
|
2572
2654
|
}
|
|
@@ -2574,7 +2656,7 @@ var n$4 = createAdapter(adapterNextOptions, ({ adapterOptions: e })=>{
|
|
|
2574
2656
|
dependsOn: [
|
|
2575
2657
|
"react"
|
|
2576
2658
|
],
|
|
2577
|
-
files:
|
|
2659
|
+
files: c
|
|
2578
2660
|
};
|
|
2579
2661
|
});
|
|
2580
2662
|
|
package/api.esm.js
CHANGED
|
@@ -513,7 +513,7 @@ export const routes = ${e} as const;
|
|
|
513
513
|
`;
|
|
514
514
|
});
|
|
515
515
|
|
|
516
|
-
var u$
|
|
516
|
+
var u$3 = (({})=>`
|
|
517
517
|
|
|
518
518
|
export type RouteIdError = (typeof routesError)[number];
|
|
519
519
|
|
|
@@ -939,7 +939,7 @@ let c$2 = (e, a)=>!isArray(a) && isObject(a) && hasPlurals(a) ? hasOnlyPluralKey
|
|
|
939
939
|
} else o += "";
|
|
940
940
|
return(// adjust syntax
|
|
941
941
|
(o = o.replace(/;\[\];/g, "[];")).replace(/;+/g, ";"));
|
|
942
|
-
}, u$
|
|
942
|
+
}, u$2 = (e, t)=>{
|
|
943
943
|
let { translationFiles: a } = t, { defaultLocale: s } = e, n = a.filter((e)=>e.locale === s), o = [];
|
|
944
944
|
for(let e = 0; e < n.length; e++){
|
|
945
945
|
let { path: t, data: a } = n[e], s = t.replace(".json", "");
|
|
@@ -1068,7 +1068,7 @@ export namespace I18n {
|
|
|
1068
1068
|
* more sophisticated than the type result of \`typeof "./en/messages.json"\`
|
|
1069
1069
|
*/
|
|
1070
1070
|
export type TranslationsDictionary = {
|
|
1071
|
-
${u$
|
|
1071
|
+
${u$2(e, t).join("\n ")}
|
|
1072
1072
|
}
|
|
1073
1073
|
|
|
1074
1074
|
/**
|
|
@@ -1414,7 +1414,7 @@ var t$1 = createAdapter(adapterJsOptions, ({})=>({
|
|
|
1414
1414
|
},
|
|
1415
1415
|
{
|
|
1416
1416
|
name: "routesError",
|
|
1417
|
-
fn: u$
|
|
1417
|
+
fn: u$3,
|
|
1418
1418
|
ext: "ts"
|
|
1419
1419
|
},
|
|
1420
1420
|
{
|
|
@@ -1770,6 +1770,82 @@ export const I18nApp = (props: I18nAppProps) => {
|
|
|
1770
1770
|
export default I18nApp;
|
|
1771
1771
|
`);
|
|
1772
1772
|
|
|
1773
|
+
var o$6 = (({})=>`
|
|
1774
|
+
"use client";
|
|
1775
|
+
|
|
1776
|
+
import type { AppProps } from "next/app";
|
|
1777
|
+
import { defaultI18nMetadata } from "./defaultI18nMetadata";
|
|
1778
|
+
import { defaultLocale } from "./defaultLocale";
|
|
1779
|
+
import { I18nProvider } from "./I18nProvider";
|
|
1780
|
+
import { I18nMetadataProvider } from "./I18nMetadataProvider";
|
|
1781
|
+
import { I18nEffects } from "./I18nEffects";
|
|
1782
|
+
import { I18nHead } from "./I18nHead";
|
|
1783
|
+
import type { I18n } from "./types";
|
|
1784
|
+
|
|
1785
|
+
/**
|
|
1786
|
+
* @internal
|
|
1787
|
+
*/
|
|
1788
|
+
export type I18nAppPropsData = {
|
|
1789
|
+
i18n: {
|
|
1790
|
+
locale: I18n.Locale;
|
|
1791
|
+
dictionaries: I18n.Dictionaries;
|
|
1792
|
+
metadata: I18n.Metadata;
|
|
1793
|
+
}
|
|
1794
|
+
};
|
|
1795
|
+
|
|
1796
|
+
const i18nDefaults: I18nAppPropsData["i18n"] = {
|
|
1797
|
+
locale: defaultLocale,
|
|
1798
|
+
dictionaries: {},
|
|
1799
|
+
metadata: defaultI18nMetadata
|
|
1800
|
+
};
|
|
1801
|
+
|
|
1802
|
+
type I18nAppProps = React.PropsWithChildren<
|
|
1803
|
+
AppProps<I18nAppPropsData>["pageProps"]
|
|
1804
|
+
>;
|
|
1805
|
+
|
|
1806
|
+
/**
|
|
1807
|
+
* To use in \`_app.tsx\` file wrapping your component
|
|
1808
|
+
*
|
|
1809
|
+
* **For Pages Router only**
|
|
1810
|
+
*
|
|
1811
|
+
* NB: Consider that when using ISR with \`fallback: true\` the first load
|
|
1812
|
+
* will not have any useful i18n data (App's \`pageProps\` is an empty object),
|
|
1813
|
+
* hence we provide a \`i18nDefaults\` object.
|
|
1814
|
+
*
|
|
1815
|
+
* @usage
|
|
1816
|
+
* \`\`\`ts
|
|
1817
|
+
* export default function App(props: AppProps) {
|
|
1818
|
+
* const { Component, pageProps } = props;
|
|
1819
|
+
*
|
|
1820
|
+
* return (
|
|
1821
|
+
* <I18nApp {...pageProps}>
|
|
1822
|
+
* <Component {...pageProps} />
|
|
1823
|
+
* </I18nApp>
|
|
1824
|
+
* );
|
|
1825
|
+
* }
|
|
1826
|
+
* \`\`\`
|
|
1827
|
+
*/
|
|
1828
|
+
export const I18nApp = (props: I18nAppProps) => {
|
|
1829
|
+
const { i18n, children } = props;
|
|
1830
|
+
const { locale, dictionaries, metadata } = i18n || i18nDefaults;
|
|
1831
|
+
|
|
1832
|
+
return (
|
|
1833
|
+
<I18nProvider
|
|
1834
|
+
locale={locale}
|
|
1835
|
+
dictionaries={dictionaries}
|
|
1836
|
+
>
|
|
1837
|
+
<I18nHead metadata={metadata} />
|
|
1838
|
+
<I18nMetadataProvider metadata={metadata}>
|
|
1839
|
+
{children}
|
|
1840
|
+
</I18nMetadataProvider>
|
|
1841
|
+
<I18nEffects />
|
|
1842
|
+
</I18nProvider>
|
|
1843
|
+
);
|
|
1844
|
+
};
|
|
1845
|
+
|
|
1846
|
+
export default I18nApp;
|
|
1847
|
+
`);
|
|
1848
|
+
|
|
1773
1849
|
/**
|
|
1774
1850
|
* We cannot re-use `I18nHeadTags` as NextHead component does needs HTML tags
|
|
1775
1851
|
* to be its immediate children.
|
|
@@ -1817,7 +1893,7 @@ export const I18nHead = (props: I18nHeadProps) => {
|
|
|
1817
1893
|
// export default I18nHead;
|
|
1818
1894
|
`);
|
|
1819
1895
|
|
|
1820
|
-
var
|
|
1896
|
+
var m$3 = (({})=>`
|
|
1821
1897
|
import { I18nProvider } from "./I18nProvider";
|
|
1822
1898
|
import { defaultLocale } from "./defaultLocale";
|
|
1823
1899
|
// import { getI18nDictionaries } from "./getI18nDictionaries";
|
|
@@ -1856,7 +1932,7 @@ export const I18nLayout = async ({
|
|
|
1856
1932
|
export default I18nLayout;
|
|
1857
1933
|
`);
|
|
1858
1934
|
|
|
1859
|
-
var
|
|
1935
|
+
var i$4 = (({ config: { single: t }, options: { routes: { localeParamName: a } } })=>`
|
|
1860
1936
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1861
1937
|
import { notFound } from "next/navigation";
|
|
1862
1938
|
import { I18nMetadataSetter } from "./I18nMetadataSetter";
|
|
@@ -1958,7 +2034,7 @@ I18nPage.metadata = <TRouteId extends I18n.RouteId>(
|
|
|
1958
2034
|
export default I18nPage;
|
|
1959
2035
|
`);
|
|
1960
2036
|
|
|
1961
|
-
var
|
|
2037
|
+
var x$2 = (({})=>`
|
|
1962
2038
|
import { defaultI18nMetadata } from "./defaultI18nMetadata";
|
|
1963
2039
|
import { I18nMetadataProvider } from "./I18nMetadataProvider";
|
|
1964
2040
|
import { I18nRouteProvider } from "./I18nRouteProvider";
|
|
@@ -1985,7 +2061,7 @@ export const I18nRoot = ({ children }: I18nRootProps) => {
|
|
|
1985
2061
|
export default I18nRoot;
|
|
1986
2062
|
`);
|
|
1987
2063
|
|
|
1988
|
-
var
|
|
2064
|
+
var a$3 = (({})=>`
|
|
1989
2065
|
"use client";
|
|
1990
2066
|
|
|
1991
2067
|
import { useContext, useEffect } from "react";
|
|
@@ -2030,7 +2106,7 @@ export const I18nSetter = <TRouteId extends I18n.RouteId>(
|
|
|
2030
2106
|
export default I18nSetter;
|
|
2031
2107
|
`);
|
|
2032
2108
|
|
|
2033
|
-
var
|
|
2109
|
+
var f$2 = (({ options: { routes: { localeParamName: a } } })=>`
|
|
2034
2110
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2035
2111
|
import type { GetStaticPathsContext, GetStaticPropsContext } from "next";
|
|
2036
2112
|
import type { I18nAppPropsData } from "./I18nApp";
|
|
@@ -2346,12 +2422,12 @@ const generateRewriteForPathname = (e, t, r, a, l)=>{
|
|
|
2346
2422
|
e.source.localeCompare(t.source));
|
|
2347
2423
|
};
|
|
2348
2424
|
|
|
2349
|
-
var
|
|
2425
|
+
var s$4 = (({ config: e, routes: t, options: o })=>{
|
|
2350
2426
|
let l = JSON.stringify(generateRewrites(e, o.routes, t.byId), null, 2);
|
|
2351
2427
|
return `module.exports = ${l}`;
|
|
2352
2428
|
});
|
|
2353
2429
|
|
|
2354
|
-
var
|
|
2430
|
+
var d$4 = (({ options: { routes: { localeParamName: t } }, adapterOptions: { router: e } })=>{
|
|
2355
2431
|
let o = t ? `.replace("[${t}]/", "")` : "";
|
|
2356
2432
|
switch(e){
|
|
2357
2433
|
case "app":
|
|
@@ -2410,7 +2486,7 @@ export default useRouteId;
|
|
|
2410
2486
|
}
|
|
2411
2487
|
});
|
|
2412
2488
|
|
|
2413
|
-
var
|
|
2489
|
+
var I$2 = (({})=>`
|
|
2414
2490
|
"use client";
|
|
2415
2491
|
|
|
2416
2492
|
import { to } from "./to";
|
|
@@ -2437,7 +2513,7 @@ export const useTo = () => {
|
|
|
2437
2513
|
export default useTo;
|
|
2438
2514
|
`);
|
|
2439
2515
|
|
|
2440
|
-
var
|
|
2516
|
+
var u$1 = (({})=>`
|
|
2441
2517
|
"use client";
|
|
2442
2518
|
|
|
2443
2519
|
import { toSpa } from "./toSpa";
|
|
@@ -2473,7 +2549,7 @@ export default useToSpa;
|
|
|
2473
2549
|
`);
|
|
2474
2550
|
|
|
2475
2551
|
var n$4 = createAdapter(adapterNextOptions, ({ adapterOptions: e })=>{
|
|
2476
|
-
let { router: t } = e,
|
|
2552
|
+
let { router: t } = e, c = [
|
|
2477
2553
|
// TODO: maybe remove these files, they are useful for debugging for now
|
|
2478
2554
|
// but probably will be useless
|
|
2479
2555
|
{
|
|
@@ -2483,51 +2559,51 @@ var n$4 = createAdapter(adapterNextOptions, ({ adapterOptions: e })=>{
|
|
|
2483
2559
|
},
|
|
2484
2560
|
{
|
|
2485
2561
|
name: "next-rewrites",
|
|
2486
|
-
fn:
|
|
2562
|
+
fn: s$4,
|
|
2487
2563
|
ext: "js"
|
|
2488
2564
|
},
|
|
2489
2565
|
{
|
|
2490
2566
|
name: "useRouteId",
|
|
2491
|
-
fn:
|
|
2567
|
+
fn: d$4,
|
|
2492
2568
|
ext: "ts",
|
|
2493
2569
|
index: !0
|
|
2494
2570
|
},
|
|
2495
2571
|
{
|
|
2496
2572
|
name: "useTo",
|
|
2497
|
-
fn:
|
|
2573
|
+
fn: I$2,
|
|
2498
2574
|
ext: "ts",
|
|
2499
2575
|
index: !0
|
|
2500
2576
|
},
|
|
2501
2577
|
{
|
|
2502
2578
|
name: "useToSpa",
|
|
2503
|
-
fn:
|
|
2579
|
+
fn: u$1,
|
|
2504
2580
|
ext: "ts",
|
|
2505
2581
|
index: !0
|
|
2506
2582
|
}
|
|
2507
2583
|
];
|
|
2508
|
-
return ("app" === t || "migrating" === t) && (
|
|
2584
|
+
return ("app" === t || "migrating" === t) && (c = c.concat([
|
|
2509
2585
|
{
|
|
2510
2586
|
name: "I18nLayout",
|
|
2511
|
-
fn:
|
|
2587
|
+
fn: m$3,
|
|
2512
2588
|
ext: "tsx",
|
|
2513
2589
|
index: !0
|
|
2514
2590
|
},
|
|
2515
2591
|
{
|
|
2516
2592
|
name: "I18nPage",
|
|
2517
|
-
fn:
|
|
2593
|
+
fn: i$4,
|
|
2518
2594
|
ext: "tsx",
|
|
2519
2595
|
index: !0
|
|
2520
2596
|
},
|
|
2521
2597
|
{
|
|
2522
2598
|
name: "I18nRoot",
|
|
2523
|
-
fn:
|
|
2599
|
+
fn: x$2,
|
|
2524
2600
|
ext: "tsx",
|
|
2525
2601
|
index: !0
|
|
2526
2602
|
}
|
|
2527
|
-
])), ("pages" === t || "migrating" === t) && (
|
|
2603
|
+
])), ("pages" === t || "migrating" === t) && (c = c.concat([
|
|
2528
2604
|
{
|
|
2529
2605
|
name: "I18nSetter",
|
|
2530
|
-
fn:
|
|
2606
|
+
fn: a$3,
|
|
2531
2607
|
ext: "tsx",
|
|
2532
2608
|
index: !0
|
|
2533
2609
|
},
|
|
@@ -2537,6 +2613,12 @@ var n$4 = createAdapter(adapterNextOptions, ({ adapterOptions: e })=>{
|
|
|
2537
2613
|
ext: "tsx",
|
|
2538
2614
|
index: !0
|
|
2539
2615
|
},
|
|
2616
|
+
{
|
|
2617
|
+
name: "I18nDocument",
|
|
2618
|
+
fn: o$6,
|
|
2619
|
+
ext: "tsx",
|
|
2620
|
+
index: !0
|
|
2621
|
+
},
|
|
2540
2622
|
{
|
|
2541
2623
|
name: "I18nHead",
|
|
2542
2624
|
fn: r$3,
|
|
@@ -2544,7 +2626,7 @@ var n$4 = createAdapter(adapterNextOptions, ({ adapterOptions: e })=>{
|
|
|
2544
2626
|
},
|
|
2545
2627
|
{
|
|
2546
2628
|
name: "i18nGet",
|
|
2547
|
-
fn:
|
|
2629
|
+
fn: f$2,
|
|
2548
2630
|
ext: "ts",
|
|
2549
2631
|
index: !0
|
|
2550
2632
|
}
|
|
@@ -2552,7 +2634,7 @@ var n$4 = createAdapter(adapterNextOptions, ({ adapterOptions: e })=>{
|
|
|
2552
2634
|
dependsOn: [
|
|
2553
2635
|
"react"
|
|
2554
2636
|
],
|
|
2555
|
-
files:
|
|
2637
|
+
files: c
|
|
2556
2638
|
};
|
|
2557
2639
|
});
|
|
2558
2640
|
|
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"name": "@koine/i18n",
|
|
3
3
|
"sideEffects": false,
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@koine/node": "2.0.0-beta.
|
|
6
|
-
"@koine/utils": "2.0.0-beta.
|
|
5
|
+
"@koine/node": "2.0.0-beta.105",
|
|
6
|
+
"@koine/utils": "2.0.0-beta.105",
|
|
7
7
|
"glob": "^10.3.10",
|
|
8
8
|
"webpack": "^5.90.1",
|
|
9
9
|
"minimatch": "^9.0.3",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
},
|
|
59
59
|
"module": "./index.esm.js",
|
|
60
60
|
"main": "./index.cjs.js",
|
|
61
|
-
"version": "2.0.0-beta.
|
|
61
|
+
"version": "2.0.0-beta.105"
|
|
62
62
|
}
|