@fluenti/next 0.4.0-rc.1 → 0.4.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/create-navigation.d.ts +34 -0
  2. package/dist/create-navigation.d.ts.map +1 -0
  3. package/dist/i18n-config.cjs +1 -1
  4. package/dist/i18n-config.cjs.map +1 -1
  5. package/dist/index.cjs +11 -11
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.ts +2 -0
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +121 -104
  10. package/dist/index.js.map +1 -1
  11. package/dist/loader.cjs +1 -1
  12. package/dist/loader.cjs.map +1 -1
  13. package/dist/middleware.cjs +1 -1
  14. package/dist/middleware.cjs.map +1 -1
  15. package/dist/middleware.d.ts +111 -75
  16. package/dist/middleware.d.ts.map +1 -1
  17. package/dist/middleware.js +116 -36
  18. package/dist/middleware.js.map +1 -1
  19. package/dist/navigation.cjs +1 -1
  20. package/dist/navigation.cjs.map +1 -1
  21. package/dist/navigation.d.ts +42 -2
  22. package/dist/navigation.d.ts.map +1 -1
  23. package/dist/navigation.js +103 -17
  24. package/dist/navigation.js.map +1 -1
  25. package/dist/provider.cjs +1 -1
  26. package/dist/provider.cjs.map +1 -1
  27. package/dist/read-config.d.ts.map +1 -1
  28. package/dist/routing-DBVu_7tk.js +72 -0
  29. package/dist/routing-DBVu_7tk.js.map +1 -0
  30. package/dist/routing-Dy57-Uao.cjs +2 -0
  31. package/dist/routing-Dy57-Uao.cjs.map +1 -0
  32. package/dist/routing.d.ts +52 -0
  33. package/dist/routing.d.ts.map +1 -0
  34. package/dist/server.cjs +1 -1
  35. package/dist/server.cjs.map +1 -1
  36. package/dist/server.d.ts +39 -2
  37. package/dist/server.d.ts.map +1 -1
  38. package/dist/server.js +21 -2
  39. package/dist/server.js.map +1 -1
  40. package/dist/types.d.ts +10 -0
  41. package/dist/types.d.ts.map +1 -1
  42. package/dist/with-fluenti.d.ts +4 -6
  43. package/dist/with-fluenti.d.ts.map +1 -1
  44. package/package.json +3 -3
@@ -0,0 +1,34 @@
1
+ import { ReactNode } from 'react';
2
+ import { RoutingConfig } from './routing';
3
+ export type { RoutingConfig };
4
+ interface NavigationLinkProps<P extends string = string, L extends string = string> {
5
+ href: P | (string & Record<never, never>);
6
+ locale?: L;
7
+ children?: ReactNode;
8
+ prefetch?: boolean | null;
9
+ replace?: boolean;
10
+ scroll?: boolean;
11
+ target?: string;
12
+ className?: string;
13
+ [key: string]: unknown;
14
+ }
15
+ interface TypedRouter<P extends string = string, L extends string = string> {
16
+ push(href: P | (string & Record<never, never>), options?: {
17
+ locale?: L;
18
+ }): void;
19
+ replace(href: P | (string & Record<never, never>), options?: {
20
+ locale?: L;
21
+ }): void;
22
+ back(): void;
23
+ forward(): void;
24
+ refresh(): void;
25
+ prefetch(href: string): void;
26
+ }
27
+ export declare function createNavigation<const L extends string, const P extends string>(routing: RoutingConfig<L, P>): {
28
+ Link: import('react').ForwardRefExoticComponent<Omit<NavigationLinkProps<P, L>, "ref"> & import('react').RefAttributes<HTMLAnchorElement>>;
29
+ useRouter: () => TypedRouter<P, L>;
30
+ redirect: (href: P | (string & Record<never, never>), locale?: L) => never;
31
+ usePathname: () => string;
32
+ getPathname: (href: P | (string & Record<never, never>), locale: L) => string;
33
+ };
34
+ //# sourceMappingURL=create-navigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-navigation.d.ts","sourceRoot":"","sources":["../src/create-navigation.tsx"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAE9C,YAAY,EAAE,aAAa,EAAE,CAAA;AAE7B,UAAU,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM;IAChF,IAAI,EAAE,CAAC,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GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,WAAW,CAAC,KAAG,KAAK;uBASvD,MAAM;wBASH,CAAC,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,UAAU,CAAC,KAAG,MAAM;EAKnF"}
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=[`en`],t=`en`,n=`locale`;exports.cookieName=n,exports.locales=e,exports.sourceLocale=t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./routing-Dy57-Uao.cjs`);var e=[`en`],t=`en`,n=`locale`;exports.cookieName=n,exports.locales=e,exports.sourceLocale=t;
2
2
  //# sourceMappingURL=i18n-config.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"i18n-config.cjs","names":[],"sources":["../src/i18n-config.ts"],"sourcesContent":["/**\n * @module @fluenti/next/i18n-config\n *\n * Provides i18n config values (locales, sourceLocale, cookieName) for use in middleware.\n *\n * At build time, `withFluenti()` generates `.fluenti/i18n-config.js` with the actual\n * values from `fluenti.config.ts` and sets up a resolve alias so this module is\n * replaced by the generated version.\n *\n * If `withFluenti()` is not configured (e.g. unit tests), these fallback defaults are used.\n *\n * @example\n * ```ts\n * // middleware.ts\n * import { NextResponse } from 'next/server'\n * import { createI18nMiddleware } from '@fluenti/next/middleware'\n * import { locales, sourceLocale } from '@fluenti/next/i18n-config'\n *\n * export default createI18nMiddleware({\n * NextResponse,\n * locales,\n * sourceLocale,\n * rewriteDefaultLocale: true,\n * })\n * ```\n */\n\n/** Available locales — overridden at build time from fluenti.config.ts */\nexport const locales: string[] = ['en']\n\n/** Source/default locale — overridden at build time from fluenti.config.ts */\nexport const sourceLocale: string = 'en'\n\n/** Cookie name for locale detection — overridden at build time from fluenti.config.ts */\nexport const cookieName: string = 'locale'\n"],"mappings":"mEA4BA,IAAa,EAAoB,CAAC,KAAK,CAG1B,EAAuB,KAGvB,EAAqB"}
