next-intlayer 9.7.1 → 9.7.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.
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +4 -4
- package/dist/cjs/client/IntlayerClientProvider.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/markdown/index.cjs +1 -1
- package/dist/cjs/proxy/intlayerProxy.cjs +2 -2
- package/dist/cjs/server/getLocale.cjs +1 -1
- package/dist/cjs/server/suspendingReader.cjs.map +1 -1
- package/dist/cjs/server/useDictionary.cjs.map +1 -1
- package/dist/esm/_virtual/_rolldown/runtime.mjs +4 -4
- package/dist/esm/client/IntlayerClientProvider.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/markdown/index.mjs +1 -1
- package/dist/esm/proxy/intlayerProxy.mjs +1 -1
- package/dist/esm/server/getLocale.mjs +1 -1
- package/dist/esm/server/suspendingReader.mjs.map +1 -1
- package/dist/esm/server/useDictionary.mjs.map +1 -1
- package/dist/types/client/IntlayerClientProvider.d.ts +1 -1
- package/dist/types/client/IntlayerClientProvider.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/markdown/index.d.ts.map +1 -1
- package/dist/types/rsc/index.d.ts +31 -0
- package/dist/types/server/IntlayerProvider.d.ts +1 -1
- package/dist/types/server/prepareSwcOptimization.d.ts +1 -1
- package/dist/types/server/useDictionary.d.ts.map +1 -1
- package/package.json +56 -56
|
@@ -5,18 +5,18 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __exportAll = (all,
|
|
9
|
-
let target = {};
|
|
8
|
+
var __exportAll = (all, flags) => {
|
|
9
|
+
let target = Object.setPrototypeOf({}, null);
|
|
10
10
|
for (var name in all) {
|
|
11
11
|
__defProp(target, name, {
|
|
12
12
|
get: all[name],
|
|
13
13
|
enumerable: true
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
if (!
|
|
16
|
+
if (!(flags & 1)) {
|
|
17
17
|
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
18
18
|
}
|
|
19
|
-
return target;
|
|
19
|
+
return flags & 2 ? target : Object.preventExtensions(target);
|
|
20
20
|
};
|
|
21
21
|
var __copyProps = (to, from, except, desc) => {
|
|
22
22
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerClientProvider.cjs","names":["IntlayerProvider"],"sources":["../../../src/client/IntlayerClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport type { FC } from 'react';\
|
|
1
|
+
{"version":3,"file":"IntlayerClientProvider.cjs","names":["IntlayerProvider"],"sources":["../../../src/client/IntlayerClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport type { FC } from 'react';\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 *\n * Mount `IntlayerProvider` once in the locale layout seeds both server and client contexts\n *\n * ```tsx\n * import { IntlayerProvider } from 'next-intlayer';\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":";;;;;;;;;;;;;;;;;AAoBA,MAAa,8BACX,UACG,2CAACA,iCAAD,EAAkB,GAAI,MAAQ;;;;;;;;;;;;;;;;AAiBnC,MAAa,yBAAyB"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_generateStaticParams = require("./generateStaticParams.cjs");
|
|
2
3
|
const require_client_IntlayerClientProvider = require("./client/IntlayerClientProvider.cjs");
|
|
3
4
|
const require_client_usePathname = require("./client/usePathname.cjs");
|
|
4
5
|
const require_client_useLocale = require("./client/useLocale.cjs");
|
|
5
6
|
const require_client_useLocalePageRouter = require("./client/useLocalePageRouter.cjs");
|
|
6
|
-
const require_generateStaticParams = require("./generateStaticParams.cjs");
|
|
7
7
|
const require_markdown_index = require("./markdown/index.cjs");
|
|
8
8
|
let react_intlayer = require("react-intlayer");
|
|
9
9
|
|
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
3
3
|
|
|
4
4
|
// src/markdown/index.ts
|
|
5
|
-
var markdown_exports = /* @__PURE__ */ require_runtime.__exportAll({});
|
|
5
|
+
var markdown_exports = /* @__PURE__ */ require_runtime.__exportAll({}, 2);
|
|
6
6
|
require_runtime.__reExport(markdown_exports, require("react-intlayer/markdown"));
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "markdown_exports", {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_proxy_localeDetector = require("./localeDetector.cjs");
|
|
3
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
3
4
|
let _intlayer_core_localization = require("@intlayer/core/localization");
|
|
4
5
|
let _intlayer_core_utils = require("@intlayer/core/utils");
|
|
5
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
6
6
|
let _intlayer_config_logger = require("@intlayer/config/logger");
|
|
7
|
-
let _intlayer_config_defaultValues = require("@intlayer/config/defaultValues");
|
|
8
7
|
let next_server = require("next/server");
|
|
8
|
+
let _intlayer_config_defaultValues = require("@intlayer/config/defaultValues");
|
|
9
9
|
|
|
10
10
|
// src/proxy/intlayerProxy.ts
|
|
11
11
|
const { locales, defaultLocale } = _intlayer_config_built.internationalization ?? {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let _intlayer_config_built = require("@intlayer/config/built");
|
|
2
3
|
let _intlayer_core_localization = require("@intlayer/core/localization");
|
|
3
4
|
let _intlayer_core_utils = require("@intlayer/core/utils");
|
|
4
|
-
let _intlayer_config_built = require("@intlayer/config/built");
|
|
5
5
|
let _intlayer_config_defaultValues = require("@intlayer/config/defaultValues");
|
|
6
6
|
let next_headers_js = require("next/headers.js");
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suspendingReader.cjs","names":["React"],"sources":["../../../src/server/suspendingReader.ts"],"sourcesContent":["import React from 'react';\n\ntype AsyncRungStore<T> = {\n status: 'pending' | 'resolved' | 'rejected';\n value?: T;\n error?: unknown;\n promise?: Promise<void>;\n};\n\n/**\n * Turns an async loader into a synchronous reader that suspends until the\n * value is available, without going through `React.use`.\n *\n * `React.use` matches its per-component state positionally across suspense\n * retries, so a `use()` call whose condition can change between attempts\n * (here: the server context is seeded by the provider concurrently with the\n * page render) shifts the index and hands a later `use()` — such as the\n * dynamic dictionary chunk loader — the wrong promise's value. Throwing the\n * promise ourselves and caching the settlement in a request-scoped store\n * keeps the suspension mechanics without touching React's positional state,\n * which makes the ambient chain safe to run conditionally.\n *\n * Requires `React.cache` for per-request isolation; without it (React < 19)\n * the reader reports `undefined` so callers fall back to the default locale,\n * matching the previous behavior.\n */\nexport const createSuspendingReader = <T>(\n load: () => Promise<T | undefined>\n): (() => T | undefined) => {\n if (typeof React.cache !== 'function') return () => undefined;\n\n const getStore = React.cache(
|
|
1
|
+
{"version":3,"file":"suspendingReader.cjs","names":["React"],"sources":["../../../src/server/suspendingReader.ts"],"sourcesContent":["import React from 'react';\n\ntype AsyncRungStore<T> = {\n status: 'pending' | 'resolved' | 'rejected';\n value?: T;\n error?: unknown;\n promise?: Promise<void>;\n};\n\n/**\n * Turns an async loader into a synchronous reader that suspends until the\n * value is available, without going through `React.use`.\n *\n * `React.use` matches its per-component state positionally across suspense\n * retries, so a `use()` call whose condition can change between attempts\n * (here: the server context is seeded by the provider concurrently with the\n * page render) shifts the index and hands a later `use()` — such as the\n * dynamic dictionary chunk loader — the wrong promise's value. Throwing the\n * promise ourselves and caching the settlement in a request-scoped store\n * keeps the suspension mechanics without touching React's positional state,\n * which makes the ambient chain safe to run conditionally.\n *\n * Requires `React.cache` for per-request isolation; without it (React < 19)\n * the reader reports `undefined` so callers fall back to the default locale,\n * matching the previous behavior.\n */\nexport const createSuspendingReader = <T>(\n load: () => Promise<T | undefined>\n): (() => T | undefined) => {\n if (typeof React.cache !== 'function') return () => undefined;\n\n const getStore = React.cache((): AsyncRungStore<T | undefined> => ({\n status: 'pending',\n }));\n\n return (): T | undefined => {\n const store = getStore();\n\n // Suspending is only safe when the store survives the retry: React replays\n // the component from the top, so a cache that hands back a fresh store\n // every call would restart the load and throw a new promise forever. That\n // is what `React.cache` degrades to outside a request scope — notably in\n // the SSR pass of client components, where it is a passthrough. Reporting\n // no value there lets the caller fall back instead of hanging the render.\n if (getStore() !== store) return undefined;\n\n if (store.status === 'resolved') return store.value;\n if (store.status === 'rejected') throw store.error;\n\n if (!store.promise) {\n store.promise = load().then(\n (value) => {\n store.value = value;\n store.status = 'resolved';\n },\n (error) => {\n store.error = error;\n store.status = 'rejected';\n }\n );\n }\n\n // Suspend: React retries the component once the promise settles.\n throw store.promise;\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,0BACX,SAC0B;CAC1B,IAAI,OAAOA,cAAM,UAAU,YAAY,aAAa;CAEpD,MAAM,WAAWA,cAAM,aAA4C,EACjE,QAAQ,UACV,EAAE;CAEF,aAA4B;EAC1B,MAAM,QAAQ,SAAS;EAQvB,IAAI,SAAS,MAAM,OAAO,OAAO;EAEjC,IAAI,MAAM,WAAW,YAAY,OAAO,MAAM;EAC9C,IAAI,MAAM,WAAW,YAAY,MAAM,MAAM;EAE7C,IAAI,CAAC,MAAM,SACT,MAAM,UAAU,KAAK,CAAC,CAAC,MACpB,UAAU;GACT,MAAM,QAAQ;GACd,MAAM,SAAS;EACjB,IACC,UAAU;GACT,MAAM,QAAQ;GACd,MAAM,SAAS;EACjB,CACF;EAIF,MAAM,MAAM;CACd;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.cjs","names":["resolveFallbackLocale","useDictionaryBase"],"sources":["../../../src/server/useDictionary.ts"],"sourcesContent":["import type {\n Dictionary,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useDictionary as useDictionaryBase } from 'react-intlayer/server';\nimport { resolveFallbackLocale } from './ambientLocale';\n\n/**\n * On the server side, hook that transforms a dictionary (or qualified\n * dictionary group) and returns the content for the given locale or selector.\n *\n * If the locale is not provided, it will use the locale from the server\n * context, falling back to the locale carried by the request.\n */\nexport const useDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends
|
|
1
|
+
{"version":3,"file":"useDictionary.cjs","names":["resolveFallbackLocale","useDictionaryBase"],"sources":["../../../src/server/useDictionary.ts"],"sourcesContent":["import type {\n Dictionary,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useDictionary as useDictionaryBase } from 'react-intlayer/server';\nimport { resolveFallbackLocale } from './ambientLocale';\n\n/**\n * On the server side, hook that transforms a dictionary (or qualified\n * dictionary group) and returns the content for the given locale or selector.\n *\n * If the locale is not provided, it will use the locale from the server\n * context, falling back to the locale carried by the request.\n */\nexport const useDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends LocalesValues | DictionarySelectorForGroup<T> =\n DeclaredLocales,\n>(\n dictionary: T,\n localeOrSelector?: A\n): ReturnType<typeof useDictionaryBase<T, A>> => {\n const fallbackLocale = resolveFallbackLocale(localeOrSelector);\n\n return useDictionaryBase<T, A>(dictionary, localeOrSelector, fallbackLocale);\n};\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAa,iBAKX,YACA,qBAC+C;CAC/C,MAAM,iBAAiBA,mDAAsB,gBAAgB;CAE7D,WAAOC,qCAAwB,YAAY,kBAAkB,cAAc;AAC7E"}
|
|
@@ -3,18 +3,18 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __exportAll = (all,
|
|
7
|
-
let target = {};
|
|
6
|
+
var __exportAll = (all, flags) => {
|
|
7
|
+
let target = Object.setPrototypeOf({}, null);
|
|
8
8
|
for (var name in all) {
|
|
9
9
|
__defProp(target, name, {
|
|
10
10
|
get: all[name],
|
|
11
11
|
enumerable: true
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
if (!
|
|
14
|
+
if (!(flags & 1)) {
|
|
15
15
|
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
16
16
|
}
|
|
17
|
-
return target;
|
|
17
|
+
return flags & 2 ? target : Object.preventExtensions(target);
|
|
18
18
|
};
|
|
19
19
|
var __copyProps = (to, from, except, desc) => {
|
|
20
20
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerClientProvider.mjs","names":[],"sources":["../../../src/client/IntlayerClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport type { FC } from 'react';\
|
|
1
|
+
{"version":3,"file":"IntlayerClientProvider.mjs","names":[],"sources":["../../../src/client/IntlayerClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport type { FC } from 'react';\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 *\n * Mount `IntlayerProvider` once in the locale layout seeds both server and client contexts\n *\n * ```tsx\n * import { IntlayerProvider } from 'next-intlayer';\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":";;;;;;;;;;;;;;;;AAoBA,MAAa,8BACX,UACG,oBAAC,kBAAD,EAAkB,GAAI,MAAQ;;;;;;;;;;;;;;;;AAiBnC,MAAa,yBAAyB"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { generateStaticParams } from "./generateStaticParams.mjs";
|
|
1
2
|
import { IntlayerClientProvider } from "./client/IntlayerClientProvider.mjs";
|
|
2
3
|
import { usePathname } from "./client/usePathname.mjs";
|
|
3
4
|
import { useLocale } from "./client/useLocale.mjs";
|
|
4
5
|
import { useLocalePageRouter } from "./client/useLocalePageRouter.mjs";
|
|
5
6
|
import { useRewriteURL } from "./client/useRewriteURL.mjs";
|
|
6
|
-
import { generateStaticParams } from "./generateStaticParams.mjs";
|
|
7
7
|
import { markdown_exports } from "./markdown/index.mjs";
|
|
8
8
|
import { IntlayerClientContext, IntlayerProvider, getDictionary, getIntlayer, localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, t, useConversion, useDictionary, useDictionaryAsync, useDictionaryDynamic, useExperiment, useI18n, useIntl, useIntlayer, useLoadDynamic, useLocaleCookie, useLocaleStorage } from "react-intlayer";
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import { __exportAll, __reExport } from "../_virtual/_rolldown/runtime.mjs";
|
|
|
3
3
|
export * from "react-intlayer/markdown"
|
|
4
4
|
|
|
5
5
|
// src/markdown/index.ts
|
|
6
|
-
var markdown_exports = /* @__PURE__ */ __exportAll({});
|
|
6
|
+
var markdown_exports = /* @__PURE__ */ __exportAll({}, 2);
|
|
7
7
|
import * as import_react_intlayer_markdown from "react-intlayer/markdown";
|
|
8
8
|
__reExport(markdown_exports, import_react_intlayer_markdown);
|
|
9
9
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { localeDetector as localeDetector$1 } from "./localeDetector.mjs";
|
|
2
|
+
import { internationalization, log, routing } from "@intlayer/config/built";
|
|
2
3
|
import { formatProxyEnabledMessage, getCanonicalPath, getDomainHostname, getDomainOrigin, getInternalPath, getLocaleFromDomain, getRewriteRules, isProxyStorageLocaleEnabled, resolveLocalizedPath, resolveProxyMode } from "@intlayer/core/localization";
|
|
3
4
|
import { getLocaleFromStorageServer, setLocaleInStorageServer } from "@intlayer/core/utils";
|
|
4
|
-
import { internationalization, log, routing } from "@intlayer/config/built";
|
|
5
5
|
import { getAppLogger } from "@intlayer/config/logger";
|
|
6
6
|
import { ROUTING_MODE } from "@intlayer/config/defaultValues";
|
|
7
7
|
import { NextResponse } from "next/server";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { internationalization } from "@intlayer/config/built";
|
|
1
2
|
import { localeDetector } from "@intlayer/core/localization";
|
|
2
3
|
import { getLocaleFromStorageServer } from "@intlayer/core/utils";
|
|
3
|
-
import { internationalization } from "@intlayer/config/built";
|
|
4
4
|
import { DEFAULT_LOCALE } from "@intlayer/config/defaultValues";
|
|
5
5
|
import { cookies, headers } from "next/headers.js";
|
|
6
6
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suspendingReader.mjs","names":[],"sources":["../../../src/server/suspendingReader.ts"],"sourcesContent":["import React from 'react';\n\ntype AsyncRungStore<T> = {\n status: 'pending' | 'resolved' | 'rejected';\n value?: T;\n error?: unknown;\n promise?: Promise<void>;\n};\n\n/**\n * Turns an async loader into a synchronous reader that suspends until the\n * value is available, without going through `React.use`.\n *\n * `React.use` matches its per-component state positionally across suspense\n * retries, so a `use()` call whose condition can change between attempts\n * (here: the server context is seeded by the provider concurrently with the\n * page render) shifts the index and hands a later `use()` — such as the\n * dynamic dictionary chunk loader — the wrong promise's value. Throwing the\n * promise ourselves and caching the settlement in a request-scoped store\n * keeps the suspension mechanics without touching React's positional state,\n * which makes the ambient chain safe to run conditionally.\n *\n * Requires `React.cache` for per-request isolation; without it (React < 19)\n * the reader reports `undefined` so callers fall back to the default locale,\n * matching the previous behavior.\n */\nexport const createSuspendingReader = <T>(\n load: () => Promise<T | undefined>\n): (() => T | undefined) => {\n if (typeof React.cache !== 'function') return () => undefined;\n\n const getStore = React.cache(
|
|
1
|
+
{"version":3,"file":"suspendingReader.mjs","names":[],"sources":["../../../src/server/suspendingReader.ts"],"sourcesContent":["import React from 'react';\n\ntype AsyncRungStore<T> = {\n status: 'pending' | 'resolved' | 'rejected';\n value?: T;\n error?: unknown;\n promise?: Promise<void>;\n};\n\n/**\n * Turns an async loader into a synchronous reader that suspends until the\n * value is available, without going through `React.use`.\n *\n * `React.use` matches its per-component state positionally across suspense\n * retries, so a `use()` call whose condition can change between attempts\n * (here: the server context is seeded by the provider concurrently with the\n * page render) shifts the index and hands a later `use()` — such as the\n * dynamic dictionary chunk loader — the wrong promise's value. Throwing the\n * promise ourselves and caching the settlement in a request-scoped store\n * keeps the suspension mechanics without touching React's positional state,\n * which makes the ambient chain safe to run conditionally.\n *\n * Requires `React.cache` for per-request isolation; without it (React < 19)\n * the reader reports `undefined` so callers fall back to the default locale,\n * matching the previous behavior.\n */\nexport const createSuspendingReader = <T>(\n load: () => Promise<T | undefined>\n): (() => T | undefined) => {\n if (typeof React.cache !== 'function') return () => undefined;\n\n const getStore = React.cache((): AsyncRungStore<T | undefined> => ({\n status: 'pending',\n }));\n\n return (): T | undefined => {\n const store = getStore();\n\n // Suspending is only safe when the store survives the retry: React replays\n // the component from the top, so a cache that hands back a fresh store\n // every call would restart the load and throw a new promise forever. That\n // is what `React.cache` degrades to outside a request scope — notably in\n // the SSR pass of client components, where it is a passthrough. Reporting\n // no value there lets the caller fall back instead of hanging the render.\n if (getStore() !== store) return undefined;\n\n if (store.status === 'resolved') return store.value;\n if (store.status === 'rejected') throw store.error;\n\n if (!store.promise) {\n store.promise = load().then(\n (value) => {\n store.value = value;\n store.status = 'resolved';\n },\n (error) => {\n store.error = error;\n store.status = 'rejected';\n }\n );\n }\n\n // Suspend: React retries the component once the promise settles.\n throw store.promise;\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,0BACX,SAC0B;CAC1B,IAAI,OAAO,MAAM,UAAU,YAAY,aAAa;CAEpD,MAAM,WAAW,MAAM,aAA4C,EACjE,QAAQ,UACV,EAAE;CAEF,aAA4B;EAC1B,MAAM,QAAQ,SAAS;EAQvB,IAAI,SAAS,MAAM,OAAO,OAAO;EAEjC,IAAI,MAAM,WAAW,YAAY,OAAO,MAAM;EAC9C,IAAI,MAAM,WAAW,YAAY,MAAM,MAAM;EAE7C,IAAI,CAAC,MAAM,SACT,MAAM,UAAU,KAAK,CAAC,CAAC,MACpB,UAAU;GACT,MAAM,QAAQ;GACd,MAAM,SAAS;EACjB,IACC,UAAU;GACT,MAAM,QAAQ;GACd,MAAM,SAAS;EACjB,CACF;EAIF,MAAM,MAAM;CACd;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.mjs","names":["useDictionaryBase"],"sources":["../../../src/server/useDictionary.ts"],"sourcesContent":["import type {\n Dictionary,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useDictionary as useDictionaryBase } from 'react-intlayer/server';\nimport { resolveFallbackLocale } from './ambientLocale';\n\n/**\n * On the server side, hook that transforms a dictionary (or qualified\n * dictionary group) and returns the content for the given locale or selector.\n *\n * If the locale is not provided, it will use the locale from the server\n * context, falling back to the locale carried by the request.\n */\nexport const useDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends
|
|
1
|
+
{"version":3,"file":"useDictionary.mjs","names":["useDictionaryBase"],"sources":["../../../src/server/useDictionary.ts"],"sourcesContent":["import type {\n Dictionary,\n DictionarySelectorForGroup,\n QualifiedDictionaryGroup,\n} from '@intlayer/types/dictionary';\nimport type {\n DeclaredLocales,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport { useDictionary as useDictionaryBase } from 'react-intlayer/server';\nimport { resolveFallbackLocale } from './ambientLocale';\n\n/**\n * On the server side, hook that transforms a dictionary (or qualified\n * dictionary group) and returns the content for the given locale or selector.\n *\n * If the locale is not provided, it will use the locale from the server\n * context, falling back to the locale carried by the request.\n */\nexport const useDictionary = <\n const T extends Dictionary | QualifiedDictionaryGroup,\n const A extends LocalesValues | DictionarySelectorForGroup<T> =\n DeclaredLocales,\n>(\n dictionary: T,\n localeOrSelector?: A\n): ReturnType<typeof useDictionaryBase<T, A>> => {\n const fallbackLocale = resolveFallbackLocale(localeOrSelector);\n\n return useDictionaryBase<T, A>(dictionary, localeOrSelector, fallbackLocale);\n};\n"],"mappings":";;;;;;;;;;;AAmBA,MAAa,iBAKX,YACA,qBAC+C;CAC/C,MAAM,iBAAiB,sBAAsB,gBAAgB;CAE7D,OAAOA,gBAAwB,YAAY,kBAAkB,cAAc;AAC7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerClientProvider.d.ts","names":[],"sources":["../../../src/client/IntlayerClientProvider.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"IntlayerClientProvider.d.ts","names":[],"sources":["../../../src/client/IntlayerClientProvider.tsx"],"mappings":";;;;;YAQY,8BAA8B;;;;;;;;;;;qBAY7B,4BAA4B,GAAG;;;;;;;;;;;;;;;;qBAmB/B,wBAAsB,GAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import "./client/index.js";
|
|
1
2
|
import { IntlayerClientProvider, IntlayerClientProviderProps } from "./client/IntlayerClientProvider.js";
|
|
2
3
|
import { useLocale } from "./client/useLocale.js";
|
|
3
4
|
import { useLocalePageRouter } from "./client/useLocalePageRouter.js";
|
|
4
5
|
import { usePathname } from "./client/usePathname.js";
|
|
5
6
|
import { useRewriteURL } from "./client/useRewriteURL.js";
|
|
6
|
-
import "./client/index.js";
|
|
7
7
|
import { generateStaticParams } from "./generateStaticParams.js";
|
|
8
8
|
import { LocalParams, LocalPromiseParams, Next14LayoutIntlayer, Next14PageIntlayer, Next15LayoutIntlayer, Next15PageIntlayer, NextLayoutIntlayer, NextPageIntlayer } from "./types/NextPage.js";
|
|
9
9
|
import "./types/index.js";
|
|
10
10
|
import { index_d_exports } from "./markdown/index.js";
|
|
11
|
-
import { FC } from "react";
|
|
12
11
|
import { ConversionParams, ExperimentState, IntlayerClientContext, IntlayerNode, IntlayerProvider, IntlayerProviderProps, getDictionary, getIntlayer, localeCookie, localeInStorage, setLocaleCookie, setLocaleInStorage, t, useConversion, useDictionary, useDictionaryAsync, useDictionaryDynamic, useExperiment, useI18n, useIntl, useIntlayer, useLoadDynamic, useLocaleCookie, useLocaleStorage } from "react-intlayer";
|
|
12
|
+
import { FC } from "react";
|
|
13
13
|
/**
|
|
14
14
|
* @deprecated import from next-intlayer/markdown instead
|
|
15
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":[],"mappings":""}
|
|
@@ -1,3 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `next-intlayer` as loaded in React Server Components.
|
|
3
|
+
*
|
|
4
|
+
* Selected by the `react-server` export condition, which Next.js turns on only
|
|
5
|
+
* in the RSC layer — never in the SSR pass of a client component, never in the
|
|
6
|
+
* browser. That is what makes `next-intlayer` a single import path working on
|
|
7
|
+
* both sides: this entry mirrors the default one name for name, but resolves
|
|
8
|
+
* the content hooks and the provider to their server implementations. The same
|
|
9
|
+
* `useIntlayer('key')` call reads the request-scoped ambient locale here, and
|
|
10
|
+
* the client provider's context in the client layer.
|
|
11
|
+
*
|
|
12
|
+
* Client-only APIs stay re-exported as client references — usable as long as
|
|
13
|
+
* they are not called during a server render.
|
|
14
|
+
*
|
|
15
|
+
* Every import here points at a leaf module rather than a barrel. Barrels put
|
|
16
|
+
* their whole graph in front of the application bundler: `../server/index`
|
|
17
|
+
* would drag `withIntlayer` — and with it `@intlayer/engine` and
|
|
18
|
+
* `node-loader` — into the module graph of every route that imports this
|
|
19
|
+
* package from a server component.
|
|
20
|
+
*
|
|
21
|
+
* Server-only extras (`getLocale`, `setLocale`, `setVariant`,
|
|
22
|
+
* `IntlayerServerProvider`…) are deliberately left out: this entry exposes the
|
|
23
|
+
* same names in every layer, so moving a component between them cannot break
|
|
24
|
+
* an import. They live on `next-intlayer/server`.
|
|
25
|
+
*
|
|
26
|
+
* The deprecated markdown aliases are the one part of the default entry that is
|
|
27
|
+
* deliberately absent: re-exporting them pulls the whole `'use client'`
|
|
28
|
+
* markdown renderer into the server graph, where Next.js turns it into a client
|
|
29
|
+
* entry for the route. Import them from `next-intlayer/markdown`, as their
|
|
30
|
+
* deprecation notice already asks.
|
|
31
|
+
*/
|
|
1
32
|
import { IntlayerClientProvider, IntlayerClientProviderProps } from "../client/IntlayerClientProvider.js";
|
|
2
33
|
import { useLocalePageRouter } from "../client/useLocalePageRouter.js";
|
|
3
34
|
import { usePathname } from "../client/usePathname.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
2
1
|
import { IntlayerProviderProps as IntlayerProviderProps$1 } from "react-intlayer";
|
|
2
|
+
import { FC } from "react";
|
|
3
3
|
import { IntlayerServerProviderProps } from "react-intlayer/server";
|
|
4
4
|
export type IntlayerProviderProps = IntlayerProviderProps$1 & IntlayerServerProviderProps;
|
|
5
5
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Dictionary } from "@intlayer/types/dictionary";
|
|
2
|
+
import { SerializedFieldRenameMap } from "@intlayer/babel";
|
|
2
3
|
import { CallerDescriptor } from "@intlayer/config/callers";
|
|
3
4
|
import { GetConfigurationOptions } from "@intlayer/config/node";
|
|
4
|
-
import { SerializedFieldRenameMap } from "@intlayer/babel";
|
|
5
5
|
import { IntlayerConfig } from "@intlayer/types/config";
|
|
6
6
|
/**
|
|
7
7
|
* Field-rename tables keyed by dictionary key, forwarded to the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.d.ts","names":["useDictionaryBase"],"sources":["../../../src/server/useDictionary.ts"],"mappings":";;;;;;;;;;qBAmBa,sBACL,UAAU,aAAa,gCACvB,
|
|
1
|
+
{"version":3,"file":"useDictionary.d.ts","names":["useDictionaryBase"],"sources":["../../../src/server/useDictionary.ts"],"mappings":";;;;;;;;;;qBAmBa,sBACL,UAAU,aAAa,gCACvB,UAAU,gBAAgB,2BAA2B,KACzD,iBAAe,YAEL,GAAC,mBACM,MAClB,kBAAkBA,gBAAkB,GAAG"}
|
package/package.json
CHANGED
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-intlayer",
|
|
3
|
-
"version": "9.7.
|
|
3
|
+
"version": "9.7.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Simplify internationalization i18n in Next.js with context providers, hooks, locale detection, and multilingual content integration.",
|
|
6
6
|
"keywords": [
|
|
7
|
-
"intlayer",
|
|
8
|
-
"multilingual",
|
|
9
7
|
"i18n",
|
|
10
8
|
"internationalization",
|
|
9
|
+
"intlayer",
|
|
10
|
+
"json",
|
|
11
|
+
"multilingual",
|
|
11
12
|
"nextjs",
|
|
12
|
-
"typescript",
|
|
13
13
|
"react",
|
|
14
|
-
"
|
|
14
|
+
"typescript"
|
|
15
15
|
],
|
|
16
16
|
"homepage": "https://intlayer.org",
|
|
17
17
|
"bugs": {
|
|
18
18
|
"url": "https://github.com/aymericzip/intlayer/issues"
|
|
19
19
|
},
|
|
20
|
-
"repository": {
|
|
21
|
-
"type": "git",
|
|
22
|
-
"url": "git+https://github.com/aymericzip/intlayer.git"
|
|
23
|
-
},
|
|
24
20
|
"license": "Apache-2.0",
|
|
25
21
|
"author": {
|
|
26
22
|
"name": "Aymeric PINEAU",
|
|
@@ -33,7 +29,46 @@
|
|
|
33
29
|
"url": "https://github.com/aymericzip"
|
|
34
30
|
}
|
|
35
31
|
],
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/aymericzip/intlayer.git"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"./dist",
|
|
38
|
+
"./package.json"
|
|
39
|
+
],
|
|
36
40
|
"sideEffects": false,
|
|
41
|
+
"main": "dist/cjs/index.cjs",
|
|
42
|
+
"module": "dist/esm/index.mjs",
|
|
43
|
+
"types": "dist/types/index.d.ts",
|
|
44
|
+
"typesVersions": {
|
|
45
|
+
"*": {
|
|
46
|
+
".": [
|
|
47
|
+
"./dist/types/index.d.ts"
|
|
48
|
+
],
|
|
49
|
+
"format": [
|
|
50
|
+
"./dist/types/client/format/index.d.ts"
|
|
51
|
+
],
|
|
52
|
+
"proxy": [
|
|
53
|
+
"./dist/types/proxy/index.d.ts"
|
|
54
|
+
],
|
|
55
|
+
"middleware": [
|
|
56
|
+
"./dist/types/proxy/index.d.ts"
|
|
57
|
+
],
|
|
58
|
+
"server": [
|
|
59
|
+
"./dist/types/server/index.d.ts"
|
|
60
|
+
],
|
|
61
|
+
"server/format": [
|
|
62
|
+
"./dist/types/server/format/index.d.ts"
|
|
63
|
+
],
|
|
64
|
+
"extractor-loader": [
|
|
65
|
+
"./dist/types/extractorLoader.d.ts"
|
|
66
|
+
],
|
|
67
|
+
"package.json": [
|
|
68
|
+
"./package.json"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
37
72
|
"exports": {
|
|
38
73
|
".": {
|
|
39
74
|
"react-server": {
|
|
@@ -93,50 +128,15 @@
|
|
|
93
128
|
},
|
|
94
129
|
"./package.json": "./package.json"
|
|
95
130
|
},
|
|
96
|
-
"main": "dist/cjs/index.cjs",
|
|
97
|
-
"module": "dist/esm/index.mjs",
|
|
98
|
-
"types": "dist/types/index.d.ts",
|
|
99
|
-
"typesVersions": {
|
|
100
|
-
"*": {
|
|
101
|
-
".": [
|
|
102
|
-
"./dist/types/index.d.ts"
|
|
103
|
-
],
|
|
104
|
-
"format": [
|
|
105
|
-
"./dist/types/client/format/index.d.ts"
|
|
106
|
-
],
|
|
107
|
-
"proxy": [
|
|
108
|
-
"./dist/types/proxy/index.d.ts"
|
|
109
|
-
],
|
|
110
|
-
"middleware": [
|
|
111
|
-
"./dist/types/proxy/index.d.ts"
|
|
112
|
-
],
|
|
113
|
-
"server": [
|
|
114
|
-
"./dist/types/server/index.d.ts"
|
|
115
|
-
],
|
|
116
|
-
"server/format": [
|
|
117
|
-
"./dist/types/server/format/index.d.ts"
|
|
118
|
-
],
|
|
119
|
-
"extractor-loader": [
|
|
120
|
-
"./dist/types/extractorLoader.d.ts"
|
|
121
|
-
],
|
|
122
|
-
"package.json": [
|
|
123
|
-
"./package.json"
|
|
124
|
-
]
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
"files": [
|
|
128
|
-
"./dist",
|
|
129
|
-
"./package.json"
|
|
130
|
-
],
|
|
131
131
|
"scripts": {
|
|
132
132
|
"build": "bun --bun tsdown --config tsdown.config.ts",
|
|
133
133
|
"build:ci": "bun --bun tsdown --config tsdown.config.ts",
|
|
134
134
|
"clean": "bun --bun rimraf ./dist .turbo",
|
|
135
135
|
"dev": "bun --bun tsdown --config tsdown.config.ts --watch",
|
|
136
|
-
"format": "
|
|
137
|
-
"format:fix": "
|
|
138
|
-
"lint": "
|
|
139
|
-
"lint:fix": "
|
|
136
|
+
"format": "oxfmt --check .",
|
|
137
|
+
"format:fix": "oxfmt .",
|
|
138
|
+
"lint": "oxlint .",
|
|
139
|
+
"lint:fix": "oxlint --fix .",
|
|
140
140
|
"prepublish": "cp -f ../../README.md ./README.md",
|
|
141
141
|
"publish": "bun publish || true",
|
|
142
142
|
"publish:canary": "bun publish --access public --tag canary || true",
|
|
@@ -147,14 +147,14 @@
|
|
|
147
147
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
148
148
|
},
|
|
149
149
|
"dependencies": {
|
|
150
|
-
"@intlayer/config": "9.7.
|
|
151
|
-
"@intlayer/core": "9.7.
|
|
152
|
-
"@intlayer/dictionaries-entry": "9.7.
|
|
153
|
-
"@intlayer/engine": "9.7.
|
|
154
|
-
"@intlayer/types": "9.7.
|
|
150
|
+
"@intlayer/config": "9.7.3",
|
|
151
|
+
"@intlayer/core": "9.7.3",
|
|
152
|
+
"@intlayer/dictionaries-entry": "9.7.3",
|
|
153
|
+
"@intlayer/engine": "9.7.3",
|
|
154
|
+
"@intlayer/types": "9.7.3",
|
|
155
155
|
"defu": "6.1.7",
|
|
156
156
|
"node-loader": "2.1.0",
|
|
157
|
-
"react-intlayer": "9.7.
|
|
157
|
+
"react-intlayer": "9.7.3"
|
|
158
158
|
},
|
|
159
159
|
"devDependencies": {
|
|
160
160
|
"@types/node": "^26",
|
|
@@ -163,8 +163,8 @@
|
|
|
163
163
|
"@utils/ts-config": "1.0.4",
|
|
164
164
|
"@utils/ts-config-types": "1.0.4",
|
|
165
165
|
"@utils/tsdown-config": "1.0.4",
|
|
166
|
-
"rimraf": "6.1.
|
|
167
|
-
"tsdown": "0.23.
|
|
166
|
+
"rimraf": "6.1.4",
|
|
167
|
+
"tsdown": "0.23.7",
|
|
168
168
|
"typescript": "7.0.2",
|
|
169
169
|
"vitest": "5.1.0"
|
|
170
170
|
},
|