next-intlayer 9.3.3 → 9.4.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/README.md +4 -1
- package/dist/cjs/client/IntlayerClientProvider.cjs +18 -14
- package/dist/cjs/client/IntlayerClientProvider.cjs.map +1 -1
- package/dist/cjs/index.cjs +18 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/rsc/index.cjs +96 -0
- package/dist/cjs/server/IntlayerProvider.cjs +54 -0
- package/dist/cjs/server/IntlayerProvider.cjs.map +1 -0
- package/dist/cjs/server/IntlayerServerProvider.cjs +29 -0
- package/dist/cjs/server/IntlayerServerProvider.cjs.map +1 -0
- package/dist/cjs/server/ambientLocale.cjs +64 -0
- package/dist/cjs/server/ambientLocale.cjs.map +1 -0
- package/dist/cjs/server/format/index.cjs +17 -7
- package/dist/cjs/server/format/useCompact.cjs +26 -0
- package/dist/cjs/server/format/useCompact.cjs.map +1 -0
- package/dist/cjs/server/format/useCurrency.cjs +26 -0
- package/dist/cjs/server/format/useCurrency.cjs.map +1 -0
- package/dist/cjs/server/format/useDate.cjs +33 -0
- package/dist/cjs/server/format/useDate.cjs.map +1 -0
- package/dist/cjs/server/format/useList.cjs +26 -0
- package/dist/cjs/server/format/useList.cjs.map +1 -0
- package/dist/cjs/server/format/useNumber.cjs +26 -0
- package/dist/cjs/server/format/useNumber.cjs.map +1 -0
- package/dist/cjs/server/format/usePercentage.cjs +26 -0
- package/dist/cjs/server/format/usePercentage.cjs.map +1 -0
- package/dist/cjs/server/format/useRelativeTime.cjs +26 -0
- package/dist/cjs/server/format/useRelativeTime.cjs.map +1 -0
- package/dist/cjs/server/format/useUnit.cjs +26 -0
- package/dist/cjs/server/format/useUnit.cjs.map +1 -0
- package/dist/cjs/server/index.cjs +27 -43
- package/dist/cjs/server/prepareSwcOptimization.cjs +1 -1
- package/dist/cjs/server/prepareSwcOptimization.cjs.map +1 -1
- package/dist/cjs/server/suspendingReader.cjs +45 -0
- package/dist/cjs/server/suspendingReader.cjs.map +1 -0
- package/dist/cjs/server/t.cjs +16 -0
- package/dist/cjs/server/t.cjs.map +1 -0
- package/dist/cjs/server/useDictionary.cjs +5 -4
- package/dist/cjs/server/useDictionary.cjs.map +1 -1
- package/dist/cjs/server/useDictionaryAsync.cjs +5 -7
- package/dist/cjs/server/useDictionaryAsync.cjs.map +1 -1
- package/dist/cjs/server/useDictionaryDynamic.cjs +5 -4
- package/dist/cjs/server/useDictionaryDynamic.cjs.map +1 -1
- package/dist/cjs/server/useI18n.cjs +17 -0
- package/dist/cjs/server/useI18n.cjs.map +1 -0
- package/dist/cjs/server/useIntl.cjs +16 -0
- package/dist/cjs/server/useIntl.cjs.map +1 -0
- package/dist/cjs/server/useIntlayer.cjs +5 -20
- package/dist/cjs/server/useIntlayer.cjs.map +1 -1
- package/dist/cjs/server/useLocale.cjs +26 -0
- package/dist/cjs/server/useLocale.cjs.map +1 -0
- package/dist/cjs/server/withIntlayer.cjs +2 -3
- package/dist/cjs/server/withIntlayer.cjs.map +1 -1
- package/dist/esm/client/IntlayerClientProvider.mjs +18 -15
- package/dist/esm/client/IntlayerClientProvider.mjs.map +1 -1
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/rsc/index.mjs +18 -0
- package/dist/esm/server/IntlayerProvider.mjs +53 -0
- package/dist/esm/server/IntlayerProvider.mjs.map +1 -0
- package/dist/esm/server/IntlayerServerProvider.mjs +28 -0
- package/dist/esm/server/IntlayerServerProvider.mjs.map +1 -0
- package/dist/esm/server/ambientLocale.mjs +61 -0
- package/dist/esm/server/ambientLocale.mjs.map +1 -0
- package/dist/esm/server/format/index.mjs +10 -1
- package/dist/esm/server/format/useCompact.mjs +25 -0
- package/dist/esm/server/format/useCompact.mjs.map +1 -0
- package/dist/esm/server/format/useCurrency.mjs +25 -0
- package/dist/esm/server/format/useCurrency.mjs.map +1 -0
- package/dist/esm/server/format/useDate.mjs +32 -0
- package/dist/esm/server/format/useDate.mjs.map +1 -0
- package/dist/esm/server/format/useList.mjs +25 -0
- package/dist/esm/server/format/useList.mjs.map +1 -0
- package/dist/esm/server/format/useNumber.mjs +25 -0
- package/dist/esm/server/format/useNumber.mjs.map +1 -0
- package/dist/esm/server/format/usePercentage.mjs +25 -0
- package/dist/esm/server/format/usePercentage.mjs.map +1 -0
- package/dist/esm/server/format/useRelativeTime.mjs +25 -0
- package/dist/esm/server/format/useRelativeTime.mjs.map +1 -0
- package/dist/esm/server/format/useUnit.mjs +25 -0
- package/dist/esm/server/format/useUnit.mjs.map +1 -0
- package/dist/esm/server/index.mjs +12 -2
- package/dist/esm/server/prepareSwcOptimization.mjs +1 -1
- package/dist/esm/server/prepareSwcOptimization.mjs.map +1 -1
- package/dist/esm/server/suspendingReader.mjs +42 -0
- package/dist/esm/server/suspendingReader.mjs.map +1 -0
- package/dist/esm/server/t.mjs +15 -0
- package/dist/esm/server/t.mjs.map +1 -0
- package/dist/esm/server/useDictionary.mjs +5 -4
- package/dist/esm/server/useDictionary.mjs.map +1 -1
- package/dist/esm/server/useDictionaryAsync.mjs +5 -7
- package/dist/esm/server/useDictionaryAsync.mjs.map +1 -1
- package/dist/esm/server/useDictionaryDynamic.mjs +5 -4
- package/dist/esm/server/useDictionaryDynamic.mjs.map +1 -1
- package/dist/esm/server/useI18n.mjs +16 -0
- package/dist/esm/server/useI18n.mjs.map +1 -0
- package/dist/esm/server/useIntl.mjs +15 -0
- package/dist/esm/server/useIntl.mjs.map +1 -0
- package/dist/esm/server/useIntlayer.mjs +6 -18
- package/dist/esm/server/useIntlayer.mjs.map +1 -1
- package/dist/esm/server/useLocale.mjs +25 -0
- package/dist/esm/server/useLocale.mjs.map +1 -0
- package/dist/esm/server/withIntlayer.mjs +2 -3
- package/dist/esm/server/withIntlayer.mjs.map +1 -1
- package/dist/types/@intlayer/babel/dist/types/babel-plugin-intlayer-purge.d.ts +2 -2
- package/dist/types/@intlayer/babel/dist/types/babel-plugin-intlayer-usage-analyzer.d.ts +2 -2
- package/dist/types/@intlayer/babel/dist/types/extractContent/contentWriter.d.ts +2 -2
- package/dist/types/@intlayer/babel/dist/types/getOptimizePluginOptions.d.ts +2 -2
- package/dist/types/@intlayer/babel/dist/types/getPurgePluginOptions.d.ts +2 -2
- package/dist/types/client/IntlayerClientProvider.d.ts +20 -14
- package/dist/types/client/IntlayerClientProvider.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/rsc/index.d.ts +19 -0
- package/dist/types/server/IntlayerProvider.d.ts +43 -0
- package/dist/types/server/IntlayerProvider.d.ts.map +1 -0
- package/dist/types/server/IntlayerServerProvider.d.ts +30 -0
- package/dist/types/server/IntlayerServerProvider.d.ts.map +1 -0
- package/dist/types/server/ambientLocale.d.ts +34 -0
- package/dist/types/server/ambientLocale.d.ts.map +1 -0
- package/dist/types/server/format/index.d.ts +9 -1
- package/dist/types/server/format/useCompact.d.ts +16 -0
- package/dist/types/server/format/useCompact.d.ts.map +1 -0
- package/dist/types/server/format/useCurrency.d.ts +16 -0
- package/dist/types/server/format/useCurrency.d.ts.map +1 -0
- package/dist/types/server/format/useDate.d.ts +20 -0
- package/dist/types/server/format/useDate.d.ts.map +1 -0
- package/dist/types/server/format/useList.d.ts +16 -0
- package/dist/types/server/format/useList.d.ts.map +1 -0
- package/dist/types/server/format/useNumber.d.ts +16 -0
- package/dist/types/server/format/useNumber.d.ts.map +1 -0
- package/dist/types/server/format/usePercentage.d.ts +16 -0
- package/dist/types/server/format/usePercentage.d.ts.map +1 -0
- package/dist/types/server/format/useRelativeTime.d.ts +16 -0
- package/dist/types/server/format/useRelativeTime.d.ts.map +1 -0
- package/dist/types/server/format/useUnit.d.ts +16 -0
- package/dist/types/server/format/useUnit.d.ts.map +1 -0
- package/dist/types/server/index.d.ts +12 -2
- package/dist/types/server/prepareSwcOptimization.d.ts +1 -1
- package/dist/types/server/prepareSwcOptimization.d.ts.map +1 -1
- package/dist/types/server/suspendingReader.d.ts +22 -0
- package/dist/types/server/suspendingReader.d.ts.map +1 -0
- package/dist/types/server/t.d.ts +13 -0
- package/dist/types/server/t.d.ts.map +1 -0
- package/dist/types/server/useDictionary.d.ts +2 -1
- package/dist/types/server/useDictionary.d.ts.map +1 -1
- package/dist/types/server/useDictionaryAsync.d.ts +5 -4
- package/dist/types/server/useDictionaryAsync.d.ts.map +1 -1
- package/dist/types/server/useDictionaryDynamic.d.ts +3 -2
- package/dist/types/server/useDictionaryDynamic.d.ts.map +1 -1
- package/dist/types/server/useI18n.d.ts +14 -0
- package/dist/types/server/useI18n.d.ts.map +1 -0
- package/dist/types/server/useIntl.d.ts +13 -0
- package/dist/types/server/useIntl.d.ts.map +1 -0
- package/dist/types/server/useIntlayer.d.ts +4 -5
- package/dist/types/server/useIntlayer.d.ts.map +1 -1
- package/dist/types/server/useLocale.d.ts +20 -0
- package/dist/types/server/useLocale.d.ts.map +1 -0
- package/package.json +14 -9
package/README.md
CHANGED
|
@@ -214,6 +214,7 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
214
214
|
<li><a href="https://intlayer.org/doc/environment/vite-and-vue" rel=''>Vite + Vue</a></li>
|
|
215
215
|
<li><a href="https://intlayer.org/doc/environment/nuxt-and-vue" rel=''>Vite + Nuxt</a></li>
|
|
216
216
|
<li><a href="https://intlayer.org/doc/environment/vite-and-solid" rel=''>Vite + Solid</a></li>
|
|
217
|
+
<li><a href="https://intlayer.org/doc/environment/solid-start" rel=''>Solid Start</a></li>
|
|
217
218
|
<li><a href="https://intlayer.org/doc/environment/angular" rel=''>Angular</a></li>
|
|
218
219
|
<li>
|
|
219
220
|
<a href="https://intlayer.org/doc/environment/express" rel=''>Backend</a>
|
|
@@ -223,7 +224,9 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
223
224
|
<li><a href="https://intlayer.org/doc/environment/fastify" rel=''>Fastify</a></li>
|
|
224
225
|
<li><a href="https://intlayer.org/doc/environment/adonisjs" rel=''>AdonisJS</a></li>
|
|
225
226
|
<li><a href="https://intlayer.org/doc/environment/hono" rel=''>Hono</a></li>
|
|
227
|
+
<li><a href="https://intlayer.org/doc/environment/elysia" rel=''>Elysia</a></li>
|
|
226
228
|
</ul>
|
|
229
|
+
|
|
227
230
|
</li>
|
|
228
231
|
</ul>
|
|
229
232
|
</details>
|
|
@@ -327,4 +330,4 @@ Contribute on [GitHub](https://github.com/aymericzip/intlayer), [GitLab](https:/
|
|
|
327
330
|
|
|
328
331
|
If you like Intlayer, give us a ⭐ on GitHub. It helps others discover the project! [See why GitHub Stars matter](https://github.com/aymericzip/intlayer/blob/main/CONTRIBUTING.md#why-github-stars-matter-).
|
|
329
332
|
|
|
330
|
-
[](https://star-history.dera.page/#aymericzip/intlayer&Date)
|
|
@@ -6,31 +6,35 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
6
6
|
|
|
7
7
|
//#region src/client/IntlayerClientProvider.tsx
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Client boundary mounted by the unified `IntlayerProvider`.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Wraps the `IntlayerProvider` from `react-intlayer` so that client components
|
|
12
|
+
* rendered below a Next.js App Router server component receive the locale and
|
|
13
|
+
* the ambient variant through context.
|
|
13
14
|
*
|
|
14
15
|
* @param props - The provider props.
|
|
15
16
|
* @returns The provider component.
|
|
17
|
+
*/
|
|
18
|
+
const IntlayerClientProviderBase = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_intlayer.IntlayerProvider, { ...props });
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use `IntlayerProvider` from `next-intlayer/server` instead.
|
|
21
|
+
* Mounted once in the locale layout, it seeds the request-scoped server
|
|
22
|
+
* context *and* mounts this client provider, so a single provider covers both
|
|
23
|
+
* halves of the tree:
|
|
16
24
|
*
|
|
17
|
-
* @example
|
|
18
25
|
* ```tsx
|
|
19
|
-
*
|
|
26
|
+
* import { IntlayerProvider } from 'next-intlayer/server';
|
|
20
27
|
*
|
|
21
|
-
*
|
|
28
|
+
* const LocaleLayout = async ({ children, params }) => {
|
|
29
|
+
* const { locale } = await params;
|
|
22
30
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* <IntlayerClientProvider locale={locale}>
|
|
26
|
-
* {children}
|
|
27
|
-
* </IntlayerClientProvider>
|
|
28
|
-
* );
|
|
29
|
-
* }
|
|
31
|
+
* return <IntlayerProvider locale={locale}>{children}</IntlayerProvider>;
|
|
32
|
+
* };
|
|
30
33
|
* ```
|
|
31
34
|
*/
|
|
32
|
-
const IntlayerClientProvider =
|
|
35
|
+
const IntlayerClientProvider = IntlayerClientProviderBase;
|
|
33
36
|
|
|
34
37
|
//#endregion
|
|
35
38
|
exports.IntlayerClientProvider = IntlayerClientProvider;
|
|
39
|
+
exports.IntlayerClientProviderBase = IntlayerClientProviderBase;
|
|
36
40
|
//# sourceMappingURL=IntlayerClientProvider.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerClientProvider.cjs","names":["IntlayerProvider"],"sources":["../../../src/client/IntlayerClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport type { FC } from 'react';\n\nimport { IntlayerProvider, type IntlayerProviderProps } from 'react-intlayer';\n\nexport type IntlayerClientProviderProps = IntlayerProviderProps;\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"IntlayerClientProvider.cjs","names":["IntlayerProvider"],"sources":["../../../src/client/IntlayerClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport type { FC } from 'react';\n\nimport { IntlayerProvider, type IntlayerProviderProps } from 'react-intlayer';\n\n/**\n * @deprecated Use `IntlayerProviderProps` from `next-intlayer/server` instead.\n */\nexport type IntlayerClientProviderProps = IntlayerProviderProps;\n\n/**\n * Client boundary mounted by the unified `IntlayerProvider`.\n *\n * Wraps the `IntlayerProvider` from `react-intlayer` so that client components\n * rendered below a Next.js App Router server component receive the locale and\n * the ambient variant through context.\n *\n * @param props - The provider props.\n * @returns The provider component.\n */\nexport const IntlayerClientProviderBase: FC<IntlayerProviderProps> = (\n props\n) => <IntlayerProvider {...props} />;\n\n/**\n * @deprecated Use `IntlayerProvider` from `next-intlayer/server` instead.\n * Mounted once in the locale layout, it seeds the request-scoped server\n * context *and* mounts this client provider, so a single provider covers both\n * halves of the tree:\n *\n * ```tsx\n * import { IntlayerProvider } from 'next-intlayer/server';\n *\n * const LocaleLayout = async ({ children, params }) => {\n * const { locale } = await params;\n *\n * return <IntlayerProvider locale={locale}>{children}</IntlayerProvider>;\n * };\n * ```\n */\nexport const IntlayerClientProvider = IntlayerClientProviderBase;\n"],"mappings":";;;;;;;;;;;;;;;;;AAqBA,MAAa,8BACX,UACG,2CAACA,iCAAD,EAAkB,GAAI,MAAQ;;;;;;;;;;;;;;;;;AAkBnC,MAAa,yBAAyB"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -37,6 +37,12 @@ Object.defineProperty(exports, 'IntlayerClientContext', {
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
exports.IntlayerClientProvider = require_client_IntlayerClientProvider.IntlayerClientProvider;
|
|
40
|
+
Object.defineProperty(exports, 'IntlayerProvider', {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () {
|
|
43
|
+
return react_intlayer.IntlayerProvider;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
40
46
|
exports.MarkdownProvider = MarkdownProvider;
|
|
41
47
|
exports.MarkdownRenderer = MarkdownRenderer;
|
|
42
48
|
exports.generateStaticParams = require_generateStaticParams.generateStaticParams;
|
|
@@ -83,6 +89,12 @@ Object.defineProperty(exports, 't', {
|
|
|
83
89
|
return react_intlayer.t;
|
|
84
90
|
}
|
|
85
91
|
});
|
|
92
|
+
Object.defineProperty(exports, 'useConversion', {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function () {
|
|
95
|
+
return react_intlayer.useConversion;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
86
98
|
Object.defineProperty(exports, 'useDictionary', {
|
|
87
99
|
enumerable: true,
|
|
88
100
|
get: function () {
|
|
@@ -101,6 +113,12 @@ Object.defineProperty(exports, 'useDictionaryDynamic', {
|
|
|
101
113
|
return react_intlayer.useDictionaryDynamic;
|
|
102
114
|
}
|
|
103
115
|
});
|
|
116
|
+
Object.defineProperty(exports, 'useExperiment', {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function () {
|
|
119
|
+
return react_intlayer.useExperiment;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
104
122
|
Object.defineProperty(exports, 'useI18n', {
|
|
105
123
|
enumerable: true,
|
|
106
124
|
get: function () {
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["_MarkdownProvider","_useMarkdownContext","_renderMarkdown","_useMarkdownRenderer","_MarkdownRenderer"],"sources":["../../src/index.ts"],"sourcesContent":["export {\n getDictionary,\n getIntlayer,\n IntlayerClientContext,\n type IntlayerNode,\n localeCookie,\n localeInStorage,\n setLocaleCookie,\n setLocaleInStorage,\n t,\n useDictionary,\n useDictionaryAsync,\n useDictionaryDynamic,\n useI18n,\n useIntl,\n useIntlayer,\n useLoadDynamic,\n useLocaleCookie,\n useLocaleStorage,\n} from 'react-intlayer';\nexport * from './client/index';\nexport { generateStaticParams } from './generateStaticParams';\nexport type {\n LocalParams,\n LocalPromiseParams,\n Next14LayoutIntlayer,\n Next14PageIntlayer,\n Next15LayoutIntlayer,\n Next15PageIntlayer,\n NextLayoutIntlayer,\n NextPageIntlayer,\n} from './types/index';\n\nimport type {\n MarkdownProviderOptions as _MarkdownProviderOptions,\n MarkdownRendererProps as _MarkdownRendererProps,\n RenderMarkdownProps as _RenderMarkdownProps,\n} from './markdown';\nimport {\n MarkdownProvider as _MarkdownProvider,\n MarkdownRenderer as _MarkdownRenderer,\n renderMarkdown as _renderMarkdown,\n useMarkdownContext as _useMarkdownContext,\n useMarkdownRenderer as _useMarkdownRenderer,\n} from './markdown';\n\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const MarkdownProvider = _MarkdownProvider;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const useMarkdownContext = _useMarkdownContext;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport type MarkdownProviderOptions = _MarkdownProviderOptions;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const renderMarkdown = _renderMarkdown;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const useMarkdownRenderer = _useMarkdownRenderer;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const MarkdownRenderer = _MarkdownRenderer;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport type RenderMarkdownProps = _RenderMarkdownProps;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport type MarkdownRendererProps = _MarkdownRendererProps;\n"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["_MarkdownProvider","_useMarkdownContext","_renderMarkdown","_useMarkdownRenderer","_MarkdownRenderer"],"sources":["../../src/index.ts"],"sourcesContent":["export {\n type ConversionParams,\n type ExperimentState,\n getDictionary,\n getIntlayer,\n IntlayerClientContext,\n type IntlayerNode,\n IntlayerProvider,\n type IntlayerProviderProps,\n localeCookie,\n localeInStorage,\n setLocaleCookie,\n setLocaleInStorage,\n t,\n useConversion,\n useDictionary,\n useDictionaryAsync,\n useDictionaryDynamic,\n useExperiment,\n useI18n,\n useIntl,\n useIntlayer,\n useLoadDynamic,\n useLocaleCookie,\n useLocaleStorage,\n} from 'react-intlayer';\nexport * from './client/index';\nexport { generateStaticParams } from './generateStaticParams';\nexport type {\n LocalParams,\n LocalPromiseParams,\n Next14LayoutIntlayer,\n Next14PageIntlayer,\n Next15LayoutIntlayer,\n Next15PageIntlayer,\n NextLayoutIntlayer,\n NextPageIntlayer,\n} from './types/index';\n\nimport type {\n MarkdownProviderOptions as _MarkdownProviderOptions,\n MarkdownRendererProps as _MarkdownRendererProps,\n RenderMarkdownProps as _RenderMarkdownProps,\n} from './markdown';\nimport {\n MarkdownProvider as _MarkdownProvider,\n MarkdownRenderer as _MarkdownRenderer,\n renderMarkdown as _renderMarkdown,\n useMarkdownContext as _useMarkdownContext,\n useMarkdownRenderer as _useMarkdownRenderer,\n} from './markdown';\n\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const MarkdownProvider = _MarkdownProvider;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const useMarkdownContext = _useMarkdownContext;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport type MarkdownProviderOptions = _MarkdownProviderOptions;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const renderMarkdown = _renderMarkdown;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const useMarkdownRenderer = _useMarkdownRenderer;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport const MarkdownRenderer = _MarkdownRenderer;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport type RenderMarkdownProps = _RenderMarkdownProps;\n/**\n * @deprecated import from next-intlayer/markdown instead\n */\nexport type MarkdownRendererProps = _MarkdownRendererProps;\n"],"mappings":";;;;;;;;;;;;;AAuDA,MAAa,2DAAmBA;;;;AAIhC,MAAa,6DAAqBC;;;;AAQlC,MAAa,yDAAiBC;;;;AAI9B,MAAa,8DAAsBC;;;;AAInC,MAAa,2DAAmBC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_client_IntlayerClientProvider = require('../client/IntlayerClientProvider.cjs');
|
|
3
|
+
const require_client_usePathname = require('../client/usePathname.cjs');
|
|
4
|
+
const require_client_useLocalePageRouter = require('../client/useLocalePageRouter.cjs');
|
|
5
|
+
const require_generateStaticParams = require('../generateStaticParams.cjs');
|
|
6
|
+
const require_server_IntlayerProvider = require('../server/IntlayerProvider.cjs');
|
|
7
|
+
const require_server_t = require('../server/t.cjs');
|
|
8
|
+
const require_server_useDictionary = require('../server/useDictionary.cjs');
|
|
9
|
+
const require_server_useDictionaryAsync = require('../server/useDictionaryAsync.cjs');
|
|
10
|
+
const require_server_useDictionaryDynamic = require('../server/useDictionaryDynamic.cjs');
|
|
11
|
+
const require_server_useI18n = require('../server/useI18n.cjs');
|
|
12
|
+
const require_server_useIntl = require('../server/useIntl.cjs');
|
|
13
|
+
const require_server_useIntlayer = require('../server/useIntlayer.cjs');
|
|
14
|
+
const require_server_useLocale = require('../server/useLocale.cjs');
|
|
15
|
+
let react_intlayer = require("react-intlayer");
|
|
16
|
+
let react_intlayer_server = require("react-intlayer/server");
|
|
17
|
+
|
|
18
|
+
Object.defineProperty(exports, 'IntlayerClientContext', {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return react_intlayer.IntlayerClientContext;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
exports.IntlayerClientProvider = require_client_IntlayerClientProvider.IntlayerClientProvider;
|
|
25
|
+
exports.IntlayerProvider = require_server_IntlayerProvider.IntlayerProvider;
|
|
26
|
+
exports.generateStaticParams = require_generateStaticParams.generateStaticParams;
|
|
27
|
+
Object.defineProperty(exports, 'getDictionary', {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () {
|
|
30
|
+
return react_intlayer.getDictionary;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
Object.defineProperty(exports, 'getIntlayer', {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return react_intlayer.getIntlayer;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, 'localeCookie', {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return react_intlayer.localeCookie;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports, 'localeInStorage', {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () {
|
|
48
|
+
return react_intlayer.localeInStorage;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports, 'setLocaleCookie', {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return react_intlayer.setLocaleCookie;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(exports, 'setLocaleInStorage', {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: function () {
|
|
60
|
+
return react_intlayer.setLocaleInStorage;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
exports.t = require_server_t.t;
|
|
64
|
+
exports.useDictionary = require_server_useDictionary.useDictionary;
|
|
65
|
+
exports.useDictionaryAsync = require_server_useDictionaryAsync.useDictionaryAsync;
|
|
66
|
+
exports.useDictionaryDynamic = require_server_useDictionaryDynamic.useDictionaryDynamic;
|
|
67
|
+
exports.useI18n = require_server_useI18n.useI18n;
|
|
68
|
+
exports.useIntl = require_server_useIntl.useIntl;
|
|
69
|
+
exports.useIntlayer = require_server_useIntlayer.useIntlayer;
|
|
70
|
+
Object.defineProperty(exports, 'useLoadDynamic', {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: function () {
|
|
73
|
+
return react_intlayer_server.useLoadDynamic;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
exports.useLocale = require_server_useLocale.useLocale;
|
|
77
|
+
Object.defineProperty(exports, 'useLocaleCookie', {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function () {
|
|
80
|
+
return react_intlayer.useLocaleCookie;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
exports.useLocalePageRouter = require_client_useLocalePageRouter.useLocalePageRouter;
|
|
84
|
+
Object.defineProperty(exports, 'useLocaleStorage', {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return react_intlayer.useLocaleStorage;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
exports.usePathname = require_client_usePathname.usePathname;
|
|
91
|
+
Object.defineProperty(exports, 'useRewriteURL', {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () {
|
|
94
|
+
return react_intlayer.useRewriteURL;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_client_IntlayerClientProvider = require('../client/IntlayerClientProvider.cjs');
|
|
3
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
4
|
+
let react_intlayer_server = require("react-intlayer/server");
|
|
5
|
+
|
|
6
|
+
//#region src/server/IntlayerProvider.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Unified Intlayer provider for the Next.js App Router.
|
|
9
|
+
*
|
|
10
|
+
* Server component that seeds the request-scoped server context (locale and
|
|
11
|
+
* ambient variant) read by the server hooks, and mounts the client provider so
|
|
12
|
+
* client components receive the same values — one provider for both halves.
|
|
13
|
+
*
|
|
14
|
+
* Mount it once, in the locale layout:
|
|
15
|
+
*
|
|
16
|
+
* ```tsx
|
|
17
|
+
* import { IntlayerProvider } from 'next-intlayer/server';
|
|
18
|
+
*
|
|
19
|
+
* const LocaleLayout: NextLayoutIntlayer = async ({ children, params }) => {
|
|
20
|
+
* const { locale } = await params;
|
|
21
|
+
*
|
|
22
|
+
* return (
|
|
23
|
+
* <IntlayerProvider locale={locale}>
|
|
24
|
+
* <html lang={locale}>
|
|
25
|
+
* <body>{children}</body>
|
|
26
|
+
* </html>
|
|
27
|
+
* </IntlayerProvider>
|
|
28
|
+
* );
|
|
29
|
+
* };
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* The server context is request-scoped, not tree-scoped: on client-side
|
|
33
|
+
* navigations that only re-render the page segment, the layout — and with it
|
|
34
|
+
* this provider — does not re-run. The server hooks then fall back to the
|
|
35
|
+
* locale carried by the request (the `x-intlayer-locale` header set by the
|
|
36
|
+
* intlayer proxy, then the locale cookie), so content stays correct without a
|
|
37
|
+
* per-page provider. The ambient `variant` has no request-carried fallback:
|
|
38
|
+
* seed it per request with `setVariant` when server components read it outside
|
|
39
|
+
* a full render of this provider.
|
|
40
|
+
*/
|
|
41
|
+
const IntlayerProvider = ({ children, locale, variant, ...clientProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_intlayer_server.IntlayerServerProvider, {
|
|
42
|
+
locale,
|
|
43
|
+
variant,
|
|
44
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_client_IntlayerClientProvider.IntlayerClientProvider, {
|
|
45
|
+
locale,
|
|
46
|
+
variant,
|
|
47
|
+
...clientProps,
|
|
48
|
+
children
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
exports.IntlayerProvider = IntlayerProvider;
|
|
54
|
+
//# sourceMappingURL=IntlayerProvider.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntlayerProvider.cjs","names":["IntlayerServerProvider","IntlayerClientProvider"],"sources":["../../../src/server/IntlayerProvider.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport type { IntlayerProviderProps as IntlayerClientProviderProps } from 'react-intlayer';\nimport {\n IntlayerServerProvider,\n type IntlayerServerProviderProps,\n} from 'react-intlayer/server';\nimport { IntlayerClientProvider } from '../client/IntlayerClientProvider';\n\nexport type IntlayerProviderProps = IntlayerClientProviderProps &\n IntlayerServerProviderProps;\n\n/**\n * Unified Intlayer provider for the Next.js App Router.\n *\n * Server component that seeds the request-scoped server context (locale and\n * ambient variant) read by the server hooks, and mounts the client provider so\n * client components receive the same values — one provider for both halves.\n *\n * Mount it once, in the locale layout:\n *\n * ```tsx\n * import { IntlayerProvider } from 'next-intlayer/server';\n *\n * const LocaleLayout: NextLayoutIntlayer = async ({ children, params }) => {\n * const { locale } = await params;\n *\n * return (\n * <IntlayerProvider locale={locale}>\n * <html lang={locale}>\n * <body>{children}</body>\n * </html>\n * </IntlayerProvider>\n * );\n * };\n * ```\n *\n * The server context is request-scoped, not tree-scoped: on client-side\n * navigations that only re-render the page segment, the layout — and with it\n * this provider — does not re-run. The server hooks then fall back to the\n * locale carried by the request (the `x-intlayer-locale` header set by the\n * intlayer proxy, then the locale cookie), so content stays correct without a\n * per-page provider. The ambient `variant` has no request-carried fallback:\n * seed it per request with `setVariant` when server components read it outside\n * a full render of this provider.\n */\nexport const IntlayerProvider: FC<IntlayerProviderProps> = ({\n children,\n locale,\n variant,\n ...clientProps\n}) => (\n <IntlayerServerProvider locale={locale} variant={variant}>\n <IntlayerClientProvider locale={locale} variant={variant} {...clientProps}>\n {children}\n </IntlayerClientProvider>\n </IntlayerServerProvider>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAa,oBAA+C,EAC1D,UACA,QACA,SACA,GAAG,kBAEH,2CAACA,8CAAD;CAAgC;CAAiB;WAC/C,2CAACC,8DAAD;EAAgC;EAAiB;EAAS,GAAI;EAC3D;CACqB;AACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let react_intlayer_server = require("react-intlayer/server");
|
|
3
|
+
|
|
4
|
+
//#region src/server/IntlayerServerProvider.ts
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use `IntlayerProvider` from `next-intlayer/server` instead — and
|
|
7
|
+
* in most trees, no replacement at all. Mounting `IntlayerProvider` once in the
|
|
8
|
+
* locale layout already seeds both the server context and the client provider
|
|
9
|
+
* for every page below it, and the server hooks fall back to the locale carried
|
|
10
|
+
* by the request when the layout is skipped on client-side navigations. This
|
|
11
|
+
* component's only remaining use is a page that must seed the locale itself
|
|
12
|
+
* (statically rendered routes on Next.js < 16); prefer the imperative
|
|
13
|
+
* `setLocale` over wrapping the tree even there.
|
|
14
|
+
*
|
|
15
|
+
* ```tsx
|
|
16
|
+
* import { IntlayerProvider } from 'next-intlayer/server';
|
|
17
|
+
*
|
|
18
|
+
* const LocaleLayout = async ({ children, params }) => {
|
|
19
|
+
* const { locale } = await params;
|
|
20
|
+
*
|
|
21
|
+
* return <IntlayerProvider locale={locale}>{children}</IntlayerProvider>;
|
|
22
|
+
* };
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
const IntlayerServerProvider = react_intlayer_server.IntlayerServerProvider;
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.IntlayerServerProvider = IntlayerServerProvider;
|
|
29
|
+
//# sourceMappingURL=IntlayerServerProvider.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IntlayerServerProvider.cjs","names":["IntlayerServerProviderBase"],"sources":["../../../src/server/IntlayerServerProvider.ts"],"sourcesContent":["import {\n IntlayerServerProvider as IntlayerServerProviderBase,\n type IntlayerServerProviderProps as IntlayerServerProviderPropsBase,\n} from 'react-intlayer/server';\n\n/**\n * @deprecated Use `IntlayerProviderProps` from `next-intlayer/server` instead.\n */\nexport type IntlayerServerProviderProps = IntlayerServerProviderPropsBase;\n\n/**\n * @deprecated Use `IntlayerProvider` from `next-intlayer/server` instead — and\n * in most trees, no replacement at all. Mounting `IntlayerProvider` once in the\n * locale layout already seeds both the server context and the client provider\n * for every page below it, and the server hooks fall back to the locale carried\n * by the request when the layout is skipped on client-side navigations. This\n * component's only remaining use is a page that must seed the locale itself\n * (statically rendered routes on Next.js < 16); prefer the imperative\n * `setLocale` over wrapping the tree even there.\n *\n * ```tsx\n * import { IntlayerProvider } from 'next-intlayer/server';\n *\n * const LocaleLayout = async ({ children, params }) => {\n * const { locale } = await params;\n *\n * return <IntlayerProvider locale={locale}>{children}</IntlayerProvider>;\n * };\n * ```\n */\nexport const IntlayerServerProvider = IntlayerServerProviderBase;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,yBAAyBA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_server_getLocale = require('./getLocale.cjs');
|
|
3
|
+
const require_server_suspendingReader = require('./suspendingReader.cjs');
|
|
4
|
+
let react_intlayer_server = require("react-intlayer/server");
|
|
5
|
+
|
|
6
|
+
//#region src/server/ambientLocale.ts
|
|
7
|
+
/**
|
|
8
|
+
* Whether the call site already carries a locale — either a plain locale
|
|
9
|
+
* argument or a selector object with an explicit `locale` field.
|
|
10
|
+
*/
|
|
11
|
+
const hasExplicitLocale = (localeOrSelector) => typeof localeOrSelector === "string" || typeof localeOrSelector === "object" && localeOrSelector !== null && Boolean(localeOrSelector.locale);
|
|
12
|
+
/**
|
|
13
|
+
* Whether the request-derived locale is worth reading at all.
|
|
14
|
+
*
|
|
15
|
+
* The base hooks in `react-intlayer/server` already prefer, in order, the
|
|
16
|
+
* locale passed at the call site and the request-scoped server context seeded
|
|
17
|
+
* by `IntlayerProvider`; they only fall back to the third argument these
|
|
18
|
+
* helpers produce. Reading request storage means calling `headers()` /
|
|
19
|
+
* `cookies()`, which opts the route into dynamic rendering — so it must stay
|
|
20
|
+
* behind both of those, and never run when either already answers.
|
|
21
|
+
*/
|
|
22
|
+
const needsRequestLocale = (localeOrSelector) => !hasExplicitLocale(localeOrSelector) && !(0, react_intlayer_server.getServerContext)(react_intlayer_server.IntlayerServer);
|
|
23
|
+
/**
|
|
24
|
+
* Reads the locale carried by the request: the `x-intlayer-locale` header set
|
|
25
|
+
* by the intlayer proxy, then the locale cookie, then `accept-language`.
|
|
26
|
+
*
|
|
27
|
+
* Errors are not swallowed — during prerendering Next.js relies on the throw
|
|
28
|
+
* from `headers()` to mark the route dynamic.
|
|
29
|
+
*/
|
|
30
|
+
const readStoredLocale = require_server_suspendingReader.createSuspendingReader(require_server_getLocale.getLocale);
|
|
31
|
+
/**
|
|
32
|
+
* Fallback locale for the synchronous server hooks, so a page does not need a
|
|
33
|
+
* provider of its own. Not a React hook despite suspending — it holds no
|
|
34
|
+
* positional state, which is what lets it run conditionally (see
|
|
35
|
+
* {@link createSuspendingReader}): on a client-side navigation that re-renders only the
|
|
36
|
+
* page segment, the layout — and with it `IntlayerProvider` — does not re-run,
|
|
37
|
+
* and the locale carried by the request takes over.
|
|
38
|
+
*
|
|
39
|
+
* Suspends until the request storage resolves. Returns `undefined` when the
|
|
40
|
+
* call site or the server context already carries the locale.
|
|
41
|
+
*/
|
|
42
|
+
const resolveFallbackLocale = (localeOrSelector) => needsRequestLocale(localeOrSelector) ? readStoredLocale() : void 0;
|
|
43
|
+
/**
|
|
44
|
+
* Asynchronous twin of {@link resolveFallbackLocale}, for the hooks that are
|
|
45
|
+
* already async and can await the request storage instead of suspending on it.
|
|
46
|
+
*/
|
|
47
|
+
const getFallbackLocale = async (localeOrSelector) => needsRequestLocale(localeOrSelector) ? await require_server_getLocale.getLocale() : void 0;
|
|
48
|
+
/**
|
|
49
|
+
* Full ambient locale for the server APIs that take a plain locale argument
|
|
50
|
+
* (or none at all): call site → server context → locale carried by the
|
|
51
|
+
* request.
|
|
52
|
+
*
|
|
53
|
+
* {@link resolveFallbackLocale} only yields the last rung, because the base hooks
|
|
54
|
+
* in `react-intlayer/server` consult the first two themselves. The APIs
|
|
55
|
+
* reimplemented here have no such fallback slot, so they need the resolved
|
|
56
|
+
* value.
|
|
57
|
+
*/
|
|
58
|
+
const resolveAmbientLocale = (locale) => locale ?? (0, react_intlayer_server.getServerContext)(react_intlayer_server.IntlayerServer) ?? resolveFallbackLocale(locale);
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
exports.getFallbackLocale = getFallbackLocale;
|
|
62
|
+
exports.resolveAmbientLocale = resolveAmbientLocale;
|
|
63
|
+
exports.resolveFallbackLocale = resolveFallbackLocale;
|
|
64
|
+
//# sourceMappingURL=ambientLocale.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ambientLocale.cjs","names":["getServerContext","IntlayerServer","createSuspendingReader","getLocale"],"sources":["../../../src/server/ambientLocale.ts"],"sourcesContent":["import type { Locale } from '@intlayer/types/allLocales';\nimport type { LocalesValues } from '@intlayer/types/module_augmentation';\nimport { getServerContext, IntlayerServer } from 'react-intlayer/server';\nimport { getLocale } from './getLocale';\nimport { createSuspendingReader } from './suspendingReader';\n\n/**\n * Whether the call site already carries a locale — either a plain locale\n * argument or a selector object with an explicit `locale` field.\n */\nconst hasExplicitLocale = (localeOrSelector?: unknown): boolean =>\n typeof localeOrSelector === 'string' ||\n (typeof localeOrSelector === 'object' &&\n localeOrSelector !== null &&\n Boolean((localeOrSelector as { locale?: unknown }).locale));\n\n/**\n * Whether the request-derived locale is worth reading at all.\n *\n * The base hooks in `react-intlayer/server` already prefer, in order, the\n * locale passed at the call site and the request-scoped server context seeded\n * by `IntlayerProvider`; they only fall back to the third argument these\n * helpers produce. Reading request storage means calling `headers()` /\n * `cookies()`, which opts the route into dynamic rendering — so it must stay\n * behind both of those, and never run when either already answers.\n */\nconst needsRequestLocale = (localeOrSelector?: unknown): boolean =>\n !hasExplicitLocale(localeOrSelector) && !getServerContext(IntlayerServer);\n\n/**\n * Reads the locale carried by the request: the `x-intlayer-locale` header set\n * by the intlayer proxy, then the locale cookie, then `accept-language`.\n *\n * Errors are not swallowed — during prerendering Next.js relies on the throw\n * from `headers()` to mark the route dynamic.\n */\nconst readStoredLocale = createSuspendingReader<Locale>(getLocale);\n\n/**\n * Fallback locale for the synchronous server hooks, so a page does not need a\n * provider of its own. Not a React hook despite suspending — it holds no\n * positional state, which is what lets it run conditionally (see\n * {@link createSuspendingReader}): on a client-side navigation that re-renders only the\n * page segment, the layout — and with it `IntlayerProvider` — does not re-run,\n * and the locale carried by the request takes over.\n *\n * Suspends until the request storage resolves. Returns `undefined` when the\n * call site or the server context already carries the locale.\n */\nexport const resolveFallbackLocale = (\n localeOrSelector?: unknown\n): Locale | undefined =>\n needsRequestLocale(localeOrSelector) ? readStoredLocale() : undefined;\n\n/**\n * Asynchronous twin of {@link resolveFallbackLocale}, for the hooks that are\n * already async and can await the request storage instead of suspending on it.\n */\nexport const getFallbackLocale = async (\n localeOrSelector?: unknown\n): Promise<Locale | undefined> =>\n needsRequestLocale(localeOrSelector) ? await getLocale() : undefined;\n\n/**\n * Full ambient locale for the server APIs that take a plain locale argument\n * (or none at all): call site → server context → locale carried by the\n * request.\n *\n * {@link resolveFallbackLocale} only yields the last rung, because the base hooks\n * in `react-intlayer/server` consult the first two themselves. The APIs\n * reimplemented here have no such fallback slot, so they need the resolved\n * value.\n */\nexport const resolveAmbientLocale = (\n locale?: LocalesValues\n): LocalesValues | undefined =>\n locale ??\n getServerContext<LocalesValues>(IntlayerServer) ??\n resolveFallbackLocale(locale);\n"],"mappings":";;;;;;;;;;AAUA,MAAM,qBAAqB,qBACzB,OAAO,qBAAqB,YAC3B,OAAO,qBAAqB,YAC3B,qBAAqB,QACrB,QAAS,iBAA0C,MAAM;;;;;;;;;;;AAY7D,MAAM,sBAAsB,qBAC1B,CAAC,kBAAkB,gBAAgB,KAAK,KAACA,wCAAiBC,oCAAc;;;;;;;;AAS1E,MAAM,mBAAmBC,uDAA+BC,kCAAS;;;;;;;;;;;;AAajE,MAAa,yBACX,qBAEA,mBAAmB,gBAAgB,IAAI,iBAAiB,IAAI;;;;;AAM9D,MAAa,oBAAoB,OAC/B,qBAEA,mBAAmB,gBAAgB,IAAI,MAAMA,mCAAU,IAAI;;;;;;;;;;;AAY7D,MAAa,wBACX,WAEA,cACAH,wCAAgCC,oCAAc,KAC9C,sBAAsB,MAAM"}
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_server_format_useUnit = require('./useUnit.cjs');
|
|
3
|
+
const require_server_format_useDate = require('./useDate.cjs');
|
|
4
|
+
const require_server_format_useNumber = require('./useNumber.cjs');
|
|
5
|
+
const require_server_format_useRelativeTime = require('./useRelativeTime.cjs');
|
|
6
|
+
const require_server_format_useCompact = require('./useCompact.cjs');
|
|
7
|
+
const require_server_format_useList = require('./useList.cjs');
|
|
8
|
+
const require_server_format_usePercentage = require('./usePercentage.cjs');
|
|
9
|
+
const require_server_format_useCurrency = require('./useCurrency.cjs');
|
|
1
10
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
exports.useCompact = require_server_format_useCompact.useCompact;
|
|
12
|
+
exports.useCurrency = require_server_format_useCurrency.useCurrency;
|
|
13
|
+
exports.useDate = require_server_format_useDate.useDate;
|
|
14
|
+
exports.useList = require_server_format_useList.useList;
|
|
15
|
+
exports.useNumber = require_server_format_useNumber.useNumber;
|
|
16
|
+
exports.usePercentage = require_server_format_usePercentage.usePercentage;
|
|
17
|
+
exports.useRelativeTime = require_server_format_useRelativeTime.useRelativeTime;
|
|
18
|
+
exports.useUnit = require_server_format_useUnit.useUnit;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_server_ambientLocale = require('../ambientLocale.cjs');
|
|
3
|
+
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
4
|
+
|
|
5
|
+
//#region src/server/format/useCompact.ts
|
|
6
|
+
/**
|
|
7
|
+
* On the server side, hook returning a `compact` formatter bound to the ambient
|
|
8
|
+
* locale: the server context, falling back to the locale carried by the
|
|
9
|
+
* request. A per-call `locale` option still wins.
|
|
10
|
+
*
|
|
11
|
+
* Reimplemented rather than re-exported from `react-intlayer/server/format`:
|
|
12
|
+
* that one takes no locale argument, so there is no way to hand it the ambient
|
|
13
|
+
* locale — it would read the server context alone and format with the default
|
|
14
|
+
* locale on any render the provider did not reach.
|
|
15
|
+
*/
|
|
16
|
+
const useCompact = () => {
|
|
17
|
+
const locale = require_server_ambientLocale.resolveAmbientLocale();
|
|
18
|
+
return (...args) => (0, _intlayer_core_formatters.compact)(args[0], {
|
|
19
|
+
...args[1],
|
|
20
|
+
locale: args[1]?.locale ?? locale
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.useCompact = useCompact;
|
|
26
|
+
//# sourceMappingURL=useCompact.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCompact.cjs","names":["resolveAmbientLocale","compact"],"sources":["../../../../src/server/format/useCompact.ts"],"sourcesContent":["import { compact } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `compact` formatter bound to the ambient\n * locale: the server context, falling back to the locale carried by the\n * request. A per-call `locale` option still wins.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server/format`:\n * that one takes no locale argument, so there is no way to hand it the ambient\n * locale — it would read the server context alone and format with the default\n * locale on any render the provider did not reach.\n */\nexport const useCompact = () => {\n const locale = resolveAmbientLocale();\n\n return (...args: Parameters<typeof compact>) =>\n compact(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAa,mBAAmB;CAC9B,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,mCAAQ,KAAK,IAAI;EACf,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_server_ambientLocale = require('../ambientLocale.cjs');
|
|
3
|
+
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
4
|
+
|
|
5
|
+
//#region src/server/format/useCurrency.ts
|
|
6
|
+
/**
|
|
7
|
+
* On the server side, hook returning a `currency` formatter bound to the ambient
|
|
8
|
+
* locale: the server context, falling back to the locale carried by the
|
|
9
|
+
* request. A per-call `locale` option still wins.
|
|
10
|
+
*
|
|
11
|
+
* Reimplemented rather than re-exported from `react-intlayer/server/format`:
|
|
12
|
+
* that one takes no locale argument, so there is no way to hand it the ambient
|
|
13
|
+
* locale — it would read the server context alone and format with the default
|
|
14
|
+
* locale on any render the provider did not reach.
|
|
15
|
+
*/
|
|
16
|
+
const useCurrency = () => {
|
|
17
|
+
const locale = require_server_ambientLocale.resolveAmbientLocale();
|
|
18
|
+
return (...args) => (0, _intlayer_core_formatters.currency)(args[0], {
|
|
19
|
+
...args[1],
|
|
20
|
+
locale: args[1]?.locale ?? locale
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.useCurrency = useCurrency;
|
|
26
|
+
//# sourceMappingURL=useCurrency.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCurrency.cjs","names":["resolveAmbientLocale","currency"],"sources":["../../../../src/server/format/useCurrency.ts"],"sourcesContent":["import { currency } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `currency` formatter bound to the ambient\n * locale: the server context, falling back to the locale carried by the\n * request. A per-call `locale` option still wins.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server/format`:\n * that one takes no locale argument, so there is no way to hand it the ambient\n * locale — it would read the server context alone and format with the default\n * locale on any render the provider did not reach.\n */\nexport const useCurrency = () => {\n const locale = resolveAmbientLocale();\n\n return (...args: Parameters<typeof currency>) =>\n currency(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAa,oBAAoB;CAC/B,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,oCAAS,KAAK,IAAI;EAChB,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_server_ambientLocale = require('../ambientLocale.cjs');
|
|
3
|
+
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
4
|
+
|
|
5
|
+
//#region src/server/format/useDate.ts
|
|
6
|
+
/**
|
|
7
|
+
* On the server side, hook returning a `date` formatter bound to the ambient
|
|
8
|
+
* locale: the server context, falling back to the locale carried by the
|
|
9
|
+
* request. A per-call `locale` option still wins.
|
|
10
|
+
*
|
|
11
|
+
* Reimplemented rather than re-exported from `react-intlayer/server/format`:
|
|
12
|
+
* that one takes no locale argument, so there is no way to hand it the ambient
|
|
13
|
+
* locale — it would read the server context alone and format with the default
|
|
14
|
+
* locale on any render the provider did not reach.
|
|
15
|
+
*
|
|
16
|
+
* The options argument is either a preset name or an options object, so the
|
|
17
|
+
* preset is resolved before the locale is merged in — spreading the string
|
|
18
|
+
* itself would scatter its characters and drop the preset.
|
|
19
|
+
*/
|
|
20
|
+
const useDate = () => {
|
|
21
|
+
const locale = require_server_ambientLocale.resolveAmbientLocale();
|
|
22
|
+
return (...args) => (0, _intlayer_core_formatters.date)(args[0], typeof args[1] === "string" ? {
|
|
23
|
+
..._intlayer_core_formatters.presets[args[1]],
|
|
24
|
+
locale
|
|
25
|
+
} : {
|
|
26
|
+
...args[1],
|
|
27
|
+
locale: args[1]?.locale ?? locale
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
exports.useDate = useDate;
|
|
33
|
+
//# sourceMappingURL=useDate.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDate.cjs","names":["resolveAmbientLocale","date","presets"],"sources":["../../../../src/server/format/useDate.ts"],"sourcesContent":["import { date, presets } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `date` formatter bound to the ambient\n * locale: the server context, falling back to the locale carried by the\n * request. A per-call `locale` option still wins.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server/format`:\n * that one takes no locale argument, so there is no way to hand it the ambient\n * locale — it would read the server context alone and format with the default\n * locale on any render the provider did not reach.\n *\n * The options argument is either a preset name or an options object, so the\n * preset is resolved before the locale is merged in — spreading the string\n * itself would scatter its characters and drop the preset.\n */\nexport const useDate = () => {\n const locale = resolveAmbientLocale();\n\n return (...args: Parameters<typeof date>) =>\n date(\n args[0],\n typeof args[1] === 'string'\n ? { ...presets[args[1]], locale }\n : { ...args[1], locale: args[1]?.locale ?? locale }\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,gCACE,KAAK,IACL,OAAO,KAAK,OAAO,WACf;EAAE,GAAGC,kCAAQ,KAAK;EAAK;CAAO,IAC9B;EAAE,GAAG,KAAK;EAAI,QAAQ,KAAK,EAAE,EAAE,UAAU;CAAO,CACtD;AACJ"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_server_ambientLocale = require('../ambientLocale.cjs');
|
|
3
|
+
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
4
|
+
|
|
5
|
+
//#region src/server/format/useList.ts
|
|
6
|
+
/**
|
|
7
|
+
* On the server side, hook returning a `list` formatter bound to the ambient
|
|
8
|
+
* locale: the server context, falling back to the locale carried by the
|
|
9
|
+
* request. A per-call `locale` option still wins.
|
|
10
|
+
*
|
|
11
|
+
* Reimplemented rather than re-exported from `react-intlayer/server/format`:
|
|
12
|
+
* that one takes no locale argument, so there is no way to hand it the ambient
|
|
13
|
+
* locale — it would read the server context alone and format with the default
|
|
14
|
+
* locale on any render the provider did not reach.
|
|
15
|
+
*/
|
|
16
|
+
const useList = () => {
|
|
17
|
+
const locale = require_server_ambientLocale.resolveAmbientLocale();
|
|
18
|
+
return (...args) => (0, _intlayer_core_formatters.list)(args[0], {
|
|
19
|
+
...args[1],
|
|
20
|
+
locale: args[1]?.locale ?? locale
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.useList = useList;
|
|
26
|
+
//# sourceMappingURL=useList.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useList.cjs","names":["resolveAmbientLocale","list"],"sources":["../../../../src/server/format/useList.ts"],"sourcesContent":["import { list } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `list` formatter bound to the ambient\n * locale: the server context, falling back to the locale carried by the\n * request. A per-call `locale` option still wins.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server/format`:\n * that one takes no locale argument, so there is no way to hand it the ambient\n * locale — it would read the server context alone and format with the default\n * locale on any render the provider did not reach.\n */\nexport const useList = () => {\n const locale = resolveAmbientLocale();\n\n return (...args: Parameters<typeof list>) =>\n list(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,gCAAK,KAAK,IAAI;EACZ,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_server_ambientLocale = require('../ambientLocale.cjs');
|
|
3
|
+
let _intlayer_core_formatters = require("@intlayer/core/formatters");
|
|
4
|
+
|
|
5
|
+
//#region src/server/format/useNumber.ts
|
|
6
|
+
/**
|
|
7
|
+
* On the server side, hook returning a `number` formatter bound to the ambient
|
|
8
|
+
* locale: the server context, falling back to the locale carried by the
|
|
9
|
+
* request. A per-call `locale` option still wins.
|
|
10
|
+
*
|
|
11
|
+
* Reimplemented rather than re-exported from `react-intlayer/server/format`:
|
|
12
|
+
* that one takes no locale argument, so there is no way to hand it the ambient
|
|
13
|
+
* locale — it would read the server context alone and format with the default
|
|
14
|
+
* locale on any render the provider did not reach.
|
|
15
|
+
*/
|
|
16
|
+
const useNumber = () => {
|
|
17
|
+
const locale = require_server_ambientLocale.resolveAmbientLocale();
|
|
18
|
+
return (...args) => (0, _intlayer_core_formatters.number)(args[0], {
|
|
19
|
+
...args[1],
|
|
20
|
+
locale: args[1]?.locale ?? locale
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.useNumber = useNumber;
|
|
26
|
+
//# sourceMappingURL=useNumber.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNumber.cjs","names":["resolveAmbientLocale","number"],"sources":["../../../../src/server/format/useNumber.ts"],"sourcesContent":["import { number } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `number` formatter bound to the ambient\n * locale: the server context, falling back to the locale carried by the\n * request. A per-call `locale` option still wins.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server/format`:\n * that one takes no locale argument, so there is no way to hand it the ambient\n * locale — it would read the server context alone and format with the default\n * locale on any render the provider did not reach.\n */\nexport const useNumber = () => {\n const locale = resolveAmbientLocale();\n\n return (...args: Parameters<typeof number>) =>\n number(args[0], {\n ...args[1],\n locale: args[1]?.locale ?? locale,\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAa,kBAAkB;CAC7B,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,kCAAO,KAAK,IAAI;EACd,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}
|