1
+ {"version":3,"file":"i18n-config.cjs","names":[],"sources":["../src/i18n-config.ts"],"sourcesContent":["/**\n * @module @fluenti/next/i18n-config\n *\n * Provides i18n config values (locales, sourceLocale, cookieName) for use in middleware.\n *\n * At build time, `withFluenti()` generates `.fluenti/i18n-config.js` with the actual\n * values from `fluenti.config.ts` and sets up a resolve alias so this module is\n * replaced by the generated version.\n *\n * If `withFluenti()` is not configured (e.g. unit tests), these fallback defaults are used.\n *\n * @example\n * ```ts\n * // middleware.ts\n * import { NextResponse } from 'next/server'\n * import { createI18nMiddleware } from '@fluenti/next/middleware'\n * import { locales, sourceLocale } from '@fluenti/next/i18n-config'\n *\n * export default createI18nMiddleware({\n * NextResponse,\n * locales,\n * sourceLocale,\n * rewriteDefaultLocale: true,\n * })\n * ```\n */\n\n/** Available locales — overridden at build time from fluenti.config.ts */\nexport const locales: string[] = ['en']\n\n/** Source/default locale — overridden at build time from fluenti.config.ts */\nexport const sourceLocale: string = 'en'\n\n/** Cookie name for locale detection — overridden at build time from fluenti.config.ts */\nexport const cookieName: string = 'locale'\n"],"mappings":"qGA4BA,IAAa,EAAoB,CAAC,KAAK,CAG1B,EAAuB,KAGvB,EAAqB"}
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`node:fs`),t=require(`node:child_process`),n=require(`node:path`),r=require(`node:url`),i=require(`@fluenti/core/config`),a=require(`@fluenti/core`),o=require(`@fluenti/core/internal`),s=require(`node:module`),c=require(`@fluenti/react`);function l(e,t){let n;n=t?.config&&typeof t.config==`object`?{...i.DEFAULT_FLUENTI_CONFIG,...t.config}:(0,i.loadConfigSync)(typeof t?.config==`string`?t.config:void 0,e);let r=t?.serverModuleOutDir??`.fluenti`,a=t?.cookieName??`locale`,o={fluentiConfig:n,serverModule:t?.serverModule??null,serverModuleOutDir:r,cookieName:a};return t?.resolveLocale&&(o.resolveLocale=t.resolveLocale),o}function u(t,n){try{(0,e.writeFileSync)(t,n,`utf-8`)}catch(e){throw Error(`[fluenti] Failed to write generated module at ${t}: ${e instanceof Error?e.message:String(e)}`)}}function d(t,r){if(r.serverModule)return(0,n.resolve)(t,r.serverModule);let i=(0,n.resolve)(t,r.serverModuleOutDir),s=(0,n.resolve)(i,`server.js`),c=(0,n.resolve)(i,`server.d.ts`);(0,e.existsSync)(i)||(0,e.mkdirSync)(i,{recursive:!0});let l=(0,o.resolveLocaleCodes)(r.fluentiConfig.locales),d=r.fluentiConfig.defaultLocale??r.fluentiConfig.sourceLocale,m=r.fluentiConfig.compileOutDir,h=r.fluentiConfig.fallbackChain,g=r.fluentiConfig.dateFormats,_=r.fluentiConfig.numberFormats,v=f(r.cookieName),y=f(d);for(let e of l)(0,a.validateLocale)(e,`next-plugin`);let b=p((0,n.relative)(i,(0,n.resolve)(t,m))),x=l.map(e=>` case '${f(e)}': return import('${b}/${e}')`).join(`
2
- `),S=h?JSON.stringify(h):`undefined`;u((0,n.resolve)(i,`client-provider.js`),`"use client";
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./routing-Dy57-Uao.cjs`);let t=require(`node:fs`),n=require(`node:child_process`),r=require(`node:path`),i=require(`node:url`),a=require(`@fluenti/core/config`),o=require(`@fluenti/core`),s=require(`@fluenti/core/internal`),c=require(`node:module`),l=require(`@fluenti/react`);function u(e,t){let n;n=t?.config&&typeof t.config==`object`?{...a.DEFAULT_FLUENTI_CONFIG,...t.config}:!t?.config&&t?.locales?{...a.DEFAULT_FLUENTI_CONFIG,locales:t.locales}:(0,a.loadConfigSync)(typeof t?.config==`string`?t.config:void 0,e);let r=t?.serverModuleOutDir??`.fluenti`,i=t?.cookieName??`locale`,o={fluentiConfig:n,serverModule:t?.serverModule??null,serverModuleOutDir:r,cookieName:i};return t?.resolveLocale&&(o.resolveLocale=t.resolveLocale),o}function d(e,n){try{(0,t.writeFileSync)(e,n,`utf-8`)}catch(t){throw Error(`[fluenti] Failed to write generated module at ${e}: ${t instanceof Error?t.message:String(t)}`)}}function f(e,n){if(n.serverModule)return(0,r.resolve)(e,n.serverModule);let i=(0,r.resolve)(e,n.serverModuleOutDir),a=(0,r.resolve)(i,`server.js`),c=(0,r.resolve)(i,`server.d.ts`);(0,t.existsSync)(i)||(0,t.mkdirSync)(i,{recursive:!0});let l=(0,s.resolveLocaleCodes)(n.fluentiConfig.locales),u=n.fluentiConfig.defaultLocale??n.fluentiConfig.sourceLocale,f=n.fluentiConfig.compileOutDir,h=n.fluentiConfig.fallbackChain,g=n.fluentiConfig.dateFormats,_=n.fluentiConfig.numberFormats,v=p(n.cookieName),y=p(u);for(let e of l)(0,o.validateLocale)(e,`next-plugin`);let b=m((0,r.relative)(i,(0,r.resolve)(e,f))),x=l.map(e=>` case '${p(e)}': return import('${b}/${e}')`).join(`
2
+ `),S=h?JSON.stringify(h):`undefined`;d((0,r.resolve)(i,`client-provider.js`),`"use client";
3
3
  // Auto-generated by @fluenti/next — do not edit
4
4
  // @ts-nocheck
5
5
  import { createElement } from 'react'
@@ -8,14 +8,14 @@ import { interpolate as __interpolate } from '@fluenti/core/internal'
8
8
  ${l.map(e=>`import ${e.replace(/[^a-zA-Z0-9]/g,`_`)} from '${b}/${e}'`).join(`
9
9
  `)}
10
10
 
11
- const __allMessages = { ${l.map(e=>{let t=e.replace(/[^a-zA-Z0-9]/g,`_`);return`'${f(e)}': ${t}`}).join(`, `)} }
11
+ const __allMessages = { ${l.map(e=>{let t=e.replace(/[^a-zA-Z0-9]/g,`_`);return`'${p(e)}': ${t}`}).join(`, `)} }
12
12
  const __dateFormats = ${g===void 0?`undefined`:JSON.stringify(g)}
13
13
  const __numberFormats = ${_===void 0?`undefined`:JSON.stringify(_)}
14
14
 
15
15
  export function ClientI18nProvider({ locale, fallbackLocale, fallbackChain, children }) {
16
16
  return createElement(I18nProvider, { locale, fallbackLocale, messages: __allMessages, fallbackChain, dateFormats: __dateFormats, numberFormats: __numberFormats, interpolate: __interpolate }, children)
17
17
  }
18
- `),u((0,n.resolve)(i,`client-provider.d.ts`),`// Auto-generated by @fluenti/next — do not edit
18
+ `),d((0,r.resolve)(i,`client-provider.d.ts`),`// Auto-generated by @fluenti/next — do not edit
19
19
  import type { ReactNode, ReactElement } from 'react'
20
20
 
21
21
  export declare function ClientI18nProvider(props: {
@@ -24,7 +24,7 @@ export declare function ClientI18nProvider(props: {
24
24
  fallbackChain?: Record<string, string[]>
25
25
  children: ReactNode
26
26
  }): ReactElement
27
- `);let C=r.resolveLocale?`import __resolveLocale from '${p((0,n.relative)(i,(0,n.resolve)(t,r.resolveLocale)))}'`:null,w=r.resolveLocale?`resolveLocale: __resolveLocale,`:`resolveLocale: async () => {
27
+ `);let C=n.resolveLocale?`import __resolveLocale from '${m((0,r.relative)(i,(0,r.resolve)(e,n.resolveLocale)))}'`:null,w=n.resolveLocale?`resolveLocale: __resolveLocale,`:`resolveLocale: async () => {
28
28
  try {
29
29
  const { cookies, headers } = await import('next/headers')
30
30
  const [cookieStore, headerStore] = await Promise.all([cookies(), headers()])
@@ -53,7 +53,7 @@ export declare function ClientI18nProvider(props: {
53
53
  } catch {
54
54
  return '${y}'
55
55
  }
56
- },`,T=JSON.stringify(l);u(s,`// Auto-generated by @fluenti/next — do not edit
56
+ },`,T=JSON.stringify(l);d(a,`// Auto-generated by @fluenti/next — do not edit
57
57
  // @ts-nocheck
58
58
  import { createServerI18n } from '@fluenti/react/server'
59
59
  import { createElement } from 'react'
@@ -113,7 +113,7 @@ export async function I18nProvider({ locale, children }) {
113
113
  fallbackChain: ${S},
114
114
  }, children)
115
115
  }
116
- `),u(c,`// Auto-generated by @fluenti/next — do not edit
116
+ `),d(c,`// Auto-generated by @fluenti/next — do not edit
117
117
  import type { ReactNode, ReactElement } from 'react'
118
118
  import type { CompileTimeT, FluentiCoreInstanceFull } from '@fluenti/core'
119
119
 
@@ -167,16 +167,16 @@ export declare function I18nProvider(props: {
167
167
  locale?: string
168
168
  children: ReactNode
169
169
  }): Promise<ReactElement>
170
- `);let E=(0,n.resolve)(i,`i18n-config.js`),D=(0,n.resolve)(i,`i18n-config.d.ts`);return u(E,`// Auto-generated by @fluenti/next — do not edit
170
+ `);let E=(0,r.resolve)(i,`i18n-config.js`),D=(0,r.resolve)(i,`i18n-config.d.ts`);return d(E,`// Auto-generated by @fluenti/next — do not edit
171
171
  export const locales = ${T}
172
172
  export const sourceLocale = '${y}'
173
173
  export const cookieName = '${v}'
174
- `),u(D,`// Auto-generated by @fluenti/next — do not edit
174
+ `),d(D,`// Auto-generated by @fluenti/next — do not edit
175
175
  export declare const locales: string[]
176
176
  export declare const sourceLocale: string
177
177
  export declare const cookieName: string
178
- `),s}function f(e){return e.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/\0/g,`\\0`)}function p(e){return e.split(`\\`).join(`/`)}async function m(e){if(e.compileOnly)try{let{runCompile:t}=(0,s.createRequire)((0,n.join)(e.cwd,`package.json`))(`@fluenti/cli`);await t(e.cwd),console.log(`[fluenti] Compiling... done`),e.onSuccess?.();return}catch(t){let n=t instanceof Error?t:Error(String(t));if(e.throwOnError)throw n;console.warn(`[fluenti] Compile failed:`,n.message),e.onError?.(n);return}let t=null;try{t=(0,s.createRequire)((0,n.join)(e.cwd,`package.json`))(`@fluenti/cli`)}catch{}if(t)try{await t.runExtract(e.cwd),e.parallelCompile?await t.runCompile(e.cwd,{parallel:!0}):await t.runCompile(e.cwd),console.log(`[fluenti] Extracting and compiling... done`),e.onSuccess?.();return}catch(t){let n=t instanceof Error?t:Error(String(t));if(e.throwOnError)throw n;console.warn(`[fluenti] Extract/compile failed:`,n.message),e.onError?.(n);return}let r=`[fluenti] @fluenti/cli is required for auto-compile.
178
+ `),a}function p(e){return e.replace(/\\/g,`\\\\`).replace(/'/g,`\\'`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/\0/g,`\\0`)}function m(e){return e.split(`\\`).join(`/`)}async function h(e){if(e.compileOnly)try{let{runCompile:t}=(0,c.createRequire)((0,r.join)(e.cwd,`package.json`))(`@fluenti/cli`);await t(e.cwd),console.log(`[fluenti] Compiling... done`),e.onSuccess?.();return}catch(t){let n=t instanceof Error?t:Error(String(t));if(e.throwOnError)throw n;console.warn(`[fluenti] Compile failed:`,n.message),e.onError?.(n);return}let t=null;try{t=(0,c.createRequire)((0,r.join)(e.cwd,`package.json`))(`@fluenti/cli`)}catch{}if(t)try{await t.runExtract(e.cwd),e.parallelCompile?await t.runCompile(e.cwd,{parallel:!0}):await t.runCompile(e.cwd),console.log(`[fluenti] Extracting and compiling... done`),e.onSuccess?.();return}catch(t){let n=t instanceof Error?t:Error(String(t));if(e.throwOnError)throw n;console.warn(`[fluenti] Extract/compile failed:`,n.message),e.onError?.(n);return}let n=`[fluenti] @fluenti/cli is required for auto-compile.
179
179
  Install it as a devDependency:
180
180
  pnpm add -D @fluenti/cli
181
- See: https://fluenti.dev/start/introduction/`;if(e.throwOnError)throw Error(r);console.warn(r),e.onError?.(Error(r))}function h(e,t=300){let n=null,r=!1,i=!1;async function a(){r=!0;try{await m(e)}finally{r=!1,i&&(i=!1,o())}}function o(){n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null,r?i=!0:a()},t)}return o}var g=null;function _(e,t){if(!t||t.length===0)return[(0,n.resolve)(e,`src`)];let r=new Set;for(let e of t){let t=e.replace(/^\.\//,``).split(`*`)[0].replace(/\/+$/,``);r.add(t||`.`)}return[...r].map(t=>(0,n.resolve)(e,t))}function v(t){g&&g();let{cwd:r,compiledDir:i,delay:a=1e3,include:o,exclude:c,parallelCompile:l}=t,u=(0,n.resolve)(r,i),d=(0,s.createRequire)(typeof __filename<`u`?__filename:{}.url)(`picomatch`),f=c?.length?d(c):()=>!1,p={cwd:r};l&&(p.parallelCompile=!0);let m=h(p,a);m();let v=_(r,o).map(t=>(0,e.watch)(t,{recursive:!0},(e,r)=>{r&&/\.[jt]sx?$/.test(r)&&(r.includes(`node_modules`)||r.includes(`.next`)||(0,n.resolve)(t,r).startsWith(u)||f(r)||m())})),y=()=>{for(let e of v)e.close();g=null};return g=y,y}function y(e){if(e&&!b(e))return x({},e);let t=e??{};return function(e){return x(t,e??{})}}function b(e){return[`config`,`serverModule`,`serverModuleOutDir`,`resolveLocale`,`cookieName`,`loaderEnforce`].some(t=>t in e)}function x(i,a){let o=process.cwd(),s=l(o,i),c=s.fluentiConfig,u=c.compileOutDir;(0,e.existsSync)((0,n.resolve)(o,u))||console.warn(`\n[fluenti] Compiled catalogs not found at ${u}.\nRun: npx fluenti extract && npx fluenti compile\n`);let f=d(o,s),p=(0,n.resolve)(typeof __dirname<`u`?__dirname:(0,n.dirname)((0,r.fileURLToPath)({}.url)),`loader.js`),m=a.webpack,h=!1,g=Object.fromEntries([`*.ts`,`*.tsx`,`*.js`,`*.jsx`].map(e=>[e,{condition:{not:`foreign`},loaders:[`@fluenti/next/loader`]}])),_=(0,n.resolve)((0,n.dirname)(f),`i18n-config.js`),y=`./`+(0,n.relative)(o,f).split(`\\`).join(`/`),b=`./`+(0,n.relative)(o,_).split(`\\`).join(`/`),x={"@fluenti/next":y,"@fluenti/next/i18n-config":b},C=process.env.NODE_ENV===`development`||process.argv.some(e=>e===`dev`),w=c.buildAutoCompile??!0;if(!C&&w&&!h){h=!0;try{(0,t.execSync)(`npx fluenti compile`+(c.parallelCompile?` --parallel`:``),{cwd:o,stdio:`inherit`})}catch{}}let T=c.devAutoCompile??!0;if(C&&T){let e={cwd:o,compiledDir:u,delay:c.devAutoCompileDelay??1e3};c.parallelCompile&&(e.parallelCompile=!0),c.include&&(e.include=c.include),c.exclude&&(e.exclude=c.exclude),v(e)}return{...a,turbopack:S(a.turbopack,{rules:g,resolveAlias:x}),webpack(e,t){let n=i.loaderEnforce===void 0&&!(`loaderEnforce`in i)?`pre`:i.loaderEnforce;return e.module.rules.push({test:/\.[jt]sx?$/,...n?{enforce:n}:{},exclude:[/node_modules/,/\.next/],use:[{loader:p,options:{serverModulePath:f}}]}),e.resolve=e.resolve??{},e.resolve.alias=e.resolve.alias??{},e.resolve.alias[`@fluenti/next$`]=f,e.resolve.alias[`@fluenti/next/i18n-config$`]=_,m?m(e,t):e}}}function S(e,t){let n=e??{},r=n.rules??{},i=Object.keys(t.rules).filter(e=>e in r);return i.length>0&&console.warn(`[fluenti] Your turbopack.rules override Fluenti's loader for: ${i.join(`, `)}.\n Fluenti's t\`\` transform will NOT run on these file types.\n If this is intentional, you can suppress this warning with { devAutoCompile: false }.`),{...n,rules:{...t.rules,...r},resolveAlias:{...t.resolveAlias,...n.resolveAlias}}}var C='[fluenti] `withFluenti()` must be configured in next.config.ts before importing from "@fluenti/next".';function w(){throw Error(C)}var T=w,E=w,D=w,O=w,k=w,A=w,j=w,M=w,N=w;exports.DateTime=j,exports.I18nProvider=N,exports.NumberFormat=M,exports.Plural=k,exports.Select=A,exports.Trans=O,exports.getI18n=E,Object.defineProperty(exports,`msg`,{enumerable:!0,get:function(){return c.msg}}),exports.setLocale=T,exports.t=D,exports.withFluenti=y;
181
+ See: https://fluenti.dev/start/introduction/`;if(e.throwOnError)throw Error(n);console.warn(n),e.onError?.(Error(n))}function g(e,t=300){let n=null,r=!1,i=!1;async function a(){r=!0;try{await h(e)}finally{r=!1,i&&(i=!1,o())}}function o(){n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null,r?i=!0:a()},t)}return o}var _=null;function v(e,t){if(!t||t.length===0)return[(0,r.resolve)(e,`src`)];let n=new Set;for(let e of t){let t=e.replace(/^\.\//,``).split(`*`)[0].replace(/\/+$/,``);n.add(t||`.`)}return[...n].map(t=>(0,r.resolve)(e,t))}function y(e){_&&_();let{cwd:n,compiledDir:i,delay:a=1e3,include:o,exclude:s,parallelCompile:l}=e,u=(0,r.resolve)(n,i),d=(0,c.createRequire)(typeof __filename<`u`?__filename:{}.url)(`picomatch`),f=s?.length?d(s):()=>!1,p={cwd:n};l&&(p.parallelCompile=!0);let m=g(p,a);m();let h=v(n,o).map(e=>(0,t.watch)(e,{recursive:!0},(t,n)=>{n&&/\.[jt]sx?$/.test(n)&&(n.includes(`node_modules`)||n.includes(`.next`)||(0,r.resolve)(e,n).startsWith(u)||f(n)||m())})),y=()=>{for(let e of h)e.close();_=null};return _=y,y}function b(e){if(e&&!x(e))return S({},e);let t=e??{};return function(e){return S(t,e??{})}}function x(e){return[`config`,`locales`,`serverModule`,`serverModuleOutDir`,`resolveLocale`,`cookieName`,`loaderEnforce`].some(t=>t in e)}function S(e,a){let o=process.cwd(),s=u(o,e),c=s.fluentiConfig,l=c.compileOutDir,d=(0,r.resolve)(o,l);(0,t.existsSync)(d)||(0,t.mkdirSync)(d,{recursive:!0});let p=(0,r.resolve)(o,`app`,`[locale]`),m=(0,r.resolve)(o,`src`,`app`,`[locale]`);((0,t.existsSync)(p)||(0,t.existsSync)(m))&&(`rewriteDefaultLocale`in e||(s._autoRewriteDefaultLocale=!0));let h=f(o,s),g=(0,r.resolve)(typeof __dirname<`u`?__dirname:(0,r.dirname)((0,i.fileURLToPath)({}.url)),`loader.js`),_=a.webpack,v=!1,b=Object.fromEntries([`*.ts`,`*.tsx`,`*.js`,`*.jsx`].map(e=>[e,{condition:{not:`foreign`},loaders:[`@fluenti/next/loader`]}])),x=(0,r.resolve)((0,r.dirname)(h),`i18n-config.js`),S=`./`+(0,r.relative)(o,h).split(`\\`).join(`/`),w=`./`+(0,r.relative)(o,x).split(`\\`).join(`/`),T={"@fluenti/next":S,"@fluenti/next/i18n-config":w},E=process.env.NODE_ENV===`development`||process.argv.some(e=>e===`dev`),D=c.buildAutoCompile??!0;if(!E&&D&&!v){v=!0;try{(0,n.execSync)(`npx fluenti compile`+(c.parallelCompile?` --parallel`:``),{cwd:o,stdio:`inherit`})}catch{}}let O=c.devAutoCompile??!0;if(E&&O){let e={cwd:o,compiledDir:l,delay:c.devAutoCompileDelay??1e3};c.parallelCompile&&(e.parallelCompile=!0),c.include&&(e.include=c.include),c.exclude&&(e.exclude=c.exclude),y(e)}let k=15;try{let e=require(`next/package.json`);e.version&&(k=parseInt(e.version.split(`.`)[0],10)||15)}catch{}let A=C(k>=15?a.turbopack:a.experimental?.turbo,{rules:b,resolveAlias:T}),j=k>=15?{turbopack:A}:{experimental:{...a.experimental??{},turbo:A}};return{...a,...j,webpack(t,n){let r=e.loaderEnforce===void 0&&!(`loaderEnforce`in e)?`pre`:e.loaderEnforce;return t.module.rules.push({test:/\.[jt]sx?$/,...r?{enforce:r}:{},exclude:[/node_modules/,/\.next/],use:[{loader:g,options:{serverModulePath:h}}]}),t.resolve=t.resolve??{},t.resolve.alias=t.resolve.alias??{},t.resolve.alias[`@fluenti/next$`]=h,t.resolve.alias[`@fluenti/next/i18n-config$`]=x,_?_(t,n):t}}}function C(e,t){let n=e??{},r=n.rules??{},i=Object.keys(t.rules).filter(e=>e in r);return i.length>0&&console.warn(`[fluenti] Your turbopack.rules override Fluenti's loader for: ${i.join(`, `)}.\n Fluenti's t\`\` transform will NOT run on these file types.\n If this is intentional, you can suppress this warning with { devAutoCompile: false }.`),{...n,rules:{...t.rules,...r},resolveAlias:{...t.resolveAlias,...n.resolveAlias}}}e.n();var w='[fluenti] `withFluenti()` must be configured in next.config.ts before importing from "@fluenti/next".';function T(){throw Error(w)}var E=T,D=T,O=T,k=T,A=T,j=T,M=T,N=T,P=T;exports.DateTime=M,exports.I18nProvider=P,exports.NumberFormat=N,exports.Plural=A,exports.Select=j,exports.Trans=k,exports.defineRouting=e.t,exports.getI18n=D,Object.defineProperty(exports,`msg`,{enumerable:!0,get:function(){return l.msg}}),exports.setLocale=E,exports.t=O,exports.withFluenti=b;
182
182
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/read-config.ts","../src/generate-server-module.ts","../src/dev-runner.ts","../src/dev-watcher.ts","../src/with-fluenti.ts","../src/index.ts"],"sourcesContent":["import { loadConfigSync, DEFAULT_FLUENTI_CONFIG } from '@fluenti/core/config'\nimport type { FluentiBuildConfig } from '@fluenti/core/internal'\nimport type { WithFluentConfig, ResolvedFluentConfig } from './types'\n\n/**\n * Read fluenti.config.ts and merge with withFluenti() overrides.\n *\n * Delegates config file loading to `@fluenti/core`'s shared `loadConfigSync()`.\n */\nexport function resolveConfig(\n projectRoot: string,\n overrides?: WithFluentConfig,\n): ResolvedFluentConfig {\n let fluentiConfig: FluentiBuildConfig\n\n if (overrides?.config && typeof overrides.config === 'object') {\n // Inline config — merge with defaults\n fluentiConfig = { ...DEFAULT_FLUENTI_CONFIG, ...overrides.config }\n } else {\n // string path or auto-discover\n fluentiConfig = loadConfigSync(\n typeof overrides?.config === 'string' ? overrides.config : undefined,\n projectRoot,\n )\n }\n\n const serverModuleOutDir = overrides?.serverModuleOutDir ?? '.fluenti'\n const cookieName = overrides?.cookieName ?? 'locale'\n\n const resolved: ResolvedFluentConfig = {\n fluentiConfig,\n serverModule: overrides?.serverModule ?? null,\n serverModuleOutDir,\n cookieName,\n }\n if (overrides?.resolveLocale) resolved.resolveLocale = overrides.resolveLocale\n return resolved\n}\n","import { writeFileSync, mkdirSync, existsSync } from 'node:fs'\nimport { resolve, relative } from 'node:path'\nimport { validateLocale } from '@fluenti/core'\nimport { resolveLocaleCodes } from '@fluenti/core/internal'\nimport type { ResolvedFluentConfig } from './types'\n\n/** Wrapper around writeFileSync with a Fluenti-specific error message. */\nfunction writeSafe(path: string, content: string): void {\n try {\n writeFileSync(path, content, 'utf-8')\n } catch (err) {\n throw new Error(\n `[fluenti] Failed to write generated module at ${path}: ${err instanceof Error ? err.message : String(err)}`,\n )\n }\n}\n\n/**\n * Generate the server module that provides:\n * - setLocale / getI18n\n * - Trans / Plural / Select / DateTime / NumberFormat (server components)\n * - I18nProvider (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 locales = resolveLocaleCodes(config.fluentiConfig.locales)\n const defaultLocale = config.fluentiConfig.defaultLocale ?? config.fluentiConfig.sourceLocale\n const compiledDir = config.fluentiConfig.compileOutDir\n const fallbackChain = config.fluentiConfig.fallbackChain\n const dateFormats = config.fluentiConfig.dateFormats\n const numberFormats = config.fluentiConfig.numberFormats\n const cookieName = escapeJsSingleQuoted(config.cookieName)\n const defaultLocaleSafe = escapeJsSingleQuoted(defaultLocale)\n\n for (const locale of locales) {\n validateLocale(locale, 'next-plugin')\n }\n\n const compiledDirAbs = resolve(projectRoot, compiledDir)\n const compiledRelative = toForwardSlash(relative(outDir, compiledDirAbs))\n\n const localeImports = locales\n .map((locale) => ` case '${escapeJsSingleQuoted(locale)}': return import('${compiledRelative}/${locale}')`)\n .join('\\n')\n\n const fallbackChainStr = fallbackChain\n ? JSON.stringify(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 = 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 = locales\n .map((locale) => {\n const safe = locale.replace(/[^a-zA-Z0-9]/g, '_')\n return `'${escapeJsSingleQuoted(locale)}': ${safe}`\n })\n .join(', ')\n\n const dateFormatsStr = dateFormats !== undefined ? JSON.stringify(dateFormats) : 'undefined'\n const numberFormatsStr = numberFormats !== undefined ? JSON.stringify(numberFormats) : 'undefined'\n\n const clientProviderSource = `\"use client\";\n// Auto-generated by @fluenti/next — do not edit\n// @ts-nocheck\nimport { createElement } from 'react'\nimport { I18nProvider } from '@fluenti/react'\nimport { interpolate as __interpolate } from '@fluenti/core/internal'\n${clientStaticImports}\n\nconst __allMessages = { ${clientAllMessagesEntries} }\nconst __dateFormats = ${dateFormatsStr}\nconst __numberFormats = ${numberFormatsStr}\n\nexport function ClientI18nProvider({ locale, fallbackLocale, fallbackChain, children }) {\n return createElement(I18nProvider, { locale, fallbackLocale, messages: __allMessages, fallbackChain, dateFormats: __dateFormats, numberFormats: __numberFormats, interpolate: __interpolate }, children)\n}\n`\n writeSafe(clientProviderPath, clientProviderSource)\n\n const clientProviderDtsPath = resolve(outDir, 'client-provider.d.ts')\n const clientProviderDtsSource = `// Auto-generated by @fluenti/next — do not edit\nimport type { ReactNode, ReactElement } from 'react'\n\nexport declare function ClientI18nProvider(props: {\n locale: string\n fallbackLocale: string\n fallbackChain?: Record<string, string[]>\n children: ReactNode\n}): ReactElement\n`\n writeSafe(clientProviderDtsPath, clientProviderDtsSource)\n\n const resolveLocaleImport = config.resolveLocale\n ? (() => {\n const absPath = resolve(projectRoot, config.resolveLocale)\n const relPath = toForwardSlash(relative(outDir, absPath))\n return `import __resolveLocale from '${relPath}'`\n })()\n : null\n\n const resolveLocaleFn = config.resolveLocale\n ? `resolveLocale: __resolveLocale,`\n : `resolveLocale: async () => {\n try {\n const { cookies, headers } = await import('next/headers')\n const [cookieStore, headerStore] = await Promise.all([cookies(), headers()])\n\n // 0. x-fluenti-locale header (set by createI18nMiddleware — most authoritative)\n const fromMiddleware = headerStore.get('x-fluenti-locale')\n if (fromMiddleware && __locales.includes(fromMiddleware)) return fromMiddleware\n\n // 1. Cookie (configurable name)\n const fromCookie = cookieStore.get('${cookieName}')?.value\n if (fromCookie && __locales.includes(fromCookie)) return fromCookie\n\n // 2. Accept-Language header\n const acceptLang = headerStore.get('accept-language')\n if (acceptLang) {\n for (const part of acceptLang.split(',')) {\n const lang = part.split(';')[0].trim()\n if (__locales.includes(lang)) return lang\n const prefix = lang.split('-')[0]\n const match = __locales.find(l => l === prefix || l.startsWith(prefix + '-'))\n if (match) return match\n }\n }\n\n return '${defaultLocaleSafe}'\n } catch {\n return '${defaultLocaleSafe}'\n }\n },`\n\n const localesArrayStr = JSON.stringify(locales)\n\n const moduleSource = `// Auto-generated by @fluenti/next — do not edit\n// @ts-nocheck\nimport { createServerI18n } from '@fluenti/react/server'\nimport { createElement } from 'react'\nimport { interpolate as __interpolate } from '@fluenti/core/internal'\n${resolveLocaleImport ? `${resolveLocaleImport}\\n` : ''}\nconst __locales = ${localesArrayStr}\n\nconst serverI18n = createServerI18n({\n interpolate: __interpolate,\n loadMessages: async (locale) => {\n switch (locale) {\n${localeImports}\n default: return import('${compiledRelative}/${defaultLocaleSafe}')\n }\n },\n fallbackLocale: '${defaultLocaleSafe}',\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' is a compile-time API replaced at build time.\\\\n\" +\n ' Ensure:\\\\n' +\n ' 1. \\`withFluenti()\\` is configured in next.config.ts\\\\n' +\n ' 2. The file is inside src/ (not node_modules)\\\\n' +\n \" 3. For client components, import from '@fluenti/react'\",\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 I18nProvider({ locale, children }) {\n const activeLocale = (locale && locale.trim()) ? locale : '${defaultLocaleSafe}'\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: '${defaultLocaleSafe}',\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, FluentiCoreInstanceFull } from '@fluenti/core'\n\nexport declare function setLocale(locale: string): void\nexport declare function getI18n(): Promise<FluentiCoreInstanceFull & { 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 format?: string\n}): Promise<ReactElement>\n\nexport declare function NumberFormat(props: {\n value: number\n format?: string\n}): Promise<ReactElement>\n\nexport declare function I18nProvider(props: {\n locale?: string\n children: ReactNode\n}): Promise<ReactElement>\n`\n\n writeSafe(outPath, moduleSource)\n writeSafe(dtsPath, dtsSource)\n\n // Generate Edge-safe i18n config for use in middleware\n const configModulePath = resolve(outDir, 'i18n-config.js')\n const configModuleDtsPath = resolve(outDir, 'i18n-config.d.ts')\n\n const configModuleSource = `// Auto-generated by @fluenti/next — do not edit\nexport const locales = ${localesArrayStr}\nexport const sourceLocale = '${defaultLocaleSafe}'\nexport const cookieName = '${cookieName}'\n`\n writeSafe(configModulePath, configModuleSource)\n\n const configModuleDtsSource = `// Auto-generated by @fluenti/next — do not edit\nexport declare const locales: string[]\nexport declare const sourceLocale: string\nexport declare const cookieName: string\n`\n writeSafe(configModuleDtsPath, configModuleDtsSource)\n\n return outPath\n}\n\n/** Escape a string for safe embedding inside a single-quoted JS string literal. */\nfunction escapeJsSingleQuoted(s: string): string {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/\\0/g, '\\\\0')\n}\n\nfunction toForwardSlash(p: string): string {\n return p.split('\\\\').join('/')\n}\n","import { join } from 'node:path'\nimport { createRequire } from 'node:module'\n\nexport interface DevRunnerOptions {\n cwd: string\n onSuccess?: () => void\n onError?: (err: Error) => void\n /** If true, reject the promise on failure instead of swallowing the error */\n throwOnError?: boolean\n /** Run only compile (skip extract). Useful for production builds where source is unchanged. */\n compileOnly?: boolean\n /** Enable parallel compilation across locales using worker threads */\n parallelCompile?: boolean\n}\n\n/**\n * Run compile in-process via `@fluenti/cli` (for compileOnly mode),\n * or extract + compile in dev mode. Requires `@fluenti/cli` to be installed\n * as a devDependency.\n */\nexport async function runExtractCompile(options: DevRunnerOptions): Promise<void> {\n if (options.compileOnly) {\n try {\n // Resolve @fluenti/cli from the project's cwd (not from this package's location)\n // using createRequire so pnpm's strict node_modules layout works correctly.\n // Use require() (not import()) to load @fluenti/cli — avoids CJS/ESM interop\n // issues when dynamic import() loads minified CJS with chunk requires.\n const projectRequire = createRequire(join(options.cwd, 'package.json'))\n const { runCompile } = projectRequire('@fluenti/cli')\n await runCompile(options.cwd)\n console.log('[fluenti] Compiling... done')\n options.onSuccess?.()\n return\n } catch (e) {\n const error = e instanceof Error ? e : new Error(String(e))\n if (options.throwOnError) throw error\n console.warn('[fluenti] Compile failed:', error.message)\n options.onError?.(error)\n return\n }\n }\n\n // Dev mode: run in-process extract + compile.\n // Step 1: load @fluenti/cli — if not installed, guide user to install it.\n // Step 2: run — errors here mean the CLI ran but failed; surface them.\n let fluentCli: { runExtract: (cwd: string) => Promise<void>; runCompile: (cwd: string, opts?: { parallel: boolean }) => Promise<void> } | null = null\n try {\n const projectRequire = createRequire(join(options.cwd, 'package.json'))\n fluentCli = projectRequire('@fluenti/cli')\n } catch {\n // @fluenti/cli not installed — will show install guide below\n }\n\n if (fluentCli) {\n try {\n await fluentCli.runExtract(options.cwd)\n if (options.parallelCompile) {\n await fluentCli.runCompile(options.cwd, { parallel: true })\n } else {\n await fluentCli.runCompile(options.cwd)\n }\n console.log('[fluenti] Extracting and compiling... done')\n options.onSuccess?.()\n return\n } catch (e) {\n const error = e instanceof Error ? e : new Error(String(e))\n if (options.throwOnError) throw error\n console.warn('[fluenti] Extract/compile failed:', error.message)\n options.onError?.(error)\n return\n }\n }\n\n const msg =\n '[fluenti] @fluenti/cli is required for auto-compile.\\n' +\n ' Install it as a devDependency:\\n' +\n ' pnpm add -D @fluenti/cli\\n' +\n ' See: https://fluenti.dev/start/introduction/'\n if (options.throwOnError) {\n throw new Error(msg)\n }\n console.warn(msg)\n options.onError?.(new Error(msg))\n}\n\n/**\n * Create a debounced runner that collapses rapid calls.\n *\n * - If called while idle, schedules a run after `delay` ms.\n * - If called while a run is in progress, marks a pending rerun.\n * - Never runs concurrently.\n */\nexport function createDebouncedRunner(\n options: DevRunnerOptions,\n delay = 300,\n): () => void {\n let timer: ReturnType<typeof setTimeout> | null = null\n let running = false\n let pendingRerun = false\n\n async function execute(): Promise<void> {\n running = true\n try {\n await runExtractCompile(options)\n } finally {\n running = false\n if (pendingRerun) {\n pendingRerun = false\n schedule()\n }\n }\n }\n\n function schedule(): void {\n if (timer !== null) {\n clearTimeout(timer)\n }\n timer = setTimeout(() => {\n timer = null\n if (running) {\n pendingRerun = true\n } else {\n execute()\n }\n }, delay)\n }\n\n return schedule\n}\n","import { watch } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { createRequire } from 'node:module'\nimport { createDebouncedRunner } from './dev-runner'\n\nexport interface DevWatcherOptions {\n cwd: string\n compiledDir: string\n delay?: number\n /** Glob patterns from fluenti.config.ts `include` field */\n include?: string[]\n /** Glob patterns from fluenti.config.ts `exclude` field */\n exclude?: string[]\n /** Enable parallel compilation across locales using worker threads */\n parallelCompile?: boolean\n}\n\nlet activeWatcher: (() => void) | null = null\n\n/**\n * Extract watch directories from include glob patterns.\n *\n * Takes the static prefix before the first glob wildcard (`*`).\n * Falls back to `src` if no include patterns are provided.\n *\n * @example\n * extractWatchDirs('/proj', ['./src/**\\/*.tsx']) → ['/proj/src']\n * extractWatchDirs('/proj', ['./app/**\\/*.ts', './lib/**\\/*.ts']) → ['/proj/app', '/proj/lib']\n * extractWatchDirs('/proj', ['./**\\/*.ts']) → ['/proj']\n */\nexport function extractWatchDirs(cwd: string, include?: string[]): string[] {\n if (!include || include.length === 0) {\n return [resolve(cwd, 'src')]\n }\n\n const dirs = new Set<string>()\n for (const pattern of include) {\n const normalized = pattern.replace(/^\\.\\//, '')\n const staticPart = normalized.split('*')[0]!.replace(/\\/+$/, '')\n dirs.add(staticPart || '.')\n }\n return [...dirs].map(d => resolve(cwd, d))\n}\n\n/**\n * Start a standalone file watcher for dev auto-compile.\n *\n * Works independently of webpack/Turbopack — watches source directories\n * (inferred from `include` patterns) for changes and triggers\n * extract+compile via the debounced runner.\n *\n * Only one watcher is active at a time (guards against multiple `applyFluenti()` calls).\n *\n * @returns A cleanup function that stops the watcher.\n */\nexport function startDevWatcher(options: DevWatcherOptions): () => void {\n // Clean up previous watcher if one exists (e.g., dev server reload)\n if (activeWatcher) {\n activeWatcher()\n }\n\n const { cwd, compiledDir, delay = 1000, include, exclude, parallelCompile } = options\n const compiledDirResolved = resolve(cwd, compiledDir)\n const _require = createRequire(\n typeof __filename !== 'undefined' ? __filename : import.meta.url,\n )\n const picomatch = _require('picomatch') as (patterns: string[]) => (str: string) => boolean\n const isExcluded = exclude?.length ? picomatch(exclude) : () => false\n const runnerOpts: Parameters<typeof createDebouncedRunner>[0] = { cwd }\n if (parallelCompile) runnerOpts.parallelCompile = true\n const debouncedRun = createDebouncedRunner(runnerOpts, delay)\n\n // Initial run\n debouncedRun()\n\n const watchDirs = extractWatchDirs(cwd, include)\n const watchers = watchDirs.map(dir =>\n watch(dir, { recursive: true }, (_event, filename) => {\n if (!filename) return\n if (!/\\.[jt]sx?$/.test(filename)) return\n if (filename.includes('node_modules') || filename.includes('.next')) return\n const full = resolve(dir, filename)\n if (full.startsWith(compiledDirResolved)) return\n if (isExcluded(filename)) return\n debouncedRun()\n }),\n )\n\n const cleanup = (): void => {\n for (const w of watchers) w.close()\n activeWatcher = null\n }\n\n activeWatcher = cleanup\n return cleanup\n}\n","import { existsSync } from 'node:fs'\nimport { execSync } from 'node:child_process'\nimport { resolve, dirname, relative } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { WithFluentConfig } from './types'\nimport { resolveConfig } from './read-config'\nimport { generateServerModule } from './generate-server-module'\nimport { startDevWatcher } from './dev-watcher'\n\n// Use Record<string, any> to accept both Next 15's and 16's NextConfig types\n// (Next 16 removed the index signature from NextConfig)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype NextConfig = Record<string, any>\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 && !isFluentConfig(configOrNext as Record<string, unknown>)) {\n // Has keys but none are fluent-specific → treat 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 isFluentConfig(obj: Record<string, unknown>): boolean {\n const fluentOnlyKeys = [\n 'config', 'serverModule', 'serverModuleOutDir', 'resolveLocale',\n 'cookieName', 'loaderEnforce',\n ]\n return fluentOnlyKeys.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 const fluentiConfig = resolved.fluentiConfig\n const compiledDir = fluentiConfig.compileOutDir\n\n // Warn if compiled catalogs directory doesn't exist yet\n const compiledDirAbs = resolve(projectRoot, compiledDir)\n if (!existsSync(compiledDirAbs)) {\n console.warn(\n `\\n[fluenti] Compiled catalogs not found at ${compiledDir}.\\n` +\n `Run: npx fluenti extract && npx fluenti compile\\n`,\n )\n }\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(fileURLToPath(import.meta.url))\n const loaderPath = resolve(thisDir, 'loader.js')\n\n const existingWebpack = nextConfig['webpack'] as\n | ((config: WebpackConfig, options: WebpackOptions) => WebpackConfig)\n | undefined\n\n let buildCompileRan = false\n\n // ── Turbopack config ──────────────────────────────────────────────\n // Turbopack loader-runner supports webpack loaders via turbopack.rules.\n // Use package name (not file path) — Turbopack resolves loaders as packages,\n // file paths trigger static analysis errors (TP1006) in the loader-runner.\n const fluentTurboRules = Object.fromEntries(\n ['*.ts', '*.tsx', '*.js', '*.jsx'].map((ext) => [\n ext,\n {\n condition: { not: 'foreign' },\n loaders: ['@fluenti/next/loader'],\n },\n ]),\n )\n\n // Turbopack resolveAlias requires relative paths (absolute paths get\n // misinterpreted as \"./abs/path\"). Use \"./\" + relative-from-cwd.\n const configModulePath = resolve(dirname(serverModulePath), 'i18n-config.js')\n const relativeServerModule = './' + relative(projectRoot, serverModulePath).split('\\\\').join('/')\n const relativeConfigModule = './' + relative(projectRoot, configModulePath).split('\\\\').join('/')\n const fluentTurboAlias: Record<string, string> = {\n '@fluenti/next': relativeServerModule,\n '@fluenti/next/i18n-config': relativeConfigModule,\n }\n\n // ── Build auto-compile (bundler-agnostic — runs at config time) ──\n const isDev = process.env['NODE_ENV'] === 'development'\n || process.argv.some(a => a === 'dev')\n const buildAutoCompile = fluentiConfig.buildAutoCompile ?? true\n\n if (!isDev && buildAutoCompile && !buildCompileRan) {\n buildCompileRan = true\n try {\n execSync(\n 'npx fluenti compile' + (fluentiConfig.parallelCompile ? ' --parallel' : ''),\n { cwd: projectRoot, stdio: 'inherit' },\n )\n } catch {\n // @fluenti/cli not installed or compile failed — user sees stdio output\n }\n }\n\n // ── Dev auto-compile via standalone watcher (works with both webpack & Turbopack) ──\n const devAutoCompile = fluentiConfig.devAutoCompile ?? true\n\n if (isDev && devAutoCompile) {\n const watcherOpts: Parameters<typeof startDevWatcher>[0] = {\n cwd: projectRoot,\n compiledDir,\n delay: fluentiConfig.devAutoCompileDelay ?? 1000,\n }\n if (fluentiConfig.parallelCompile) watcherOpts.parallelCompile = true\n if (fluentiConfig.include) watcherOpts.include = fluentiConfig.include\n if (fluentiConfig.exclude) watcherOpts.exclude = fluentiConfig.exclude\n startDevWatcher(watcherOpts)\n }\n\n return {\n ...nextConfig,\n turbopack: mergeTurbopackConfig(\n nextConfig['turbopack'] as Record<string, unknown> | undefined,\n { rules: fluentTurboRules, resolveAlias: fluentTurboAlias },\n ),\n webpack(config: WebpackConfig, options: WebpackOptions) {\n // Add fluenti loader\n const loaderEnforce = fluentConfig.loaderEnforce === undefined && !('loaderEnforce' in (fluentConfig as Record<string, unknown>))\n ? 'pre' as const\n : fluentConfig.loaderEnforce\n config.module.rules.push({\n test: /\\.[jt]sx?$/,\n ...(loaderEnforce ? { enforce: loaderEnforce } : {}),\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$'] = serverModulePath\n config.resolve.alias['@fluenti/next/i18n-config$'] = configModulePath\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\nfunction mergeTurbopackConfig(\n existing: Record<string, unknown> | undefined,\n fluenti: { rules: Record<string, unknown>; resolveAlias: Record<string, string> },\n): Record<string, unknown> {\n const base = existing ?? {}\n const userRules = (base['rules'] as Record<string, unknown>) ?? {}\n\n // Warn when user rules override fluenti's source-file rules\n const fluentKeys = Object.keys(fluenti.rules)\n const overlapping = fluentKeys.filter(k => k in userRules)\n if (overlapping.length > 0) {\n console.warn(\n `[fluenti] Your turbopack.rules override Fluenti's loader for: ${overlapping.join(', ')}.\\n` +\n ` Fluenti's t\\`\\` transform will NOT run on these file types.\\n` +\n ` If this is intentional, you can suppress this warning with { devAutoCompile: false }.`,\n )\n }\n\n return {\n ...base,\n rules: { ...fluenti.rules, ...userRules },\n resolveAlias: { ...fluenti.resolveAlias, ...(base['resolveAlias'] as Record<string, string>) },\n }\n}\n\n// Minimal webpack types for the config function\ninterface WebpackConfig {\n module: {\n rules: Array<Record<string, unknown>>\n }\n resolve: {\n alias?: Record<string, string>\n }\n}\n\ninterface WebpackOptions {\n isServer: boolean\n dev: boolean\n}\n","/**\n * @fluenti/next — Next.js plugin for Fluenti\n *\n * Provides:\n * - `withFluenti()` — wraps next.config.ts with t`` transform support\n * - I18nProvider — async server component (exported from generated module)\n * - Webpack loader for strict, binding-aware tagged-template optimization\n *\n * @example\n * ```ts\n * // next.config.ts\n * import { withFluenti } from '@fluenti/next'\n * export default withFluenti()({ reactStrictMode: true })\n * ```\n *\n * @example\n * ```tsx\n * // app/layout.tsx — resolved by webpack alias to the generated module\n * import { I18nProvider } from '@fluenti/next'\n * ```\n */\nexport { withFluenti } from './with-fluenti'\nexport type { WithFluentConfig, I18nProviderProps } from './types'\nexport { msg } from '@fluenti/react'\n\n// ── Runtime stubs ────────────────────────────────────────────────────\n// TypeScript resolves types from this file (via package.json exports).\n// At runtime, webpack `resolve.alias` redirects `@fluenti/next$` to the\n// generated server module, so these stubs are never actually called in\n// a correctly configured project. They exist only to provide helpful\n// errors if `withFluenti()` is not configured.\n\nimport type { ReactNode, ReactElement } from 'react'\nimport type { CompileTimeT, FluentiCoreInstanceFull } from '@fluenti/core'\n\nconst NOT_CONFIGURED =\n '[fluenti] `withFluenti()` must be configured in next.config.ts before importing from \"@fluenti/next\".'\n\nfunction throwNotConfigured(): never {\n throw new Error(NOT_CONFIGURED)\n}\n\n/** @see Generated module for the real implementation. */\nexport const setLocale: (locale: string) => void = throwNotConfigured\n/** @see Generated module for the real implementation. */\nexport const getI18n: () => Promise<FluentiCoreInstanceFull & { locale: string }> = throwNotConfigured as () => Promise<FluentiCoreInstanceFull & { locale: string }>\n/** @see Generated module for the real implementation. */\nexport const t: CompileTimeT = throwNotConfigured as unknown as CompileTimeT\n/** @see Generated module for the real implementation. */\nexport const Trans: (props: { children: ReactNode; id?: string; context?: string; comment?: string; render?: (translation: ReactNode) => ReactNode }) => Promise<ReactElement> = throwNotConfigured as unknown as typeof Trans\n/** @see Generated module for the real implementation. */\nexport const Plural: (props: { value: number; id?: string; context?: string; comment?: string; zero?: ReactNode; one?: ReactNode; two?: ReactNode; few?: ReactNode; many?: ReactNode; other: ReactNode; offset?: number }) => Promise<ReactElement> = throwNotConfigured as unknown as typeof Plural\n/** @see Generated module for the real implementation. */\nexport const Select: (props: { value: string; id?: string; context?: string; comment?: string; other: ReactNode; options?: Record<string, ReactNode>; [key: string]: ReactNode | Record<string, ReactNode> | string | undefined }) => Promise<ReactElement> = throwNotConfigured as unknown as typeof Select\n/** @see Generated module for the real implementation. */\nexport const DateTime: (props: { value: Date | number; style?: string }) => Promise<ReactElement> = throwNotConfigured as unknown as typeof DateTime\n/** @see Generated module for the real implementation. */\nexport const NumberFormat: (props: { value: number; style?: string }) => Promise<ReactElement> = throwNotConfigured as unknown as typeof NumberFormat\n/** @see Generated module for the real implementation. */\nexport const I18nProvider: (props: { locale?: string; children: ReactNode }) => Promise<ReactElement> = throwNotConfigured as unknown as typeof I18nProvider\n"],"mappings":"+TASA,SAAgB,EACd,EACA,EACsB,CACtB,IAAI,EAEJ,AAKE,EALE,GAAW,QAAU,OAAO,EAAU,QAAW,SAEnC,CAAE,GAAG,EAAA,uBAAwB,GAAG,EAAU,OAAQ,EAGlE,EAAA,EAAA,gBACE,OAAO,GAAW,QAAW,SAAW,EAAU,OAAS,IAAA,GAC3D,EACD,CAGH,IAAM,EAAqB,GAAW,oBAAsB,WACtD,EAAa,GAAW,YAAc,SAEtC,EAAiC,CACrC,gBACA,aAAc,GAAW,cAAgB,KACzC,qBACA,aACD,CAED,OADI,GAAW,gBAAe,EAAS,cAAgB,EAAU,eAC1D,EC7BT,SAAS,EAAU,EAAc,EAAuB,CACtD,GAAI,EACF,EAAA,EAAA,eAAc,EAAM,EAAS,QAAQ,OAC9B,EAAK,CACZ,MAAU,MACR,iDAAiD,EAAK,IAAI,aAAe,MAAQ,EAAI,QAAU,OAAO,EAAI,GAC3G,EAYL,SAAgB,EACd,EACA,EACQ,CACR,GAAI,EAAO,aACT,OAAA,EAAA,EAAA,SAAe,EAAa,EAAO,aAAa,CAGlD,IAAM,GAAA,EAAA,EAAA,SAAiB,EAAa,EAAO,mBAAmB,CACxD,GAAA,EAAA,EAAA,SAAkB,EAAQ,YAAY,CACtC,GAAA,EAAA,EAAA,SAAkB,EAAQ,cAAc,EAE1C,EAAA,EAAA,YAAY,EAAO,GACrB,EAAA,EAAA,WAAU,EAAQ,CAAE,UAAW,GAAM,CAAC,CAGxC,IAAM,GAAA,EAAA,EAAA,oBAA6B,EAAO,cAAc,QAAQ,CAC1D,EAAgB,EAAO,cAAc,eAAiB,EAAO,cAAc,aAC3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EAAK,aAA4C,CAC/F,CC/KH,IAAM,EACJ,wGAEF,SAAS,GAA4B,CACnC,MAAU,MAAM,EAAe,CAIjC,IAAa,EAAsC,EAEtC,EAAuE,EAEvE,EAAkB,EAElB,EAAoK,EAEpK,EAAyO,EAEzO,EAAiP,EAEjP,EAAuF,EAEvF,EAAoF,EAEpF,EAA2F"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/read-config.ts","../src/generate-server-module.ts","../src/dev-runner.ts","../src/dev-watcher.ts","../src/with-fluenti.ts","../src/index.ts"],"sourcesContent":["import { loadConfigSync, DEFAULT_FLUENTI_CONFIG } from '@fluenti/core/config'\nimport type { FluentiBuildConfig } from '@fluenti/core/internal'\nimport type { WithFluentConfig, ResolvedFluentConfig } from './types'\n\n/**\n * Read fluenti.config.ts and merge with withFluenti() overrides.\n *\n * Delegates config file loading to `@fluenti/core`'s shared `loadConfigSync()`.\n */\nexport function resolveConfig(\n projectRoot: string,\n overrides?: WithFluentConfig,\n): ResolvedFluentConfig {\n let fluentiConfig: FluentiBuildConfig\n\n if (overrides?.config && typeof overrides.config === 'object') {\n // Inline config — merge with defaults\n fluentiConfig = { ...DEFAULT_FLUENTI_CONFIG, ...overrides.config }\n } else if (!overrides?.config && overrides?.locales) {\n // Locales shorthand — build inline config with just locales\n fluentiConfig = { ...DEFAULT_FLUENTI_CONFIG, locales: overrides.locales }\n } else {\n // string path or auto-discover\n fluentiConfig = loadConfigSync(\n typeof overrides?.config === 'string' ? overrides.config : undefined,\n projectRoot,\n )\n }\n\n const serverModuleOutDir = overrides?.serverModuleOutDir ?? '.fluenti'\n const cookieName = overrides?.cookieName ?? 'locale'\n\n const resolved: ResolvedFluentConfig = {\n fluentiConfig,\n serverModule: overrides?.serverModule ?? null,\n serverModuleOutDir,\n cookieName,\n }\n if (overrides?.resolveLocale) resolved.resolveLocale = overrides.resolveLocale\n return resolved\n}\n","import { writeFileSync, mkdirSync, existsSync } from 'node:fs'\nimport { resolve, relative } from 'node:path'\nimport { validateLocale } from '@fluenti/core'\nimport { resolveLocaleCodes } from '@fluenti/core/internal'\nimport type { ResolvedFluentConfig } from './types'\n\n/** Wrapper around writeFileSync with a Fluenti-specific error message. */\nfunction writeSafe(path: string, content: string): void {\n try {\n writeFileSync(path, content, 'utf-8')\n } catch (err) {\n throw new Error(\n `[fluenti] Failed to write generated module at ${path}: ${err instanceof Error ? err.message : String(err)}`,\n )\n }\n}\n\n/**\n * Generate the server module that provides:\n * - setLocale / getI18n\n * - Trans / Plural / Select / DateTime / NumberFormat (server components)\n * - I18nProvider (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 locales = resolveLocaleCodes(config.fluentiConfig.locales)\n const defaultLocale = config.fluentiConfig.defaultLocale ?? config.fluentiConfig.sourceLocale\n const compiledDir = config.fluentiConfig.compileOutDir\n const fallbackChain = config.fluentiConfig.fallbackChain\n const dateFormats = config.fluentiConfig.dateFormats\n const numberFormats = config.fluentiConfig.numberFormats\n const cookieName = escapeJsSingleQuoted(config.cookieName)\n const defaultLocaleSafe = escapeJsSingleQuoted(defaultLocale)\n\n for (const locale of locales) {\n validateLocale(locale, 'next-plugin')\n }\n\n const compiledDirAbs = resolve(projectRoot, compiledDir)\n const compiledRelative = toForwardSlash(relative(outDir, compiledDirAbs))\n\n const localeImports = locales\n .map((locale) => ` case '${escapeJsSingleQuoted(locale)}': return import('${compiledRelative}/${locale}')`)\n .join('\\n')\n\n const fallbackChainStr = fallbackChain\n ? JSON.stringify(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 = 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 = locales\n .map((locale) => {\n const safe = locale.replace(/[^a-zA-Z0-9]/g, '_')\n return `'${escapeJsSingleQuoted(locale)}': ${safe}`\n })\n .join(', ')\n\n const dateFormatsStr = dateFormats !== undefined ? JSON.stringify(dateFormats) : 'undefined'\n const numberFormatsStr = numberFormats !== undefined ? JSON.stringify(numberFormats) : 'undefined'\n\n const clientProviderSource = `\"use client\";\n// Auto-generated by @fluenti/next — do not edit\n// @ts-nocheck\nimport { createElement } from 'react'\nimport { I18nProvider } from '@fluenti/react'\nimport { interpolate as __interpolate } from '@fluenti/core/internal'\n${clientStaticImports}\n\nconst __allMessages = { ${clientAllMessagesEntries} }\nconst __dateFormats = ${dateFormatsStr}\nconst __numberFormats = ${numberFormatsStr}\n\nexport function ClientI18nProvider({ locale, fallbackLocale, fallbackChain, children }) {\n return createElement(I18nProvider, { locale, fallbackLocale, messages: __allMessages, fallbackChain, dateFormats: __dateFormats, numberFormats: __numberFormats, interpolate: __interpolate }, children)\n}\n`\n writeSafe(clientProviderPath, clientProviderSource)\n\n const clientProviderDtsPath = resolve(outDir, 'client-provider.d.ts')\n const clientProviderDtsSource = `// Auto-generated by @fluenti/next — do not edit\nimport type { ReactNode, ReactElement } from 'react'\n\nexport declare function ClientI18nProvider(props: {\n locale: string\n fallbackLocale: string\n fallbackChain?: Record<string, string[]>\n children: ReactNode\n}): ReactElement\n`\n writeSafe(clientProviderDtsPath, clientProviderDtsSource)\n\n const resolveLocaleImport = config.resolveLocale\n ? (() => {\n const absPath = resolve(projectRoot, config.resolveLocale)\n const relPath = toForwardSlash(relative(outDir, absPath))\n return `import __resolveLocale from '${relPath}'`\n })()\n : null\n\n const resolveLocaleFn = config.resolveLocale\n ? `resolveLocale: __resolveLocale,`\n : `resolveLocale: async () => {\n try {\n const { cookies, headers } = await import('next/headers')\n const [cookieStore, headerStore] = await Promise.all([cookies(), headers()])\n\n // 0. x-fluenti-locale header (set by createI18nMiddleware — most authoritative)\n const fromMiddleware = headerStore.get('x-fluenti-locale')\n if (fromMiddleware && __locales.includes(fromMiddleware)) return fromMiddleware\n\n // 1. Cookie (configurable name)\n const fromCookie = cookieStore.get('${cookieName}')?.value\n if (fromCookie && __locales.includes(fromCookie)) return fromCookie\n\n // 2. Accept-Language header\n const acceptLang = headerStore.get('accept-language')\n if (acceptLang) {\n for (const part of acceptLang.split(',')) {\n const lang = part.split(';')[0].trim()\n if (__locales.includes(lang)) return lang\n const prefix = lang.split('-')[0]\n const match = __locales.find(l => l === prefix || l.startsWith(prefix + '-'))\n if (match) return match\n }\n }\n\n return '${defaultLocaleSafe}'\n } catch {\n return '${defaultLocaleSafe}'\n }\n },`\n\n const localesArrayStr = JSON.stringify(locales)\n\n const moduleSource = `// Auto-generated by @fluenti/next — do not edit\n// @ts-nocheck\nimport { createServerI18n } from '@fluenti/react/server'\nimport { createElement } from 'react'\nimport { interpolate as __interpolate } from '@fluenti/core/internal'\n${resolveLocaleImport ? `${resolveLocaleImport}\\n` : ''}\nconst __locales = ${localesArrayStr}\n\nconst serverI18n = createServerI18n({\n interpolate: __interpolate,\n loadMessages: async (locale) => {\n switch (locale) {\n${localeImports}\n default: return import('${compiledRelative}/${defaultLocaleSafe}')\n }\n },\n fallbackLocale: '${defaultLocaleSafe}',\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' is a compile-time API replaced at build time.\\\\n\" +\n ' Ensure:\\\\n' +\n ' 1. \\`withFluenti()\\` is configured in next.config.ts\\\\n' +\n ' 2. The file is inside src/ (not node_modules)\\\\n' +\n \" 3. For client components, import from '@fluenti/react'\",\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 I18nProvider({ locale, children }) {\n const activeLocale = (locale && locale.trim()) ? locale : '${defaultLocaleSafe}'\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: '${defaultLocaleSafe}',\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, FluentiCoreInstanceFull } from '@fluenti/core'\n\nexport declare function setLocale(locale: string): void\nexport declare function getI18n(): Promise<FluentiCoreInstanceFull & { 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 format?: string\n}): Promise<ReactElement>\n\nexport declare function NumberFormat(props: {\n value: number\n format?: string\n}): Promise<ReactElement>\n\nexport declare function I18nProvider(props: {\n locale?: string\n children: ReactNode\n}): Promise<ReactElement>\n`\n\n writeSafe(outPath, moduleSource)\n writeSafe(dtsPath, dtsSource)\n\n // Generate Edge-safe i18n config for use in middleware\n const configModulePath = resolve(outDir, 'i18n-config.js')\n const configModuleDtsPath = resolve(outDir, 'i18n-config.d.ts')\n\n const configModuleSource = `// Auto-generated by @fluenti/next — do not edit\nexport const locales = ${localesArrayStr}\nexport const sourceLocale = '${defaultLocaleSafe}'\nexport const cookieName = '${cookieName}'\n`\n writeSafe(configModulePath, configModuleSource)\n\n const configModuleDtsSource = `// Auto-generated by @fluenti/next — do not edit\nexport declare const locales: string[]\nexport declare const sourceLocale: string\nexport declare const cookieName: string\n`\n writeSafe(configModuleDtsPath, configModuleDtsSource)\n\n return outPath\n}\n\n/** Escape a string for safe embedding inside a single-quoted JS string literal. */\nfunction escapeJsSingleQuoted(s: string): string {\n return s\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/'/g, \"\\\\'\")\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/\\0/g, '\\\\0')\n}\n\nfunction toForwardSlash(p: string): string {\n return p.split('\\\\').join('/')\n}\n","import { join } from 'node:path'\nimport { createRequire } from 'node:module'\n\nexport interface DevRunnerOptions {\n cwd: string\n onSuccess?: () => void\n onError?: (err: Error) => void\n /** If true, reject the promise on failure instead of swallowing the error */\n throwOnError?: boolean\n /** Run only compile (skip extract). Useful for production builds where source is unchanged. */\n compileOnly?: boolean\n /** Enable parallel compilation across locales using worker threads */\n parallelCompile?: boolean\n}\n\n/**\n * Run compile in-process via `@fluenti/cli` (for compileOnly mode),\n * or extract + compile in dev mode. Requires `@fluenti/cli` to be installed\n * as a devDependency.\n */\nexport async function runExtractCompile(options: DevRunnerOptions): Promise<void> {\n if (options.compileOnly) {\n try {\n // Resolve @fluenti/cli from the project's cwd (not from this package's location)\n // using createRequire so pnpm's strict node_modules layout works correctly.\n // Use require() (not import()) to load @fluenti/cli — avoids CJS/ESM interop\n // issues when dynamic import() loads minified CJS with chunk requires.\n const projectRequire = createRequire(join(options.cwd, 'package.json'))\n const { runCompile } = projectRequire('@fluenti/cli')\n await runCompile(options.cwd)\n console.log('[fluenti] Compiling... done')\n options.onSuccess?.()\n return\n } catch (e) {\n const error = e instanceof Error ? e : new Error(String(e))\n if (options.throwOnError) throw error\n console.warn('[fluenti] Compile failed:', error.message)\n options.onError?.(error)\n return\n }\n }\n\n // Dev mode: run in-process extract + compile.\n // Step 1: load @fluenti/cli — if not installed, guide user to install it.\n // Step 2: run — errors here mean the CLI ran but failed; surface them.\n let fluentCli: { runExtract: (cwd: string) => Promise<void>; runCompile: (cwd: string, opts?: { parallel: boolean }) => Promise<void> } | null = null\n try {\n const projectRequire = createRequire(join(options.cwd, 'package.json'))\n fluentCli = projectRequire('@fluenti/cli')\n } catch {\n // @fluenti/cli not installed — will show install guide below\n }\n\n if (fluentCli) {\n try {\n await fluentCli.runExtract(options.cwd)\n if (options.parallelCompile) {\n await fluentCli.runCompile(options.cwd, { parallel: true })\n } else {\n await fluentCli.runCompile(options.cwd)\n }\n console.log('[fluenti] Extracting and compiling... done')\n options.onSuccess?.()\n return\n } catch (e) {\n const error = e instanceof Error ? e : new Error(String(e))\n if (options.throwOnError) throw error\n console.warn('[fluenti] Extract/compile failed:', error.message)\n options.onError?.(error)\n return\n }\n }\n\n const msg =\n '[fluenti] @fluenti/cli is required for auto-compile.\\n' +\n ' Install it as a devDependency:\\n' +\n ' pnpm add -D @fluenti/cli\\n' +\n ' See: https://fluenti.dev/start/introduction/'\n if (options.throwOnError) {\n throw new Error(msg)\n }\n console.warn(msg)\n options.onError?.(new Error(msg))\n}\n\n/**\n * Create a debounced runner that collapses rapid calls.\n *\n * - If called while idle, schedules a run after `delay` ms.\n * - If called while a run is in progress, marks a pending rerun.\n * - Never runs concurrently.\n */\nexport function createDebouncedRunner(\n options: DevRunnerOptions,\n delay = 300,\n): () => void {\n let timer: ReturnType<typeof setTimeout> | null = null\n let running = false\n let pendingRerun = false\n\n async function execute(): Promise<void> {\n running = true\n try {\n await runExtractCompile(options)\n } finally {\n running = false\n if (pendingRerun) {\n pendingRerun = false\n schedule()\n }\n }\n }\n\n function schedule(): void {\n if (timer !== null) {\n clearTimeout(timer)\n }\n timer = setTimeout(() => {\n timer = null\n if (running) {\n pendingRerun = true\n } else {\n execute()\n }\n }, delay)\n }\n\n return schedule\n}\n","import { watch } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { createRequire } from 'node:module'\nimport { createDebouncedRunner } from './dev-runner'\n\nexport interface DevWatcherOptions {\n cwd: string\n compiledDir: string\n delay?: number\n /** Glob patterns from fluenti.config.ts `include` field */\n include?: string[]\n /** Glob patterns from fluenti.config.ts `exclude` field */\n exclude?: string[]\n /** Enable parallel compilation across locales using worker threads */\n parallelCompile?: boolean\n}\n\nlet activeWatcher: (() => void) | null = null\n\n/**\n * Extract watch directories from include glob patterns.\n *\n * Takes the static prefix before the first glob wildcard (`*`).\n * Falls back to `src` if no include patterns are provided.\n *\n * @example\n * extractWatchDirs('/proj', ['./src/**\\/*.tsx']) → ['/proj/src']\n * extractWatchDirs('/proj', ['./app/**\\/*.ts', './lib/**\\/*.ts']) → ['/proj/app', '/proj/lib']\n * extractWatchDirs('/proj', ['./**\\/*.ts']) → ['/proj']\n */\nexport function extractWatchDirs(cwd: string, include?: string[]): string[] {\n if (!include || include.length === 0) {\n return [resolve(cwd, 'src')]\n }\n\n const dirs = new Set<string>()\n for (const pattern of include) {\n const normalized = pattern.replace(/^\\.\\//, '')\n const staticPart = normalized.split('*')[0]!.replace(/\\/+$/, '')\n dirs.add(staticPart || '.')\n }\n return [...dirs].map(d => resolve(cwd, d))\n}\n\n/**\n * Start a standalone file watcher for dev auto-compile.\n *\n * Works independently of webpack/Turbopack — watches source directories\n * (inferred from `include` patterns) for changes and triggers\n * extract+compile via the debounced runner.\n *\n * Only one watcher is active at a time (guards against multiple `applyFluenti()` calls).\n *\n * @returns A cleanup function that stops the watcher.\n */\nexport function startDevWatcher(options: DevWatcherOptions): () => void {\n // Clean up previous watcher if one exists (e.g., dev server reload)\n if (activeWatcher) {\n activeWatcher()\n }\n\n const { cwd, compiledDir, delay = 1000, include, exclude, parallelCompile } = options\n const compiledDirResolved = resolve(cwd, compiledDir)\n const _require = createRequire(\n typeof __filename !== 'undefined' ? __filename : import.meta.url,\n )\n const picomatch = _require('picomatch') as (patterns: string[]) => (str: string) => boolean\n const isExcluded = exclude?.length ? picomatch(exclude) : () => false\n const runnerOpts: Parameters<typeof createDebouncedRunner>[0] = { cwd }\n if (parallelCompile) runnerOpts.parallelCompile = true\n const debouncedRun = createDebouncedRunner(runnerOpts, delay)\n\n // Initial run\n debouncedRun()\n\n const watchDirs = extractWatchDirs(cwd, include)\n const watchers = watchDirs.map(dir =>\n watch(dir, { recursive: true }, (_event, filename) => {\n if (!filename) return\n if (!/\\.[jt]sx?$/.test(filename)) return\n if (filename.includes('node_modules') || filename.includes('.next')) return\n const full = resolve(dir, filename)\n if (full.startsWith(compiledDirResolved)) return\n if (isExcluded(filename)) return\n debouncedRun()\n }),\n )\n\n const cleanup = (): void => {\n for (const w of watchers) w.close()\n activeWatcher = null\n }\n\n activeWatcher = cleanup\n return cleanup\n}\n","import { existsSync, mkdirSync } from 'node:fs'\nimport { execSync } from 'node:child_process'\nimport { resolve, dirname, relative } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport type { WithFluentConfig } from './types'\nimport { resolveConfig } from './read-config'\nimport { generateServerModule } from './generate-server-module'\nimport { startDevWatcher } from './dev-watcher'\n\n// Use Record<string, any> to accept both Next 15's and 16's NextConfig types\n// (Next 16 removed the index signature from NextConfig)\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype NextConfig = Record<string, any>\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 Minimal — no fluenti.config.ts needed\n * ```ts\n * import { withFluenti } from '@fluenti/next'\n * export default withFluenti({ locales: ['en', 'ja'] })({ reactStrictMode: true })\n * ```\n *\n * @example With fluenti.config.ts (advanced)\n * ```ts\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 && !isFluentConfig(configOrNext as Record<string, unknown>)) {\n // Has keys but none are fluent-specific → treat 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 isFluentConfig(obj: Record<string, unknown>): boolean {\n const fluentOnlyKeys = [\n 'config', 'locales', 'serverModule', 'serverModuleOutDir', 'resolveLocale',\n 'cookieName', 'loaderEnforce',\n ]\n return fluentOnlyKeys.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 const fluentiConfig = resolved.fluentiConfig\n const compiledDir = fluentiConfig.compileOutDir\n\n // Auto-create compiled catalogs directory if missing\n const compiledDirAbs = resolve(projectRoot, compiledDir)\n if (!existsSync(compiledDirAbs)) {\n mkdirSync(compiledDirAbs, { recursive: true })\n }\n\n // Auto-detect app/[locale]/ directory structure\n // If detected and rewriteDefaultLocale not explicitly set, enable it automatically\n const appLocaleDir = resolve(projectRoot, 'app', '[locale]')\n const srcAppLocaleDir = resolve(projectRoot, 'src', 'app', '[locale]')\n if (existsSync(appLocaleDir) || existsSync(srcAppLocaleDir)) {\n if (!('rewriteDefaultLocale' in (fluentConfig as Record<string, unknown>))) {\n // Auto-enable rewriteDefaultLocale when app/[locale]/ is detected\n (resolved as { _autoRewriteDefaultLocale?: boolean })._autoRewriteDefaultLocale = true\n }\n }\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(fileURLToPath(import.meta.url))\n const loaderPath = resolve(thisDir, 'loader.js')\n\n const existingWebpack = nextConfig['webpack'] as\n | ((config: WebpackConfig, options: WebpackOptions) => WebpackConfig)\n | undefined\n\n let buildCompileRan = false\n\n // ── Turbopack config ──────────────────────────────────────────────\n // Turbopack loader-runner supports webpack loaders via turbopack.rules.\n // Use package name (not file path) — Turbopack resolves loaders as packages,\n // file paths trigger static analysis errors (TP1006) in the loader-runner.\n const fluentTurboRules = Object.fromEntries(\n ['*.ts', '*.tsx', '*.js', '*.jsx'].map((ext) => [\n ext,\n {\n condition: { not: 'foreign' },\n loaders: ['@fluenti/next/loader'],\n },\n ]),\n )\n\n // Turbopack resolveAlias requires relative paths (absolute paths get\n // misinterpreted as \"./abs/path\"). Use \"./\" + relative-from-cwd.\n const configModulePath = resolve(dirname(serverModulePath), 'i18n-config.js')\n const relativeServerModule = './' + relative(projectRoot, serverModulePath).split('\\\\').join('/')\n const relativeConfigModule = './' + relative(projectRoot, configModulePath).split('\\\\').join('/')\n const fluentTurboAlias: Record<string, string> = {\n '@fluenti/next': relativeServerModule,\n '@fluenti/next/i18n-config': relativeConfigModule,\n }\n\n // ── Build auto-compile (bundler-agnostic — runs at config time) ──\n const isDev = process.env['NODE_ENV'] === 'development'\n || process.argv.some(a => a === 'dev')\n const buildAutoCompile = fluentiConfig.buildAutoCompile ?? true\n\n if (!isDev && buildAutoCompile && !buildCompileRan) {\n buildCompileRan = true\n try {\n execSync(\n 'npx fluenti compile' + (fluentiConfig.parallelCompile ? ' --parallel' : ''),\n { cwd: projectRoot, stdio: 'inherit' },\n )\n } catch {\n // @fluenti/cli not installed or compile failed — user sees stdio output\n }\n }\n\n // ── Dev auto-compile via standalone watcher (works with both webpack & Turbopack) ──\n const devAutoCompile = fluentiConfig.devAutoCompile ?? true\n\n if (isDev && devAutoCompile) {\n const watcherOpts: Parameters<typeof startDevWatcher>[0] = {\n cwd: projectRoot,\n compiledDir,\n delay: fluentiConfig.devAutoCompileDelay ?? 1000,\n }\n if (fluentiConfig.parallelCompile) watcherOpts.parallelCompile = true\n if (fluentiConfig.include) watcherOpts.include = fluentiConfig.include\n if (fluentiConfig.exclude) watcherOpts.exclude = fluentiConfig.exclude\n startDevWatcher(watcherOpts)\n }\n\n // Detect Next.js version to use correct Turbopack config key\n // Next 15+: top-level `turbopack` key\n // Next 14: `experimental.turbo` key\n let nextMajor = 15\n try {\n const nextPkg = require('next/package.json') as { version?: string }\n if (nextPkg.version) nextMajor = parseInt(nextPkg.version.split('.')[0]!, 10) || 15\n } catch { /* next not resolvable at config time */ }\n\n const turboConfig = mergeTurbopackConfig(\n (nextMajor >= 15\n ? nextConfig['turbopack']\n : (nextConfig['experimental'] as Record<string, unknown> | undefined)?.['turbo']\n ) as Record<string, unknown> | undefined,\n { rules: fluentTurboRules, resolveAlias: fluentTurboAlias },\n )\n\n const turboKey = nextMajor >= 15\n ? { turbopack: turboConfig }\n : { experimental: { ...(nextConfig['experimental'] as Record<string, unknown> ?? {}), turbo: turboConfig } }\n\n return {\n ...nextConfig,\n ...turboKey,\n webpack(config: WebpackConfig, options: WebpackOptions) {\n // Add fluenti loader\n const loaderEnforce = fluentConfig.loaderEnforce === undefined && !('loaderEnforce' in (fluentConfig as Record<string, unknown>))\n ? 'pre' as const\n : fluentConfig.loaderEnforce\n config.module.rules.push({\n test: /\\.[jt]sx?$/,\n ...(loaderEnforce ? { enforce: loaderEnforce } : {}),\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$'] = serverModulePath\n config.resolve.alias['@fluenti/next/i18n-config$'] = configModulePath\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\nfunction mergeTurbopackConfig(\n existing: Record<string, unknown> | undefined,\n fluenti: { rules: Record<string, unknown>; resolveAlias: Record<string, string> },\n): Record<string, unknown> {\n const base = existing ?? {}\n const userRules = (base['rules'] as Record<string, unknown>) ?? {}\n\n // Warn when user rules override fluenti's source-file rules\n const fluentKeys = Object.keys(fluenti.rules)\n const overlapping = fluentKeys.filter(k => k in userRules)\n if (overlapping.length > 0) {\n console.warn(\n `[fluenti] Your turbopack.rules override Fluenti's loader for: ${overlapping.join(', ')}.\\n` +\n ` Fluenti's t\\`\\` transform will NOT run on these file types.\\n` +\n ` If this is intentional, you can suppress this warning with { devAutoCompile: false }.`,\n )\n }\n\n return {\n ...base,\n rules: { ...fluenti.rules, ...userRules },\n resolveAlias: { ...fluenti.resolveAlias, ...(base['resolveAlias'] as Record<string, string>) },\n }\n}\n\n// Minimal webpack types for the config function\ninterface WebpackConfig {\n module: {\n rules: Array<Record<string, unknown>>\n }\n resolve: {\n alias?: Record<string, string>\n }\n}\n\ninterface WebpackOptions {\n isServer: boolean\n dev: boolean\n}\n","/**\n * @fluenti/next — Next.js plugin for Fluenti\n *\n * Provides:\n * - `withFluenti()` — wraps next.config.ts with t`` transform support\n * - I18nProvider — async server component (exported from generated module)\n * - Webpack loader for strict, binding-aware tagged-template optimization\n *\n * @example\n * ```ts\n * // next.config.ts\n * import { withFluenti } from '@fluenti/next'\n * export default withFluenti()({ reactStrictMode: true })\n * ```\n *\n * @example\n * ```tsx\n * // app/layout.tsx — resolved by webpack alias to the generated module\n * import { I18nProvider } from '@fluenti/next'\n * ```\n */\nexport { withFluenti } from './with-fluenti'\nexport type { WithFluentConfig, I18nProviderProps } from './types'\nexport { defineRouting } from './routing'\nexport type { RoutingConfig } from './routing'\nexport { msg } from '@fluenti/react'\n\n// ── Runtime stubs ────────────────────────────────────────────────────\n// TypeScript resolves types from this file (via package.json exports).\n// At runtime, webpack `resolve.alias` redirects `@fluenti/next$` to the\n// generated server module, so these stubs are never actually called in\n// a correctly configured project. They exist only to provide helpful\n// errors if `withFluenti()` is not configured.\n\nimport type { ReactNode, ReactElement } from 'react'\nimport type { CompileTimeT, FluentiCoreInstanceFull } from '@fluenti/core'\n\nconst NOT_CONFIGURED =\n '[fluenti] `withFluenti()` must be configured in next.config.ts before importing from \"@fluenti/next\".'\n\nfunction throwNotConfigured(): never {\n throw new Error(NOT_CONFIGURED)\n}\n\n/** @see Generated module for the real implementation. */\nexport const setLocale: (locale: string) => void = throwNotConfigured\n/** @see Generated module for the real implementation. */\nexport const getI18n: () => Promise<FluentiCoreInstanceFull & { locale: string }> = throwNotConfigured as () => Promise<FluentiCoreInstanceFull & { locale: string }>\n/** @see Generated module for the real implementation. */\nexport const t: CompileTimeT = throwNotConfigured as unknown as CompileTimeT\n/** @see Generated module for the real implementation. */\nexport const Trans: (props: { children: ReactNode; id?: string; context?: string; comment?: string; render?: (translation: ReactNode) => ReactNode }) => Promise<ReactElement> = throwNotConfigured as unknown as typeof Trans\n/** @see Generated module for the real implementation. */\nexport const Plural: (props: { value: number; id?: string; context?: string; comment?: string; zero?: ReactNode; one?: ReactNode; two?: ReactNode; few?: ReactNode; many?: ReactNode; other: ReactNode; offset?: number }) => Promise<ReactElement> = throwNotConfigured as unknown as typeof Plural\n/** @see Generated module for the real implementation. */\nexport const Select: (props: { value: string; id?: string; context?: string; comment?: string; other: ReactNode; options?: Record<string, ReactNode>; [key: string]: ReactNode | Record<string, ReactNode> | string | undefined }) => Promise<ReactElement> = throwNotConfigured as unknown as typeof Select\n/** @see Generated module for the real implementation. */\nexport const DateTime: (props: { value: Date | number; style?: string }) => Promise<ReactElement> = throwNotConfigured as unknown as typeof DateTime\n/** @see Generated module for the real implementation. */\nexport const NumberFormat: (props: { value: number; style?: string }) => Promise<ReactElement> = throwNotConfigured as unknown as typeof NumberFormat\n/** @see Generated module for the real implementation. */\nexport const I18nProvider: (props: { locale?: string; children: ReactNode }) => Promise<ReactElement> = throwNotConfigured as unknown as typeof I18nProvider\n"],"mappings":"yWASA,SAAgB,EACd,EACA,EACsB,CACtB,IAAI,EAEJ,AAQE,EARE,GAAW,QAAU,OAAO,EAAU,QAAW,SAEnC,CAAE,GAAG,EAAA,uBAAwB,GAAG,EAAU,OAAQ,CACzD,CAAC,GAAW,QAAU,GAAW,QAE1B,CAAE,GAAG,EAAA,uBAAwB,QAAS,EAAU,QAAS,EAGzE,EAAA,EAAA,gBACE,OAAO,GAAW,QAAW,SAAW,EAAU,OAAS,IAAA,GAC3D,EACD,CAGH,IAAM,EAAqB,GAAW,oBAAsB,WACtD,EAAa,GAAW,YAAc,SAEtC,EAAiC,CACrC,gBACA,aAAc,GAAW,cAAgB,KACzC,qBACA,aACD,CAED,OADI,GAAW,gBAAe,EAAS,cAAgB,EAAU,eAC1D,EChCT,SAAS,EAAU,EAAc,EAAuB,CACtD,GAAI,EACF,EAAA,EAAA,eAAc,EAAM,EAAS,QAAQ,OAC9B,EAAK,CACZ,MAAU,MACR,iDAAiD,EAAK,IAAI,aAAe,MAAQ,EAAI,QAAU,OAAO,EAAI,GAC3G,EAYL,SAAgB,EACd,EACA,EACQ,CACR,GAAI,EAAO,aACT,OAAA,EAAA,EAAA,SAAe,EAAa,EAAO,aAAa,CAGlD,IAAM,GAAA,EAAA,EAAA,SAAiB,EAAa,EAAO,mBAAmB,CACxD,GAAA,EAAA,EAAA,SAAkB,EAAQ,YAAY,CACtC,GAAA,EAAA,EAAA,SAAkB,EAAQ,cAAc,EAE1C,EAAA,EAAA,YAAY,EAAO,GACrB,EAAA,EAAA,WAAU,EAAQ,CAAE,UAAW,GAAM,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CAAE,QAAS,EAAe,CAAG,EAAE,CACnD,QAAS,CAAC,eAAgB,SAAS,CACnC,IAAK,CACH,CACE,OAAQ,EACR,QAAS,CACP,mBACD,CACF,CACF,CACF,CAAC,CAGF,EAAO,QAAU,EAAO,SAAW,EAAE,CACrC,EAAO,QAAQ,MAAQ,EAAO,QAAQ,OAAS,EAAE,CACjD,EAAO,QAAQ,MAAM,kBAAoB,EACzC,EAAO,QAAQ,MAAM,8BAAgC,EAGjD,EACK,EAAgB,EAAQ,EAAQ,CAGlC,GAEV,CAGH,SAAS,EACP,EACA,EACyB,CACzB,IAAM,EAAO,GAAY,EAAE,CACrB,EAAa,EAAK,OAAwC,EAAE,CAI5D,EADa,OAAO,KAAK,EAAQ,MAAM,CACd,OAAO,GAAK,KAAK,EAAU,CAS1D,OARI,EAAY,OAAS,GACvB,QAAQ,KACN,iEAAiE,EAAY,KAAK,KAAK,CAAC,2JAGzF,CAGI,CACL,GAAG,EACH,MAAO,CAAE,GAAG,EAAQ,MAAO,GAAG,EAAW,CACzC,aAAc,CAAE,GAAG,EAAQ,aAAc,GAAI,EAAK,aAA4C,CAC/F,MCnN2B,CAc9B,IAAM,EACJ,wGAEF,SAAS,GAA4B,CACnC,MAAU,MAAM,EAAe,CAIjC,IAAa,EAAsC,EAEtC,EAAuE,EAEvE,EAAkB,EAElB,EAAoK,EAEpK,EAAyO,EAEzO,EAAiP,EAEjP,EAAuF,EAEvF,EAAoF,EAEpF,EAA2F"}
package/dist/index.d.ts CHANGED
@@ -23,6 +23,8 @@ import { CompileTimeT, FluentiCoreInstanceFull } from '@fluenti/core';
23
23
  */
24
24
  export { withFluenti } from './with-fluenti';
25
25
  export type { WithFluentConfig, I18nProviderProps } from './types';
26
+ export { defineRouting } from './routing';
27
+ export type { RoutingConfig } from './routing';
26
28
  export { msg } from '@fluenti/react';
27
29
  /** @see Generated module for the real implementation. */
28
30
  export declare const setLocale: (locale: string) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","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