@fluenti/next 0.1.0
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/LICENSE +21 -0
- package/README.md +325 -0
- package/client.d.ts +9 -0
- package/dist/client-provider.d.ts +17 -0
- package/dist/client-provider.d.ts.map +1 -0
- package/dist/generate-server-module.d.ts +11 -0
- package/dist/generate-server-module.d.ts.map +1 -0
- package/dist/index.cjs +128 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +183 -0
- package/dist/index.js.map +1 -0
- package/dist/loader.cjs +2 -0
- package/dist/loader.cjs.map +1 -0
- package/dist/loader.js +29 -0
- package/dist/loader.js.map +1 -0
- package/dist/provider.cjs +8 -0
- package/dist/provider.cjs.map +1 -0
- package/dist/provider.d.ts +3 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +197 -0
- package/dist/provider.js.map +1 -0
- package/dist/read-config.d.ts +6 -0
- package/dist/read-config.d.ts.map +1 -0
- package/dist/scope-transform.d.ts +3 -0
- package/dist/scope-transform.d.ts.map +1 -0
- package/dist/server.cjs +2 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +14 -0
- package/dist/server.js.map +1 -0
- package/dist/trans-transform.d.ts +3 -0
- package/dist/trans-transform.d.ts.map +1 -0
- package/dist/types.d.ts +59 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/with-fluenti.d.ts +26 -0
- package/dist/with-fluenti.d.ts.map +1 -0
- package/dist/with-locale.d.ts +28 -0
- package/dist/with-locale.d.ts.map +1 -0
- package/package.json +101 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { basename as e, dirname as t, extname as n, join as r, relative as i, resolve as a } from "node:path";
|
|
2
|
+
import { existsSync as o, mkdirSync as s, readFileSync as c, rmSync as l, writeFileSync as u } from "node:fs";
|
|
3
|
+
import { createRequire as d } from "node:module";
|
|
4
|
+
//#region src/read-config.ts
|
|
5
|
+
var f = typeof __filename == "string" ? __filename : import.meta.url, { createJiti: p } = d(f)("jiti");
|
|
6
|
+
function m(e, t) {
|
|
7
|
+
let n = h(e), i = t?.defaultLocale ?? n?.sourceLocale ?? "en", a = t?.locales ?? n?.locales ?? [i], o = t?.compiledDir ?? n?.compileOutDir ?? "./src/locales/compiled", s = t?.serverModuleOutDir ?? r("node_modules", ".fluenti"), c = {
|
|
8
|
+
locales: a,
|
|
9
|
+
defaultLocale: i,
|
|
10
|
+
compiledDir: o,
|
|
11
|
+
serverModule: t?.serverModule ?? null,
|
|
12
|
+
serverModuleOutDir: s
|
|
13
|
+
};
|
|
14
|
+
return t?.resolveLocale && (c.resolveLocale = t.resolveLocale), t?.dateFormats && (c.dateFormats = t.dateFormats), t?.numberFormats && (c.numberFormats = t.numberFormats), t?.fallbackChain && (c.fallbackChain = t.fallbackChain), c;
|
|
15
|
+
}
|
|
16
|
+
function h(e) {
|
|
17
|
+
let t = p(f, {
|
|
18
|
+
moduleCache: !1,
|
|
19
|
+
interopDefault: !0
|
|
20
|
+
});
|
|
21
|
+
for (let n of [
|
|
22
|
+
"fluenti.config.ts",
|
|
23
|
+
"fluenti.config.js",
|
|
24
|
+
"fluenti.config.mjs"
|
|
25
|
+
]) {
|
|
26
|
+
let r = a(e, n);
|
|
27
|
+
if (o(r)) try {
|
|
28
|
+
return _(t(r));
|
|
29
|
+
} catch {
|
|
30
|
+
return g(r, t) || null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
function g(i, a) {
|
|
36
|
+
let o = c(i, "utf8"), s = o.match(/import\s*\{\s*defineConfig(?:\s+as\s+([A-Za-z_$][\w$]*))?\s*\}\s*from\s*['"]@fluenti\/cli['"]\s*;?/);
|
|
37
|
+
if (!s) return null;
|
|
38
|
+
let d = s[1] ?? "defineConfig", f = o.replace(s[0], ""), p = r(t(i), `.${e(i, n(i))}.next-plugin-read-config${n(i) || ".ts"}`);
|
|
39
|
+
u(p, `const ${d} = (config) => config\n${f}`, "utf8");
|
|
40
|
+
try {
|
|
41
|
+
return _(a(p));
|
|
42
|
+
} catch {
|
|
43
|
+
return null;
|
|
44
|
+
} finally {
|
|
45
|
+
l(p, { force: !0 });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function _(e) {
|
|
49
|
+
return typeof e == "object" && e && "default" in e ? e.default ?? {} : e;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/generate-server-module.ts
|
|
53
|
+
function v(e, t) {
|
|
54
|
+
if (t.serverModule) return a(e, t.serverModule);
|
|
55
|
+
let n = a(e, t.serverModuleOutDir), r = a(n, "server.js"), c = a(n, "server.d.ts");
|
|
56
|
+
o(n) || s(n, { recursive: !0 });
|
|
57
|
+
let l = y(i(n, a(e, t.compiledDir))), d = t.locales.map((e) => ` case '${e}': return import('${l}/${e}')`).join("\n"), f = t.fallbackChain ? JSON.stringify(t.fallbackChain) : "undefined";
|
|
58
|
+
u(a(n, "client-provider.js"), `"use client";
|
|
59
|
+
// Auto-generated by @fluenti/next — do not edit
|
|
60
|
+
import { createElement } from 'react'
|
|
61
|
+
import { I18nProvider } from '@fluenti/react'
|
|
62
|
+
${t.locales.map((e) => `import ${e.replace(/[^a-zA-Z0-9]/g, "_")} from '${l}/${e}'`).join("\n")}
|
|
63
|
+
|
|
64
|
+
const __allMessages = { ${t.locales.map((e) => `'${e}': ${e.replace(/[^a-zA-Z0-9]/g, "_")}`).join(", ")} }
|
|
65
|
+
|
|
66
|
+
export function ClientI18nProvider({ locale, fallbackLocale, fallbackChain, children }) {
|
|
67
|
+
return createElement(I18nProvider, { locale, fallbackLocale, messages: __allMessages, fallbackChain }, children)
|
|
68
|
+
}
|
|
69
|
+
`, "utf-8");
|
|
70
|
+
let p = t.resolveLocale ? `import __resolveLocale from '${t.resolveLocale}'` : null, m = t.resolveLocale ? "resolveLocale: __resolveLocale," : `resolveLocale: async () => {
|
|
71
|
+
try {
|
|
72
|
+
const { cookies } = await import('next/headers')
|
|
73
|
+
return (await cookies()).get('locale')?.value ?? '${t.defaultLocale}'
|
|
74
|
+
} catch {
|
|
75
|
+
return '${t.defaultLocale}'
|
|
76
|
+
}
|
|
77
|
+
},`;
|
|
78
|
+
return u(r, `// Auto-generated by @fluenti/next — do not edit
|
|
79
|
+
import { createServerI18n } from '@fluenti/react/server'
|
|
80
|
+
import { createElement } from 'react'
|
|
81
|
+
${p ? `${p}\n` : ""}
|
|
82
|
+
const serverI18n = createServerI18n({
|
|
83
|
+
loadMessages: async (locale) => {
|
|
84
|
+
switch (locale) {
|
|
85
|
+
${d}
|
|
86
|
+
default: return import('${l}/${t.defaultLocale}')
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
fallbackLocale: '${t.defaultLocale}',
|
|
90
|
+
fallbackChain: ${f},
|
|
91
|
+
${m}
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
export const setLocale = serverI18n.setLocale
|
|
95
|
+
export const getI18n = serverI18n.getI18n
|
|
96
|
+
export const t = (..._args) => {
|
|
97
|
+
throw new Error(
|
|
98
|
+
"[fluenti] \`t\` imported from '@fluenti/next/__generated' is a compile-time API. " +
|
|
99
|
+
'Use it only with the Fluenti loader inside an async server scope.',
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
export const Trans = serverI18n.Trans
|
|
103
|
+
export const Plural = serverI18n.Plural
|
|
104
|
+
export const Select = serverI18n.Select
|
|
105
|
+
export const DateTime = serverI18n.DateTime
|
|
106
|
+
export const NumberFormat = serverI18n.NumberFormat
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Async server component for root layouts.
|
|
110
|
+
*
|
|
111
|
+
* Sets up both server-side (React.cache) and client-side (I18nProvider) i18n.
|
|
112
|
+
*/
|
|
113
|
+
export async function FluentProvider({ locale, children }) {
|
|
114
|
+
const activeLocale = locale ?? '${t.defaultLocale}'
|
|
115
|
+
|
|
116
|
+
// 1. Initialize server-side i18n (React.cache scoped)
|
|
117
|
+
serverI18n.setLocale(activeLocale)
|
|
118
|
+
await serverI18n.getI18n()
|
|
119
|
+
|
|
120
|
+
// 2. Import the local 'use client' provider that has messages statically bundled.
|
|
121
|
+
// Messages contain functions (interpolation) which can't be serialized across the RSC boundary.
|
|
122
|
+
const { ClientI18nProvider } = await import('./client-provider.js')
|
|
123
|
+
|
|
124
|
+
return createElement(ClientI18nProvider, {
|
|
125
|
+
locale: activeLocale,
|
|
126
|
+
fallbackLocale: '${t.defaultLocale}',
|
|
127
|
+
fallbackChain: ${f},
|
|
128
|
+
}, children)
|
|
129
|
+
}
|
|
130
|
+
`, "utf-8"), u(c, "// Auto-generated by @fluenti/next — do not edit\nimport type { ReactNode, ReactElement } from 'react'\nimport type { CompileTimeT, FluentInstanceExtended } from '@fluenti/core'\n\nexport declare function setLocale(locale: string): void\nexport declare function getI18n(): Promise<FluentInstanceExtended & { locale: string }>\nexport declare const t: CompileTimeT\n\nexport declare function Trans(props: {\n children: ReactNode\n id?: string\n context?: string\n comment?: string\n render?: (translation: ReactNode) => ReactNode\n}): Promise<ReactElement>\n\nexport declare function Plural(props: {\n value: number\n id?: string\n context?: string\n comment?: string\n zero?: ReactNode\n one?: ReactNode\n two?: ReactNode\n few?: ReactNode\n many?: ReactNode\n other: ReactNode\n offset?: number\n}): Promise<ReactElement>\n\nexport declare function Select(props: {\n value: string\n id?: string\n context?: string\n comment?: string\n other: ReactNode\n options?: Record<string, ReactNode>\n [key: string]: ReactNode | Record<string, ReactNode> | string | undefined\n}): Promise<ReactElement>\n\nexport declare function DateTime(props: {\n value: Date | number\n style?: string\n}): Promise<ReactElement>\n\nexport declare function NumberFormat(props: {\n value: number\n style?: string\n}): Promise<ReactElement>\n\nexport declare function FluentProvider(props: {\n locale?: string\n children: ReactNode\n}): Promise<ReactElement>\n", "utf-8"), r;
|
|
131
|
+
}
|
|
132
|
+
function y(e) {
|
|
133
|
+
return e.split("\\").join("/");
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
//#region src/with-fluenti.ts
|
|
137
|
+
function b(e) {
|
|
138
|
+
if (e && x(e)) return S({}, e);
|
|
139
|
+
let t = e ?? {};
|
|
140
|
+
return function(e) {
|
|
141
|
+
return S(t, e ?? {});
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function x(e) {
|
|
145
|
+
return [
|
|
146
|
+
"reactStrictMode",
|
|
147
|
+
"experimental",
|
|
148
|
+
"images",
|
|
149
|
+
"env",
|
|
150
|
+
"webpack",
|
|
151
|
+
"rewrites",
|
|
152
|
+
"redirects",
|
|
153
|
+
"headers",
|
|
154
|
+
"pageExtensions",
|
|
155
|
+
"output",
|
|
156
|
+
"basePath",
|
|
157
|
+
"i18n",
|
|
158
|
+
"trailingSlash",
|
|
159
|
+
"compiler",
|
|
160
|
+
"transpilePackages"
|
|
161
|
+
].some((t) => t in e);
|
|
162
|
+
}
|
|
163
|
+
function S(e, n) {
|
|
164
|
+
let r = process.cwd(), i = v(r, m(r, e)), o = a(typeof __dirname < "u" ? __dirname : t(new URL(import.meta.url).pathname), "loader.js"), s = n.webpack;
|
|
165
|
+
return {
|
|
166
|
+
...n,
|
|
167
|
+
webpack(e, t) {
|
|
168
|
+
return e.module.rules.push({
|
|
169
|
+
test: /\.[jt]sx?$/,
|
|
170
|
+
enforce: "pre",
|
|
171
|
+
exclude: [/node_modules/, /\.next/],
|
|
172
|
+
use: [{
|
|
173
|
+
loader: o,
|
|
174
|
+
options: { serverModulePath: i }
|
|
175
|
+
}]
|
|
176
|
+
}), e.resolve = e.resolve ?? {}, e.resolve.alias = e.resolve.alias ?? {}, e.resolve.alias["@fluenti/next/__generated"] = i, s ? s(e, t) : e;
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
181
|
+
export { b as withFluenti };
|
|
182
|
+
|
|
183
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/read-config.ts","../src/generate-server-module.ts","../src/with-fluenti.ts"],"sourcesContent":["import { existsSync, readFileSync, rmSync, writeFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\nimport { basename, dirname, extname, join, resolve } from 'node:path'\nimport type { FluentiConfig } from '@fluenti/core'\nimport type { WithFluentConfig, ResolvedFluentConfig } from './types'\n\nconst runtimeModulePath = typeof __filename === 'string'\n ? __filename\n : import.meta.url\nconst require = createRequire(runtimeModulePath)\nconst { createJiti } = require('jiti') as {\n createJiti: (\n url: string,\n options?: { moduleCache?: boolean; interopDefault?: boolean },\n ) => (path: string) => unknown\n}\n\n/**\n * Read fluenti.config.ts and merge with withFluenti() overrides.\n */\nexport function resolveConfig(\n projectRoot: string,\n overrides?: WithFluentConfig,\n): ResolvedFluentConfig {\n const fileConfig = readFluentConfigSync(projectRoot)\n\n const defaultLocale = overrides?.defaultLocale\n ?? fileConfig?.sourceLocale\n ?? 'en'\n\n const locales = overrides?.locales\n ?? fileConfig?.locales\n ?? [defaultLocale]\n\n const compiledDir = overrides?.compiledDir\n ?? fileConfig?.compileOutDir\n ?? './src/locales/compiled'\n\n const serverModuleOutDir = overrides?.serverModuleOutDir\n ?? join('node_modules', '.fluenti')\n\n const resolved: ResolvedFluentConfig = {\n locales,\n defaultLocale,\n compiledDir,\n serverModule: overrides?.serverModule ?? null,\n serverModuleOutDir,\n }\n if (overrides?.resolveLocale) resolved.resolveLocale = overrides.resolveLocale\n if (overrides?.dateFormats) resolved.dateFormats = overrides.dateFormats\n if (overrides?.numberFormats) resolved.numberFormats = overrides.numberFormats\n if (overrides?.fallbackChain) resolved.fallbackChain = overrides.fallbackChain\n return resolved\n}\n\n/**\n * Attempt to read fluenti.config.ts synchronously.\n * Returns null if file doesn't exist or can't be parsed.\n */\nfunction readFluentConfigSync(projectRoot: string): FluentiConfig | null {\n const jiti = createJiti(runtimeModulePath, {\n moduleCache: false,\n interopDefault: true,\n })\n const candidates = [\n 'fluenti.config.ts',\n 'fluenti.config.js',\n 'fluenti.config.mjs',\n ]\n\n for (const name of candidates) {\n const configPath = resolve(projectRoot, name)\n if (existsSync(configPath)) {\n try {\n return normalizeLoadedConfig(jiti(configPath) as FluentiConfig | { default?: FluentiConfig })\n } catch {\n const rewritten = tryLoadConfigViaDefineConfigShim(configPath, jiti)\n if (rewritten) {\n return rewritten\n }\n return null\n }\n }\n }\n\n return null\n}\n\nfunction tryLoadConfigViaDefineConfigShim(\n configPath: string,\n jiti: (path: string) => unknown,\n): FluentiConfig | null {\n const source = readFileSync(configPath, 'utf8')\n const importMatch = source.match(\n /import\\s*\\{\\s*defineConfig(?:\\s+as\\s+([A-Za-z_$][\\w$]*))?\\s*\\}\\s*from\\s*['\"]@fluenti\\/cli['\"]\\s*;?/,\n )\n if (!importMatch) {\n return null\n }\n\n const helperName = importMatch[1] ?? 'defineConfig'\n const rewrittenSource = source.replace(importMatch[0], '')\n const tempPath = join(\n dirname(configPath),\n `.${basename(configPath, extname(configPath))}.next-plugin-read-config${extname(configPath) || '.ts'}`,\n )\n\n writeFileSync(tempPath, `const ${helperName} = (config) => config\\n${rewrittenSource}`, 'utf8')\n\n try {\n return normalizeLoadedConfig(jiti(tempPath) as FluentiConfig | { default?: FluentiConfig })\n } catch {\n return null\n } finally {\n rmSync(tempPath, { force: true })\n }\n}\n\nfunction normalizeLoadedConfig(\n mod: FluentiConfig | { default?: FluentiConfig },\n): FluentiConfig {\n return typeof mod === 'object' && mod !== null && 'default' in mod\n ? (mod.default ?? {}) as FluentiConfig\n : mod as FluentiConfig\n}\n","import { writeFileSync, mkdirSync, existsSync } from 'node:fs'\nimport { resolve, relative } from 'node:path'\nimport type { ResolvedFluentConfig } from './types'\n\n/**\n * Generate the server module that provides:\n * - setLocale / getI18n\n * - Trans / Plural / Select / DateTime / NumberFormat (server components)\n * - FluentProvider (async server component for layouts)\n *\n * @returns Absolute path to the generated server module.\n */\nexport function generateServerModule(\n projectRoot: string,\n config: ResolvedFluentConfig,\n): string {\n if (config.serverModule) {\n return resolve(projectRoot, config.serverModule)\n }\n\n const outDir = resolve(projectRoot, config.serverModuleOutDir)\n const outPath = resolve(outDir, 'server.js')\n const dtsPath = resolve(outDir, 'server.d.ts')\n\n if (!existsSync(outDir)) {\n mkdirSync(outDir, { recursive: true })\n }\n\n const compiledDirAbs = resolve(projectRoot, config.compiledDir)\n const compiledRelative = toForwardSlash(relative(outDir, compiledDirAbs))\n\n const localeImports = config.locales\n .map((locale) => ` case '${locale}': return import('${compiledRelative}/${locale}')`)\n .join('\\n')\n\n const fallbackChainStr = config.fallbackChain\n ? JSON.stringify(config.fallbackChain)\n : 'undefined'\n\n // Generate a 'use client' provider that imports messages statically.\n // Messages contain functions (interpolation) which can't cross the RSC boundary.\n const clientProviderPath = resolve(outDir, 'client-provider.js')\n\n const clientStaticImports = config.locales\n .map((locale) => {\n const safe = locale.replace(/[^a-zA-Z0-9]/g, '_')\n return `import ${safe} from '${compiledRelative}/${locale}'`\n })\n .join('\\n')\n\n const clientAllMessagesEntries = config.locales\n .map((locale) => {\n const safe = locale.replace(/[^a-zA-Z0-9]/g, '_')\n return `'${locale}': ${safe}`\n })\n .join(', ')\n\n const clientProviderSource = `\"use client\";\n// Auto-generated by @fluenti/next — do not edit\nimport { createElement } from 'react'\nimport { I18nProvider } from '@fluenti/react'\n${clientStaticImports}\n\nconst __allMessages = { ${clientAllMessagesEntries} }\n\nexport function ClientI18nProvider({ locale, fallbackLocale, fallbackChain, children }) {\n return createElement(I18nProvider, { locale, fallbackLocale, messages: __allMessages, fallbackChain }, children)\n}\n`\n writeFileSync(clientProviderPath, clientProviderSource, 'utf-8')\n\n const resolveLocaleImport = config.resolveLocale\n ? `import __resolveLocale from '${config.resolveLocale}'`\n : null\n\n const resolveLocaleFn = config.resolveLocale\n ? `resolveLocale: __resolveLocale,`\n : `resolveLocale: async () => {\n try {\n const { cookies } = await import('next/headers')\n return (await cookies()).get('locale')?.value ?? '${config.defaultLocale}'\n } catch {\n return '${config.defaultLocale}'\n }\n },`\n\n const moduleSource = `// Auto-generated by @fluenti/next — do not edit\nimport { createServerI18n } from '@fluenti/react/server'\nimport { createElement } from 'react'\n${resolveLocaleImport ? `${resolveLocaleImport}\\n` : ''}\nconst serverI18n = createServerI18n({\n loadMessages: async (locale) => {\n switch (locale) {\n${localeImports}\n default: return import('${compiledRelative}/${config.defaultLocale}')\n }\n },\n fallbackLocale: '${config.defaultLocale}',\n fallbackChain: ${fallbackChainStr},\n ${resolveLocaleFn}\n})\n\nexport const setLocale = serverI18n.setLocale\nexport const getI18n = serverI18n.getI18n\nexport const t = (..._args) => {\n throw new Error(\n \"[fluenti] \\`t\\` imported from '@fluenti/next/__generated' is a compile-time API. \" +\n 'Use it only with the Fluenti loader inside an async server scope.',\n )\n}\nexport const Trans = serverI18n.Trans\nexport const Plural = serverI18n.Plural\nexport const Select = serverI18n.Select\nexport const DateTime = serverI18n.DateTime\nexport const NumberFormat = serverI18n.NumberFormat\n\n/**\n * Async server component for root layouts.\n *\n * Sets up both server-side (React.cache) and client-side (I18nProvider) i18n.\n */\nexport async function FluentProvider({ locale, children }) {\n const activeLocale = locale ?? '${config.defaultLocale}'\n\n // 1. Initialize server-side i18n (React.cache scoped)\n serverI18n.setLocale(activeLocale)\n await serverI18n.getI18n()\n\n // 2. Import the local 'use client' provider that has messages statically bundled.\n // Messages contain functions (interpolation) which can't be serialized across the RSC boundary.\n const { ClientI18nProvider } = await import('./client-provider.js')\n\n return createElement(ClientI18nProvider, {\n locale: activeLocale,\n fallbackLocale: '${config.defaultLocale}',\n fallbackChain: ${fallbackChainStr},\n }, children)\n}\n`\n\n const dtsSource = `// Auto-generated by @fluenti/next — do not edit\nimport type { ReactNode, ReactElement } from 'react'\nimport type { CompileTimeT, FluentInstanceExtended } from '@fluenti/core'\n\nexport declare function setLocale(locale: string): void\nexport declare function getI18n(): Promise<FluentInstanceExtended & { locale: string }>\nexport declare const t: CompileTimeT\n\nexport declare function Trans(props: {\n children: ReactNode\n id?: string\n context?: string\n comment?: string\n render?: (translation: ReactNode) => ReactNode\n}): Promise<ReactElement>\n\nexport declare function Plural(props: {\n value: number\n id?: string\n context?: string\n comment?: string\n zero?: ReactNode\n one?: ReactNode\n two?: ReactNode\n few?: ReactNode\n many?: ReactNode\n other: ReactNode\n offset?: number\n}): Promise<ReactElement>\n\nexport declare function Select(props: {\n value: string\n id?: string\n context?: string\n comment?: string\n other: ReactNode\n options?: Record<string, ReactNode>\n [key: string]: ReactNode | Record<string, ReactNode> | string | undefined\n}): Promise<ReactElement>\n\nexport declare function DateTime(props: {\n value: Date | number\n style?: string\n}): Promise<ReactElement>\n\nexport declare function NumberFormat(props: {\n value: number\n style?: string\n}): Promise<ReactElement>\n\nexport declare function FluentProvider(props: {\n locale?: string\n children: ReactNode\n}): Promise<ReactElement>\n`\n\n writeFileSync(outPath, moduleSource, 'utf-8')\n writeFileSync(dtsPath, dtsSource, 'utf-8')\n\n return outPath\n}\n\nfunction toForwardSlash(p: string): string {\n return p.split('\\\\').join('/')\n}\n","import { resolve, dirname } from 'node:path'\nimport type { WithFluentConfig } from './types'\nimport { resolveConfig } from './read-config'\nimport { generateServerModule } from './generate-server-module'\n\ntype NextConfig = Record<string, unknown>\n\n/**\n * Wrap your Next.js config with Fluenti support.\n *\n * Adds a webpack loader that transforms `t\\`\\`` and `t()` calls,\n * and generates a server module for RSC i18n.\n *\n * @example\n * ```ts\n * // next.config.ts — function style (recommended)\n * import { withFluenti } from '@fluenti/next'\n * export default withFluenti()({ reactStrictMode: true })\n * ```\n *\n * @example\n * ```ts\n * // next.config.ts — direct style\n * import { withFluenti } from '@fluenti/next'\n * export default withFluenti({ reactStrictMode: true })\n * ```\n */\nexport function withFluenti(fluentConfig?: WithFluentConfig): (nextConfig?: NextConfig) => NextConfig\nexport function withFluenti(nextConfig: NextConfig): NextConfig\nexport function withFluenti(\n configOrNext?: WithFluentConfig | NextConfig,\n): NextConfig | ((nextConfig?: NextConfig) => NextConfig) {\n if (configOrNext && isNextConfig(configOrNext as NextConfig)) {\n return applyFluenti({}, configOrNext as NextConfig)\n }\n\n const fluentConfig = (configOrNext ?? {}) as WithFluentConfig\n return function wrappedConfig(nextConfig?: NextConfig): NextConfig {\n return applyFluenti(fluentConfig, nextConfig ?? {})\n }\n}\n\nfunction isNextConfig(obj: NextConfig): boolean {\n const nextKeys = [\n 'reactStrictMode', 'experimental', 'images', 'env', 'webpack',\n 'rewrites', 'redirects', 'headers', 'pageExtensions', 'output',\n 'basePath', 'i18n', 'trailingSlash', 'compiler', 'transpilePackages',\n ]\n return nextKeys.some((key) => key in obj)\n}\n\nfunction applyFluenti(\n fluentConfig: WithFluentConfig,\n nextConfig: NextConfig,\n): NextConfig {\n const projectRoot = process.cwd()\n const resolved = resolveConfig(projectRoot, fluentConfig)\n\n // Generate server module for RSC\n const serverModulePath = generateServerModule(projectRoot, resolved)\n\n // Resolve the loader path — use import.meta.url for ESM compatibility\n const thisDir = typeof __dirname !== 'undefined'\n ? __dirname\n : dirname(new URL(import.meta.url).pathname)\n const loaderPath = resolve(thisDir, 'loader.js')\n\n const existingWebpack = nextConfig['webpack'] as\n | ((config: WebpackConfig, options: WebpackOptions) => WebpackConfig)\n | undefined\n\n return {\n ...nextConfig,\n webpack(config: WebpackConfig, options: WebpackOptions) {\n // Add fluenti loader (enforce: pre — runs before other loaders)\n config.module.rules.push({\n test: /\\.[jt]sx?$/,\n enforce: 'pre' as const,\n exclude: [/node_modules/, /\\.next/],\n use: [\n {\n loader: loaderPath,\n options: {\n serverModulePath,\n },\n },\n ],\n })\n\n // Add resolve alias so loader can import from generated server module\n config.resolve = config.resolve ?? {} as WebpackConfig['resolve']\n config.resolve.alias = config.resolve.alias ?? {}\n config.resolve.alias['@fluenti/next/__generated'] = serverModulePath\n\n // Call user's webpack config if provided\n if (existingWebpack) {\n return existingWebpack(config, options)\n }\n\n return config\n },\n }\n}\n\n// Minimal webpack types for the config function\ninterface WebpackConfig {\n module: {\n rules: Array<{\n test: RegExp\n enforce?: 'pre' | 'post'\n exclude?: Array<RegExp>\n use: Array<{ loader: string; options: Record<string, unknown> }>\n }>\n }\n resolve: {\n alias?: Record<string, string>\n }\n}\n\ninterface WebpackOptions {\n isServer: boolean\n dev: boolean\n}\n"],"mappings":";;;;AAMA,IAAM,IAAoB,OAAO,cAAe,WAC5C,aACA,OAAO,KAAK,KAEV,EAAE,kBADQ,EAAc,EAAkB,CACjB,OAAO;AAUtC,SAAgB,EACd,GACA,GACsB;CACtB,IAAM,IAAa,EAAqB,EAAY,EAE9C,IAAgB,GAAW,iBAC5B,GAAY,gBACZ,MAEC,IAAU,GAAW,WACtB,GAAY,WACZ,CAAC,EAAc,EAEd,IAAc,GAAW,eAC1B,GAAY,iBACZ,0BAEC,IAAqB,GAAW,sBACjC,EAAK,gBAAgB,WAAW,EAE/B,IAAiC;EACrC;EACA;EACA;EACA,cAAc,GAAW,gBAAgB;EACzC;EACD;AAKD,QAJI,GAAW,kBAAe,EAAS,gBAAgB,EAAU,gBAC7D,GAAW,gBAAa,EAAS,cAAc,EAAU,cACzD,GAAW,kBAAe,EAAS,gBAAgB,EAAU,gBAC7D,GAAW,kBAAe,EAAS,gBAAgB,EAAU,gBAC1D;;AAOT,SAAS,EAAqB,GAA2C;CACvE,IAAM,IAAO,EAAW,GAAmB;EACzC,aAAa;EACb,gBAAgB;EACjB,CAAC;AAOF,MAAK,IAAM,KANQ;EACjB;EACA;EACA;EACD,EAE8B;EAC7B,IAAM,IAAa,EAAQ,GAAa,EAAK;AAC7C,MAAI,EAAW,EAAW,CACxB,KAAI;AACF,UAAO,EAAsB,EAAK,EAAW,CAAgD;UACvF;AAKN,UAJkB,EAAiC,GAAY,EAAK,IAI7D;;;AAKb,QAAO;;AAGT,SAAS,EACP,GACA,GACsB;CACtB,IAAM,IAAS,EAAa,GAAY,OAAO,EACzC,IAAc,EAAO,MACzB,qGACD;AAC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,QAAQ,GAAuB,GAAyB;AA0BtD,UAxBA,EAAO,OAAO,MAAM,KAAK;IACvB,MAAM;IACN,SAAS;IACT,SAAS,CAAC,gBAAgB,SAAS;IACnC,KAAK,CACH;KACE,QAAQ;KACR,SAAS,EACP,qBACD;KACF,CACF;IACF,CAAC,EAGF,EAAO,UAAU,EAAO,WAAW,EAAE,EACrC,EAAO,QAAQ,QAAQ,EAAO,QAAQ,SAAS,EAAE,EACjD,EAAO,QAAQ,MAAM,+BAA+B,GAGhD,IACK,EAAgB,GAAQ,EAAQ,GAGlC;;EAEV"}
|
package/dist/loader.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
let e=require(`@fluenti/core/internal`);function t(t){if(!/\.[jt]sx?$/.test(this.resourcePath)||/node_modules|\.next/.test(this.resourcePath))return t;let i=t,a=/^\s*['"]use client['"]/.test(i);if(/\.[jt]sx$/.test(this.resourcePath)&&/<Trans[\s>]/.test(i)){let t=(0,e.transformTransComponents)(i);t.transformed&&(i=t.code)}if(!r(i,a)&&!n(i))return i;let o=(0,e.scopeTransform)(i,{framework:`react`,serverModuleImport:`@fluenti/next/__generated`,treatFrameworkDirectImportsAsServer:!a,rerouteServerAuthoringImports:!a,errorOnServerUseI18n:!a});return o.transformed?o.code:i}function n(e){return/(?<![.\w$])t\(\s*['"]/.test(e)||/[A-Za-z_$][\w$]*\(\s*\{/.test(e)||/[A-Za-z_$][\w$]*`/.test(e)&&(e.includes(`useI18n`)||e.includes(`getI18n`))?!0:/import\s*\{\s*t(?:\s+as\s+[A-Za-z_$][\w$]*)?[\s,}]/.test(e)&&(e.includes(`@fluenti/react`)||e.includes(`@fluenti/next/__generated`))}function r(e,t){return t||!e.includes(`@fluenti/react`)&&!e.includes(`@fluenti/next/__generated`)?!1:/\b(useI18n|Trans|Plural|Select|DateTime|NumberFormat|t)\b/.test(e)}module.exports=t;
|
|
2
|
+
//# sourceMappingURL=loader.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.cjs","names":[],"sources":["../src/loader.ts"],"sourcesContent":["/**\n * Webpack loader for t`` and t() transforms in Next.js.\n *\n * Runs as enforce: 'pre' to transform source before other loaders.\n * Only statically provable `t` bindings are optimized; runtime `t()` calls\n * continue to work without injected proxy globals.\n */\nimport { scopeTransform } from './scope-transform'\nimport { transformTransComponents } from './trans-transform'\n\n/**\n * Webpack loader function.\n * `this` is the webpack LoaderContext.\n */\nexport default function fluentLoader(this: LoaderContext, source: string): string {\n // Only process .tsx, .ts, .jsx, .js files\n if (!/\\.[jt]sx?$/.test(this.resourcePath)) {\n return source\n }\n\n // Skip node_modules and .next directory\n if (/node_modules|\\.next/.test(this.resourcePath)) {\n return source\n }\n\n let result = source\n const isClientModule = /^\\s*['\"]use client['\"]/.test(result)\n\n // ── <Trans> compile-time optimization (JSX/TSX only) ──────────────\n if (/\\.[jt]sx$/.test(this.resourcePath) && /<Trans[\\s>]/.test(result)) {\n const transResult = transformTransComponents(result)\n if (transResult.transformed) {\n result = transResult.code\n }\n }\n\n // Quick check: does this file contain any Fluenti authoring/runtime surface?\n if (!isServerFluentiFile(result, isClientModule) && !hasFluentPatterns(result)) {\n return result\n }\n\n // Try scope-aware transform first (AST-based, zero false positives)\n const scoped = scopeTransform(result, {\n framework: 'react',\n serverModuleImport: '@fluenti/next/__generated',\n treatFrameworkDirectImportsAsServer: !isClientModule,\n rerouteServerAuthoringImports: !isClientModule,\n errorOnServerUseI18n: !isClientModule,\n })\n if (scoped.transformed) {\n return scoped.code\n }\n\n return result\n}\n\n/**\n * Quick regex check to avoid full parsing on files without t`` or t().\n */\nfunction hasFluentPatterns(code: string): boolean {\n if (/(?<![.\\w$])t\\(\\s*['\"]/.test(code) || /[A-Za-z_$][\\w$]*\\(\\s*\\{/.test(code)) {\n return true\n }\n\n if (/[A-Za-z_$][\\w$]*`/.test(code) && (code.includes('useI18n') || code.includes('getI18n'))) {\n return true\n }\n\n return /import\\s*\\{\\s*t(?:\\s+as\\s+[A-Za-z_$][\\w$]*)?[\\s,}]/.test(code)\n && (code.includes('@fluenti/react') || code.includes('@fluenti/next/__generated'))\n}\n\nfunction isServerFluentiFile(code: string, isClientModule: boolean): boolean {\n if (isClientModule) return false\n if (!code.includes('@fluenti/react') && !code.includes('@fluenti/next/__generated')) {\n return false\n }\n\n return /\\b(useI18n|Trans|Plural|Select|DateTime|NumberFormat|t)\\b/.test(code)\n}\n\ninterface LoaderContext {\n resourcePath: string\n getOptions(): Record<string, unknown>\n}\n"],"mappings":"wCAcA,SAAwB,EAAkC,EAAwB,CAOhF,GALI,CAAC,aAAa,KAAK,KAAK,aAAa,EAKrC,sBAAsB,KAAK,KAAK,aAAa,CAC/C,OAAO,EAGT,IAAI,EAAS,EACP,EAAiB,yBAAyB,KAAK,EAAO,CAG5D,GAAI,YAAY,KAAK,KAAK,aAAa,EAAI,cAAc,KAAK,EAAO,CAAE,CACrE,IAAM,GAAA,EAAA,EAAA,0BAAuC,EAAO,CAChD,EAAY,cACd,EAAS,EAAY,MAKzB,GAAI,CAAC,EAAoB,EAAQ,EAAe,EAAI,CAAC,EAAkB,EAAO,CAC5E,OAAO,EAIT,IAAM,GAAA,EAAA,EAAA,gBAAwB,EAAQ,CACpC,UAAW,QACX,mBAAoB,4BACpB,oCAAqC,CAAC,EACtC,8BAA+B,CAAC,EAChC,qBAAsB,CAAC,EACxB,CAAC,CAKF,OAJI,EAAO,YACF,EAAO,KAGT,EAMT,SAAS,EAAkB,EAAuB,CAShD,MARI,wBAAwB,KAAK,EAAK,EAAI,0BAA0B,KAAK,EAAK,EAI1E,oBAAoB,KAAK,EAAK,GAAK,EAAK,SAAS,UAAU,EAAI,EAAK,SAAS,UAAU,EAClF,GAGF,qDAAqD,KAAK,EAAK,GAChE,EAAK,SAAS,iBAAiB,EAAI,EAAK,SAAS,4BAA4B,EAGrF,SAAS,EAAoB,EAAc,EAAkC,CAM3E,OALI,GACA,CAAC,EAAK,SAAS,iBAAiB,EAAI,CAAC,EAAK,SAAS,4BAA4B,CAC1E,GAGF,4DAA4D,KAAK,EAAK"}
|
package/dist/loader.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { scopeTransform as e, transformTransComponents as t } from "@fluenti/core/internal";
|
|
2
|
+
//#region src/loader.ts
|
|
3
|
+
function n(n) {
|
|
4
|
+
if (!/\.[jt]sx?$/.test(this.resourcePath) || /node_modules|\.next/.test(this.resourcePath)) return n;
|
|
5
|
+
let a = n, o = /^\s*['"]use client['"]/.test(a);
|
|
6
|
+
if (/\.[jt]sx$/.test(this.resourcePath) && /<Trans[\s>]/.test(a)) {
|
|
7
|
+
let e = t(a);
|
|
8
|
+
e.transformed && (a = e.code);
|
|
9
|
+
}
|
|
10
|
+
if (!i(a, o) && !r(a)) return a;
|
|
11
|
+
let s = e(a, {
|
|
12
|
+
framework: "react",
|
|
13
|
+
serverModuleImport: "@fluenti/next/__generated",
|
|
14
|
+
treatFrameworkDirectImportsAsServer: !o,
|
|
15
|
+
rerouteServerAuthoringImports: !o,
|
|
16
|
+
errorOnServerUseI18n: !o
|
|
17
|
+
});
|
|
18
|
+
return s.transformed ? s.code : a;
|
|
19
|
+
}
|
|
20
|
+
function r(e) {
|
|
21
|
+
return /(?<![.\w$])t\(\s*['"]/.test(e) || /[A-Za-z_$][\w$]*\(\s*\{/.test(e) || /[A-Za-z_$][\w$]*`/.test(e) && (e.includes("useI18n") || e.includes("getI18n")) ? !0 : /import\s*\{\s*t(?:\s+as\s+[A-Za-z_$][\w$]*)?[\s,}]/.test(e) && (e.includes("@fluenti/react") || e.includes("@fluenti/next/__generated"));
|
|
22
|
+
}
|
|
23
|
+
function i(e, t) {
|
|
24
|
+
return t || !e.includes("@fluenti/react") && !e.includes("@fluenti/next/__generated") ? !1 : /\b(useI18n|Trans|Plural|Select|DateTime|NumberFormat|t)\b/.test(e);
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { n as default };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","names":[],"sources":["../src/loader.ts"],"sourcesContent":["/**\n * Webpack loader for t`` and t() transforms in Next.js.\n *\n * Runs as enforce: 'pre' to transform source before other loaders.\n * Only statically provable `t` bindings are optimized; runtime `t()` calls\n * continue to work without injected proxy globals.\n */\nimport { scopeTransform } from './scope-transform'\nimport { transformTransComponents } from './trans-transform'\n\n/**\n * Webpack loader function.\n * `this` is the webpack LoaderContext.\n */\nexport default function fluentLoader(this: LoaderContext, source: string): string {\n // Only process .tsx, .ts, .jsx, .js files\n if (!/\\.[jt]sx?$/.test(this.resourcePath)) {\n return source\n }\n\n // Skip node_modules and .next directory\n if (/node_modules|\\.next/.test(this.resourcePath)) {\n return source\n }\n\n let result = source\n const isClientModule = /^\\s*['\"]use client['\"]/.test(result)\n\n // ── <Trans> compile-time optimization (JSX/TSX only) ──────────────\n if (/\\.[jt]sx$/.test(this.resourcePath) && /<Trans[\\s>]/.test(result)) {\n const transResult = transformTransComponents(result)\n if (transResult.transformed) {\n result = transResult.code\n }\n }\n\n // Quick check: does this file contain any Fluenti authoring/runtime surface?\n if (!isServerFluentiFile(result, isClientModule) && !hasFluentPatterns(result)) {\n return result\n }\n\n // Try scope-aware transform first (AST-based, zero false positives)\n const scoped = scopeTransform(result, {\n framework: 'react',\n serverModuleImport: '@fluenti/next/__generated',\n treatFrameworkDirectImportsAsServer: !isClientModule,\n rerouteServerAuthoringImports: !isClientModule,\n errorOnServerUseI18n: !isClientModule,\n })\n if (scoped.transformed) {\n return scoped.code\n }\n\n return result\n}\n\n/**\n * Quick regex check to avoid full parsing on files without t`` or t().\n */\nfunction hasFluentPatterns(code: string): boolean {\n if (/(?<![.\\w$])t\\(\\s*['\"]/.test(code) || /[A-Za-z_$][\\w$]*\\(\\s*\\{/.test(code)) {\n return true\n }\n\n if (/[A-Za-z_$][\\w$]*`/.test(code) && (code.includes('useI18n') || code.includes('getI18n'))) {\n return true\n }\n\n return /import\\s*\\{\\s*t(?:\\s+as\\s+[A-Za-z_$][\\w$]*)?[\\s,}]/.test(code)\n && (code.includes('@fluenti/react') || code.includes('@fluenti/next/__generated'))\n}\n\nfunction isServerFluentiFile(code: string, isClientModule: boolean): boolean {\n if (isClientModule) return false\n if (!code.includes('@fluenti/react') && !code.includes('@fluenti/next/__generated')) {\n return false\n }\n\n return /\\b(useI18n|Trans|Plural|Select|DateTime|NumberFormat|t)\\b/.test(code)\n}\n\ninterface LoaderContext {\n resourcePath: string\n getOptions(): Record<string, unknown>\n}\n"],"mappings":";;AAcA,SAAwB,EAAkC,GAAwB;AAOhF,KALI,CAAC,aAAa,KAAK,KAAK,aAAa,IAKrC,sBAAsB,KAAK,KAAK,aAAa,CAC/C,QAAO;CAGT,IAAI,IAAS,GACP,IAAiB,yBAAyB,KAAK,EAAO;AAG5D,KAAI,YAAY,KAAK,KAAK,aAAa,IAAI,cAAc,KAAK,EAAO,EAAE;EACrE,IAAM,IAAc,EAAyB,EAAO;AACpD,EAAI,EAAY,gBACd,IAAS,EAAY;;AAKzB,KAAI,CAAC,EAAoB,GAAQ,EAAe,IAAI,CAAC,EAAkB,EAAO,CAC5E,QAAO;CAIT,IAAM,IAAS,EAAe,GAAQ;EACpC,WAAW;EACX,oBAAoB;EACpB,qCAAqC,CAAC;EACtC,+BAA+B,CAAC;EAChC,sBAAsB,CAAC;EACxB,CAAC;AAKF,QAJI,EAAO,cACF,EAAO,OAGT;;AAMT,SAAS,EAAkB,GAAuB;AAShD,QARI,wBAAwB,KAAK,EAAK,IAAI,0BAA0B,KAAK,EAAK,IAI1E,oBAAoB,KAAK,EAAK,KAAK,EAAK,SAAS,UAAU,IAAI,EAAK,SAAS,UAAU,IAClF,KAGF,qDAAqD,KAAK,EAAK,KAChE,EAAK,SAAS,iBAAiB,IAAI,EAAK,SAAS,4BAA4B;;AAGrF,SAAS,EAAoB,GAAc,GAAkC;AAM3E,QALI,KACA,CAAC,EAAK,SAAS,iBAAiB,IAAI,CAAC,EAAK,SAAS,4BAA4B,GAC1E,KAGF,4DAA4D,KAAK,EAAK"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);let t=require(`@fluenti/react`);var n=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),r=e((e=>{process.env.NODE_ENV!==`production`&&(function(){function t(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===O?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(typeof e.tag==`number`&&console.error(`Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.`),e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var n=e.render;return e=e.displayName,e||=(e=n.displayName||n.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return n=e.displayName||null,n===null?t(e.type)||`Memo`:n;case E:n=e._payload,e=e._init;try{return t(e(n))}catch{}}return null}function n(e){return``+e}function r(e){try{n(e);var t=!1}catch{t=!0}if(t){t=console;var r=t.error,i=typeof Symbol==`function`&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||`Object`;return r.call(t,`The provided key is an unsupported type %s. This value must be coerced to a string before using it here.`,i),n(e)}}function i(e){if(e===_)return`<>`;if(typeof e==`object`&&e&&e.$$typeof===E)return`<...>`;try{var n=t(e);return n?`<`+n+`>`:`<...>`}catch{return`<...>`}}function a(){var e=k.A;return e===null?null:e.getOwner()}function o(){return Error(`react-stack-top-frame`)}function s(e){if(A.call(e,`key`)){var t=Object.getOwnPropertyDescriptor(e,`key`).get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function c(e,t){function n(){N||(N=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,`key`,{get:n,configurable:!0})}function l(){var e=t(this.type);return P[e]||(P[e]=!0,console.error(`Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.`)),e=this.props.ref,e===void 0?null:e}function u(e,t,n,r,i,a){var o=n.ref;return e={$$typeof:h,type:e,key:t,props:n,_owner:r},(o===void 0?null:o)===null?Object.defineProperty(e,`ref`,{enumerable:!1,value:null}):Object.defineProperty(e,`ref`,{enumerable:!1,get:l}),e._store={},Object.defineProperty(e._store,`validated`,{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,`_debugInfo`,{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,`_debugStack`,{configurable:!1,enumerable:!1,writable:!0,value:i}),Object.defineProperty(e,`_debugTask`,{configurable:!1,enumerable:!1,writable:!0,value:a}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function d(e,n,i,o,l,d){var p=n.children;if(p!==void 0)if(o)if(j(p)){for(o=0;o<p.length;o++)f(p[o]);Object.freeze&&Object.freeze(p)}else console.error(`React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.`);else f(p);if(A.call(n,`key`)){p=t(e);var m=Object.keys(n).filter(function(e){return e!==`key`});o=0<m.length?`{key: someKey, `+m.join(`: ..., `)+`: ...}`:`{key: someKey}`,L[p+o]||(m=0<m.length?`{`+m.join(`: ..., `)+`: ...}`:`{}`,console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
3
|
+
let props = %s;
|
|
4
|
+
<%s {...props} />
|
|
5
|
+
React keys must be passed directly to JSX without using spread:
|
|
6
|
+
let props = %s;
|
|
7
|
+
<%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require(`react`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),i=e(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=n():t.exports=r()}))();function a({locale:e,fallbackLocale:n,messages:r,fallbackChain:a,dateFormats:o,numberFormats:s,children:c}){return(0,i.jsx)(t.I18nProvider,{locale:e,fallbackLocale:n,messages:r,...a?{fallbackChain:a}:{},...o?{dateFormats:o}:{},...s?{numberFormats:s}:{},children:c})}exports.FluentProvider=a;
|
|
8
|
+
//# sourceMappingURL=provider.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.cjs","names":[],"sources":["../../../node_modules/.pnpm/react@19.2.4/node_modules/react/cjs/react-jsx-runtime.production.js","../../../node_modules/.pnpm/react@19.2.4/node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/.pnpm/react@19.2.4/node_modules/react/jsx-runtime.js","../src/client-provider.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\");\nfunction jsxProd(type, config, maybeKey) {\n var key = null;\n void 0 !== maybeKey && (key = \"\" + maybeKey);\n void 0 !== config.key && (key = \"\" + config.key);\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n config = maybeKey.ref;\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n ref: void 0 !== config ? config : null,\n props: maybeKey\n };\n}\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.jsx = jsxProd;\nexports.jsxs = jsxProd;\n","/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return type.displayName || \"Context\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(type, key, props, owner, debugStack, debugTask) {\n var refProp = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== refProp ? refProp : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n maybeKey,\n getOwner(),\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n isValidElement(node)\n ? node._store && (node._store.validated = 1)\n : \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_LAZY_TYPE &&\n (\"fulfilled\" === node._payload.status\n ? isValidElement(node._payload.value) &&\n node._payload.value._store &&\n (node._payload.value._store.validated = 1)\n : node._store && (node._store.validated = 1));\n }\n function isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\"),\n REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n react_stack_bottom_frame: function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","'use client'\n\nimport type { ReactNode } from 'react'\nimport { I18nProvider } from '@fluenti/react'\nimport type { AllMessages, DateFormatOptions, NumberFormatOptions, Locale } from '@fluenti/core'\n\nexport interface ClientI18nProviderProps {\n locale: string\n fallbackLocale: string\n messages: AllMessages\n fallbackChain?: Record<string, Locale[]>\n dateFormats?: DateFormatOptions\n numberFormats?: NumberFormatOptions\n children: ReactNode\n}\n\n/**\n * Client-side I18nProvider wrapper.\n * Used internally by FluentProvider to hydrate client components.\n */\nexport function ClientI18nProvider({\n locale,\n fallbackLocale,\n messages,\n fallbackChain,\n dateFormats,\n numberFormats,\n children,\n}: ClientI18nProviderProps) {\n return (\n <I18nProvider\n locale={locale}\n fallbackLocale={fallbackLocale}\n messages={messages}\n {...(fallbackChain ? { fallbackChain } : {})}\n {...(dateFormats ? { dateFormats } : {})}\n {...(numberFormats ? { numberFormats } : {})}\n >\n {children}\n </I18nProvider>\n )\n}\n"],"x_google_ignoreList":[0,1,2],"mappings":"8KAWA,IAAI,EAAqB,OAAO,IAAI,6BAA6B,CAC/D,EAAsB,OAAO,IAAI,iBAAiB,CACpD,SAAS,EAAQ,EAAM,EAAQ,EAAU,CACvC,IAAI,EAAM,KAGV,GAFW,IAAX,IAAK,KAAmB,EAAM,GAAK,GACxB,EAAO,MAAlB,IAAK,KAAqB,EAAM,GAAK,EAAO,KACxC,QAAS,EAEX,IAAK,IAAI,IADT,GAAW,EAAE,CACQ,EACT,IAAV,QAAuB,EAAS,GAAY,EAAO,SAChD,EAAW,EAElB,MADA,GAAS,EAAS,IACX,CACL,SAAU,EACJ,OACD,MACL,IAAgB,IAAX,IAAK,GAAwB,KAAT,EACzB,MAAO,EACR,CAEH,EAAQ,SAAW,EACnB,EAAQ,IAAM,EACd,EAAQ,KAAO,cCtBf,QAAA,IAAA,WAAA,eACG,UAAY,CACX,SAAS,EAAyB,EAAM,CACtC,GAAY,GAAR,KAAc,OAAO,KACzB,GAAmB,OAAO,GAAtB,WACF,OAAO,EAAK,WAAa,EACrB,KACA,EAAK,aAAe,EAAK,MAAQ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EACA,EAAyB,EAAE,CAC3B,EAAyB,EAAM,yBAAyB,KAC1D,EACA,EACD,EAAE,CACC,EAAwB,EAAW,EAAY,EAAa,CAAC,CAC7D,EAAwB,EAAE,CAC9B,EAAQ,SAAW,EACnB,EAAQ,IAAM,SAAU,EAAM,EAAQ,EAAU,CAC9C,IAAI,EACF,IAAM,EAAqB,6BAC7B,OAAO,EACL,EACA,EACA,EACA,CAAC,EACD,EACI,MAAM,wBAAwB,CAC9B,EACJ,EAAmB,EAAW,EAAY,EAAK,CAAC,CAAG,EACpD,EAEH,EAAQ,KAAO,SAAU,EAAM,EAAQ,EAAU,CAC/C,IAAI,EACF,IAAM,EAAqB,6BAC7B,OAAO,EACL,EACA,EACA,EACA,CAAC,EACD,EACI,MAAM,wBAAwB,CAC9B,EACJ,EAAmB,EAAW,EAAY,EAAK,CAAC,CAAG,EACpD,KAED,iBC7VN,QAAA,IAAA,WAA6B,aAC3B,EAAO,QAAA,GAAA,CAEP,EAAO,QAAA,GAAA,MCeT,SAAgB,EAAmB,CACjC,SACA,iBACA,WACA,gBACA,cACA,gBACA,YAC0B,CAC1B,OAAA,EAAA,EAAA,KACG,EAAA,aAAD,CACU,SACQ,iBACN,WACV,GAAK,EAAgB,CAAE,gBAAe,CAAG,EAAE,CAC3C,GAAK,EAAc,CAAE,cAAa,CAAG,EAAE,CACvC,GAAK,EAAgB,CAAE,gBAAe,CAAG,EAAE,CAE1C,WACY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACxE,YAAY,EAAE,uBAAuB,IAAI,mBAAmB,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { I18nProvider as e } from "@fluenti/react";
|
|
3
|
+
//#region \0rolldown/runtime.js
|
|
4
|
+
var t = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), n = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
5
|
+
if (typeof require < "u") return require.apply(this, arguments);
|
|
6
|
+
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
7
|
+
}), r = /* @__PURE__ */ t(((e) => {
|
|
8
|
+
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
9
|
+
function r(e, n, r) {
|
|
10
|
+
var i = null;
|
|
11
|
+
if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
|
|
12
|
+
else r = n;
|
|
13
|
+
return n = r.ref, {
|
|
14
|
+
$$typeof: t,
|
|
15
|
+
type: e,
|
|
16
|
+
key: i,
|
|
17
|
+
ref: n === void 0 ? null : n,
|
|
18
|
+
props: r
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
e.Fragment = n, e.jsx = r, e.jsxs = r;
|
|
22
|
+
})), i = /* @__PURE__ */ t(((e) => {
|
|
23
|
+
process.env.NODE_ENV !== "production" && (function() {
|
|
24
|
+
function t(e) {
|
|
25
|
+
if (e == null) return null;
|
|
26
|
+
if (typeof e == "function") return e.$$typeof === k ? null : e.displayName || e.name || null;
|
|
27
|
+
if (typeof e == "string") return e;
|
|
28
|
+
switch (e) {
|
|
29
|
+
case v: return "Fragment";
|
|
30
|
+
case b: return "Profiler";
|
|
31
|
+
case y: return "StrictMode";
|
|
32
|
+
case w: return "Suspense";
|
|
33
|
+
case T: return "SuspenseList";
|
|
34
|
+
case O: return "Activity";
|
|
35
|
+
}
|
|
36
|
+
if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
|
|
37
|
+
case _: return "Portal";
|
|
38
|
+
case S: return e.displayName || "Context";
|
|
39
|
+
case x: return (e._context.displayName || "Context") + ".Consumer";
|
|
40
|
+
case C:
|
|
41
|
+
var n = e.render;
|
|
42
|
+
return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
|
|
43
|
+
case E: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
|
|
44
|
+
case D:
|
|
45
|
+
n = e._payload, e = e._init;
|
|
46
|
+
try {
|
|
47
|
+
return t(e(n));
|
|
48
|
+
} catch {}
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
function r(e) {
|
|
53
|
+
return "" + e;
|
|
54
|
+
}
|
|
55
|
+
function i(e) {
|
|
56
|
+
try {
|
|
57
|
+
r(e);
|
|
58
|
+
var t = !1;
|
|
59
|
+
} catch {
|
|
60
|
+
t = !0;
|
|
61
|
+
}
|
|
62
|
+
if (t) {
|
|
63
|
+
t = console;
|
|
64
|
+
var n = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
65
|
+
return n.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), r(e);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function a(e) {
|
|
69
|
+
if (e === v) return "<>";
|
|
70
|
+
if (typeof e == "object" && e && e.$$typeof === D) return "<...>";
|
|
71
|
+
try {
|
|
72
|
+
var n = t(e);
|
|
73
|
+
return n ? "<" + n + ">" : "<...>";
|
|
74
|
+
} catch {
|
|
75
|
+
return "<...>";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function o() {
|
|
79
|
+
var e = A.A;
|
|
80
|
+
return e === null ? null : e.getOwner();
|
|
81
|
+
}
|
|
82
|
+
function s() {
|
|
83
|
+
return Error("react-stack-top-frame");
|
|
84
|
+
}
|
|
85
|
+
function c(e) {
|
|
86
|
+
if (j.call(e, "key")) {
|
|
87
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
88
|
+
if (t && t.isReactWarning) return !1;
|
|
89
|
+
}
|
|
90
|
+
return e.key !== void 0;
|
|
91
|
+
}
|
|
92
|
+
function l(e, t) {
|
|
93
|
+
function n() {
|
|
94
|
+
P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
|
|
95
|
+
}
|
|
96
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
97
|
+
get: n,
|
|
98
|
+
configurable: !0
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
function u() {
|
|
102
|
+
var e = t(this.type);
|
|
103
|
+
return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
|
|
104
|
+
}
|
|
105
|
+
function d(e, t, n, r, i, a) {
|
|
106
|
+
var o = n.ref;
|
|
107
|
+
return e = {
|
|
108
|
+
$$typeof: g,
|
|
109
|
+
type: e,
|
|
110
|
+
key: t,
|
|
111
|
+
props: n,
|
|
112
|
+
_owner: r
|
|
113
|
+
}, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
|
|
114
|
+
enumerable: !1,
|
|
115
|
+
value: null
|
|
116
|
+
}) : Object.defineProperty(e, "ref", {
|
|
117
|
+
enumerable: !1,
|
|
118
|
+
get: u
|
|
119
|
+
}), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
120
|
+
configurable: !1,
|
|
121
|
+
enumerable: !1,
|
|
122
|
+
writable: !0,
|
|
123
|
+
value: 0
|
|
124
|
+
}), Object.defineProperty(e, "_debugInfo", {
|
|
125
|
+
configurable: !1,
|
|
126
|
+
enumerable: !1,
|
|
127
|
+
writable: !0,
|
|
128
|
+
value: null
|
|
129
|
+
}), Object.defineProperty(e, "_debugStack", {
|
|
130
|
+
configurable: !1,
|
|
131
|
+
enumerable: !1,
|
|
132
|
+
writable: !0,
|
|
133
|
+
value: i
|
|
134
|
+
}), Object.defineProperty(e, "_debugTask", {
|
|
135
|
+
configurable: !1,
|
|
136
|
+
enumerable: !1,
|
|
137
|
+
writable: !0,
|
|
138
|
+
value: a
|
|
139
|
+
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
140
|
+
}
|
|
141
|
+
function f(e, n, r, a, s, u) {
|
|
142
|
+
var f = n.children;
|
|
143
|
+
if (f !== void 0) if (a) if (M(f)) {
|
|
144
|
+
for (a = 0; a < f.length; a++) p(f[a]);
|
|
145
|
+
Object.freeze && Object.freeze(f);
|
|
146
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
147
|
+
else p(f);
|
|
148
|
+
if (j.call(n, "key")) {
|
|
149
|
+
f = t(e);
|
|
150
|
+
var m = Object.keys(n).filter(function(e) {
|
|
151
|
+
return e !== "key";
|
|
152
|
+
});
|
|
153
|
+
a = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[f + a] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", a, f, m, f), R[f + a] = !0);
|
|
154
|
+
}
|
|
155
|
+
if (f = null, r !== void 0 && (i(r), f = "" + r), c(n) && (i(n.key), f = "" + n.key), "key" in n) for (var h in r = {}, n) h !== "key" && (r[h] = n[h]);
|
|
156
|
+
else r = n;
|
|
157
|
+
return f && l(r, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), d(e, f, r, o(), s, u);
|
|
158
|
+
}
|
|
159
|
+
function p(e) {
|
|
160
|
+
m(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === D && (e._payload.status === "fulfilled" ? m(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
161
|
+
}
|
|
162
|
+
function m(e) {
|
|
163
|
+
return typeof e == "object" && !!e && e.$$typeof === g;
|
|
164
|
+
}
|
|
165
|
+
var h = n("react"), g = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), v = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), b = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), S = Symbol.for("react.context"), C = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), T = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), D = Symbol.for("react.lazy"), O = Symbol.for("react.activity"), k = Symbol.for("react.client.reference"), A = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, M = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
166
|
+
return null;
|
|
167
|
+
};
|
|
168
|
+
h = { react_stack_bottom_frame: function(e) {
|
|
169
|
+
return e();
|
|
170
|
+
} };
|
|
171
|
+
var P, F = {}, I = h.react_stack_bottom_frame.bind(h, s)(), L = N(a(s)), R = {};
|
|
172
|
+
e.Fragment = v, e.jsx = function(e, t, n) {
|
|
173
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
174
|
+
return f(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(a(e)) : L);
|
|
175
|
+
}, e.jsxs = function(e, t, n) {
|
|
176
|
+
var r = 1e4 > A.recentlyCreatedOwnerStacks++;
|
|
177
|
+
return f(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(a(e)) : L);
|
|
178
|
+
};
|
|
179
|
+
})();
|
|
180
|
+
})), a = (/* @__PURE__ */ t(((e, t) => {
|
|
181
|
+
process.env.NODE_ENV === "production" ? t.exports = r() : t.exports = i();
|
|
182
|
+
})))();
|
|
183
|
+
function o({ locale: t, fallbackLocale: n, messages: r, fallbackChain: i, dateFormats: o, numberFormats: s, children: c }) {
|
|
184
|
+
return /* @__PURE__ */ (0, a.jsx)(e, {
|
|
185
|
+
locale: t,
|
|
186
|
+
fallbackLocale: n,
|
|
187
|
+
messages: r,
|
|
188
|
+
...i ? { fallbackChain: i } : {},
|
|
189
|
+
...o ? { dateFormats: o } : {},
|
|
190
|
+
...s ? { numberFormats: s } : {},
|
|
191
|
+
children: c
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
195
|
+
export { o as FluentProvider };
|
|
196
|
+
|
|
197
|
+
//# sourceMappingURL=provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","names":[],"sources":["../../../node_modules/.pnpm/react@19.2.4/node_modules/react/cjs/react-jsx-runtime.production.js","../../../node_modules/.pnpm/react@19.2.4/node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/.pnpm/react@19.2.4/node_modules/react/jsx-runtime.js","../src/client-provider.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\");\nfunction jsxProd(type, config, maybeKey) {\n var key = null;\n void 0 !== maybeKey && (key = \"\" + maybeKey);\n void 0 !== config.key && (key = \"\" + config.key);\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n config = maybeKey.ref;\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n ref: void 0 !== config ? config : null,\n props: maybeKey\n };\n}\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.jsx = jsxProd;\nexports.jsxs = jsxProd;\n","/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return type.displayName || \"Context\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(type, key, props, owner, debugStack, debugTask) {\n var refProp = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== refProp ? refProp : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n maybeKey,\n getOwner(),\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n isValidElement(node)\n ? node._store && (node._store.validated = 1)\n : \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_LAZY_TYPE &&\n (\"fulfilled\" === node._payload.status\n ? isValidElement(node._payload.value) &&\n node._payload.value._store &&\n (node._payload.value._store.validated = 1)\n : node._store && (node._store.validated = 1));\n }\n function isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\"),\n REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n react_stack_bottom_frame: function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","'use client'\n\nimport type { ReactNode } from 'react'\nimport { I18nProvider } from '@fluenti/react'\nimport type { AllMessages, DateFormatOptions, NumberFormatOptions, Locale } from '@fluenti/core'\n\nexport interface ClientI18nProviderProps {\n locale: string\n fallbackLocale: string\n messages: AllMessages\n fallbackChain?: Record<string, Locale[]>\n dateFormats?: DateFormatOptions\n numberFormats?: NumberFormatOptions\n children: ReactNode\n}\n\n/**\n * Client-side I18nProvider wrapper.\n * Used internally by FluentProvider to hydrate client components.\n */\nexport function ClientI18nProvider({\n locale,\n fallbackLocale,\n messages,\n fallbackChain,\n dateFormats,\n numberFormats,\n children,\n}: ClientI18nProviderProps) {\n return (\n <I18nProvider\n locale={locale}\n fallbackLocale={fallbackLocale}\n messages={messages}\n {...(fallbackChain ? { fallbackChain } : {})}\n {...(dateFormats ? { dateFormats } : {})}\n {...(numberFormats ? { numberFormats } : {})}\n >\n {children}\n </I18nProvider>\n )\n}\n"],"x_google_ignoreList":[0,1,2],"mappings":";;;;;;CAWA,IAAI,IAAqB,OAAO,IAAI,6BAA6B,EAC/D,IAAsB,OAAO,IAAI,iBAAiB;CACpD,SAAS,EAAQ,GAAM,GAAQ,GAAU;EACvC,IAAI,IAAM;AAGV,MAFW,MAAX,KAAK,MAAmB,IAAM,KAAK,IACxB,EAAO,QAAlB,KAAK,MAAqB,IAAM,KAAK,EAAO,MACxC,SAAS,EAEX,MAAK,IAAI,KADT,IAAW,EAAE,EACQ,EACnB,CAAU,MAAV,UAAuB,EAAS,KAAY,EAAO;MAChD,KAAW;AAElB,SADA,IAAS,EAAS,KACX;GACL,UAAU;GACJ;GACD;GACL,KAAgB,MAAX,KAAK,IAAwB,OAAT;GACzB,OAAO;GACR;;AAIH,CAFA,EAAQ,WAAW,GACnB,EAAQ,MAAM,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'./types';
|
|
2
|
+
/**
|
|
3
|
+
* Read fluenti.config.ts and merge with withFluenti() overrides.
|
|
4
|
+
*/
|
|
5
|
+
export declare function resolveConfig(projectRoot: string, overrides?: WithFluentConfig): ResolvedFluentConfig;
|
|
6
|
+
//# sourceMappingURL=read-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-config.d.ts","sourceRoot":"","sources":["../src/read-config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAarE;;GAEG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,gBAAgB,GAC3B,oBAAoB,CA8BtB"}
|