gt-next 11.4.11 → 11.4.13
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/CHANGELOG.md +26 -0
- package/dist/config-dir/props/withGTConfigProps.d.ts +2 -1
- package/dist/config-dir/props/withGTConfigProps.d.ts.map +1 -1
- package/dist/config-dir/props/withGTConfigProps.js.map +1 -1
- package/dist/config-dir/props/withGTConfigProps.mjs.map +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +11 -1
- package/dist/config.js.map +1 -1
- package/dist/config.mjs +11 -1
- package/dist/config.mjs.map +1 -1
- package/dist/errors/createErrors.d.ts.map +1 -1
- package/dist/errors/createErrors.js +1 -2
- package/dist/errors/createErrors.js.map +1 -1
- package/dist/errors/createErrors.mjs +1 -2
- package/dist/errors/createErrors.mjs.map +1 -1
- package/dist/errors/middleware.d.ts +2 -0
- package/dist/errors/middleware.d.ts.map +1 -1
- package/dist/errors/middleware.js +17 -0
- package/dist/errors/middleware.js.map +1 -1
- package/dist/errors/middleware.mjs +15 -1
- package/dist/errors/middleware.mjs.map +1 -1
- package/dist/gt_swc_plugin.wasm +0 -0
- package/dist/index.client.d.ts +1 -0
- package/dist/index.client.d.ts.map +1 -1
- package/dist/index.client.js +2 -0
- package/dist/index.client.js.map +1 -1
- package/dist/index.client.mjs +2 -1
- package/dist/index.client.mjs.map +1 -1
- package/dist/index.rsc.d.ts +1 -0
- package/dist/index.rsc.d.ts.map +1 -1
- package/dist/index.rsc.js +2 -0
- package/dist/index.rsc.js.map +1 -1
- package/dist/index.rsc.mjs +2 -1
- package/dist/index.rsc.mjs.map +1 -1
- package/dist/index.server.d.ts +1 -0
- package/dist/index.server.d.ts.map +1 -1
- package/dist/index.server.js +2 -0
- package/dist/index.server.js.map +1 -1
- package/dist/index.server.mjs +2 -1
- package/dist/index.server.mjs.map +1 -1
- package/dist/index.types.d.ts +11 -0
- package/dist/index.types.d.ts.map +1 -1
- package/dist/link/Link.d.ts +7 -4
- package/dist/link/Link.d.ts.map +1 -1
- package/dist/link/Link.js +19 -41
- package/dist/link/Link.js.map +1 -1
- package/dist/link/Link.mjs +19 -41
- package/dist/link/Link.mjs.map +1 -1
- package/dist/link/getLocalizeHref.d.ts +43 -0
- package/dist/link/getLocalizeHref.d.ts.map +1 -0
- package/dist/link/getLocalizeHref.js +59 -0
- package/dist/link/getLocalizeHref.js.map +1 -0
- package/dist/link/getLocalizeHref.mjs +56 -0
- package/dist/link/getLocalizeHref.mjs.map +1 -0
- package/dist/link/localize-utils.d.ts +15 -0
- package/dist/link/localize-utils.d.ts.map +1 -0
- package/dist/link/localize-utils.js +49 -0
- package/dist/link/localize-utils.js.map +1 -0
- package/dist/link/localize-utils.mjs +48 -0
- package/dist/link/localize-utils.mjs.map +1 -0
- package/dist/link/useLocalizeHref.d.ts +34 -0
- package/dist/link/useLocalizeHref.d.ts.map +1 -0
- package/dist/link/useLocalizeHref.js +46 -0
- package/dist/link/useLocalizeHref.js.map +1 -0
- package/dist/link/useLocalizeHref.mjs +44 -0
- package/dist/link/useLocalizeHref.mjs.map +1 -0
- package/dist/link.d.ts +2 -0
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +2 -0
- package/dist/link.mjs +2 -1
- package/dist/middleware-dir/createMiddlewareRouting.d.ts +7 -0
- package/dist/middleware-dir/createMiddlewareRouting.d.ts.map +1 -0
- package/dist/middleware-dir/createMiddlewareRouting.js +79 -0
- package/dist/middleware-dir/createMiddlewareRouting.js.map +1 -0
- package/dist/middleware-dir/createMiddlewareRouting.mjs +77 -0
- package/dist/middleware-dir/createMiddlewareRouting.mjs.map +1 -0
- package/dist/middleware-dir/createNextMiddleware.d.ts +5 -12
- package/dist/middleware-dir/createNextMiddleware.d.ts.map +1 -1
- package/dist/middleware-dir/createNextMiddleware.js +14 -55
- package/dist/middleware-dir/createNextMiddleware.js.map +1 -1
- package/dist/middleware-dir/createNextMiddleware.mjs +15 -56
- package/dist/middleware-dir/createNextMiddleware.mjs.map +1 -1
- package/dist/middleware-dir/defaultMiddlewareConfig.d.ts +11 -0
- package/dist/middleware-dir/defaultMiddlewareConfig.d.ts.map +1 -0
- package/dist/middleware-dir/defaultMiddlewareConfig.js +33 -0
- package/dist/middleware-dir/defaultMiddlewareConfig.js.map +1 -0
- package/dist/middleware-dir/defaultMiddlewareConfig.mjs +31 -0
- package/dist/middleware-dir/defaultMiddlewareConfig.mjs.map +1 -0
- package/dist/middleware-dir/resolveMiddlewareConfig.d.ts +9 -0
- package/dist/middleware-dir/resolveMiddlewareConfig.d.ts.map +1 -0
- package/dist/middleware-dir/resolveMiddlewareConfig.js +32 -0
- package/dist/middleware-dir/resolveMiddlewareConfig.js.map +1 -0
- package/dist/middleware-dir/resolveMiddlewareConfig.mjs +30 -0
- package/dist/middleware-dir/resolveMiddlewareConfig.mjs.map +1 -0
- package/dist/middleware-dir/types.d.ts +56 -0
- package/dist/middleware-dir/types.d.ts.map +1 -0
- package/dist/middleware-dir/types.js +1 -0
- package/dist/middleware-dir/types.mjs +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +2 -0
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +2 -1
- package/dist/server.mjs.map +1 -1
- package/dist/utils/client-boundary.js +1 -1
- package/dist/utils/client-boundary.mjs +1 -1
- package/dist/variables/RelativeTime.js +1 -1
- package/dist/variables/RelativeTime.js.map +1 -1
- package/dist/variables/RelativeTime.mjs +1 -1
- package/dist/variables/RelativeTime.mjs.map +1 -1
- package/package.json +7 -13
package/dist/index.rsc.js
CHANGED
|
@@ -15,6 +15,7 @@ const require_variables_RelativeTime = require("./variables/RelativeTime.js");
|
|
|
15
15
|
const require_variables_Var = require("./variables/Var.js");
|
|
16
16
|
const require_server_dir_buildtime_T = require("./server-dir/buildtime/T.js");
|
|
17
17
|
const require_request_getLocaleDirection = require("./request/getLocaleDirection.js");
|
|
18
|
+
const require_link_getLocalizeHref = require("./link/getLocalizeHref.js");
|
|
18
19
|
const require_server_dir_buildtime_strings = require("./server-dir/buildtime/strings.js");
|
|
19
20
|
let gt_react = require("gt-react");
|
|
20
21
|
require("server-only");
|
|
@@ -181,6 +182,7 @@ Object.defineProperty(exports, "useLocales", {
|
|
|
181
182
|
return gt_react.useLocales;
|
|
182
183
|
}
|
|
183
184
|
});
|
|
185
|
+
exports.useLocalizeHref = require_link_getLocalizeHref.useLocalizeHref;
|
|
184
186
|
exports.useMessages = require_server_dir_buildtime_strings.useMessages;
|
|
185
187
|
exports.useRegion = require_request_getRegion.useRegion;
|
|
186
188
|
exports.useTranslations = require_server_dir_buildtime_strings.useTranslations;
|
package/dist/index.rsc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.rsc.js","names":["initializeGTServer","getTranslationsSnapshotRscError","withGTStaticPropsRscError"],"sources":["../src/index.rsc.ts"],"sourcesContent":["import 'server-only';\n\nimport { initializeGTServer } from './setup/initGT.server';\nimport type {\n GetServerSideProps,\n GetServerSidePropsContext,\n PreviewData,\n} from 'next';\nimport type { ParsedUrlQuery } from 'querystring';\nimport {\n getTranslationsSnapshotRscError,\n withGTStaticPropsRscError,\n} from './errors/createErrors';\nimport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nimport type {\n WithGTStaticProps,\n WithGTStaticPropsFunction,\n} from './pages-dir/withGTStaticProps';\ninitializeGTServer();\n\n// ===== Components ===== //\nexport { Branch } from './branches/Branch';\nexport { Currency } from './variables/Currency';\nexport { DateTime } from './variables/DateTime';\nexport { GTProvider } from './provider/GTProvider';\nexport { Num } from './variables/Num';\nexport { Plural } from './branches/Plural';\nexport { RelativeTime } from './variables/RelativeTime';\nexport { GtInternalTranslateJsx, T } from './server-dir/buildtime/T';\nexport { GtInternalVar, Var } from './variables/Var';\n\n// ===== Hooks ===== //\nexport { useLocale } from './request/getLocale';\nexport { useRegion } from './request/getRegion';\nexport { useLocaleDirection } from './request/getLocaleDirection';\nexport {\n useTranslations,\n useMessages,\n useGT,\n} from './server-dir/buildtime/strings';\n\n// ===== Client Boundary ===== //\n\nexport { Client_LocaleSelector as LocaleSelector } from './utils/client-boundary';\nexport { Client_RegionSelector as RegionSelector } from './utils/client-boundary';\n\n// ===== other ===== //\n\n/**\n * Placeholder for getTranslationsSnapshot()\n * This function is for next-pages use, not next-app use\n */\nexport function getTranslationsSnapshot(_: string) {\n throw new Error(getTranslationsSnapshotRscError);\n}\n\n/**\n * Placeholder for parseLocale()\n * This function is for next-pages use, not next-app use\n */\nexport function parseLocale<\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(_: GetServerSidePropsContext<Params, Preview>): string {\n throw new Error('parseLocale() is only available for the Pages Router.');\n}\n\n/**\n * Placeholder for withGTServerSideProps()\n * This function is for next-pages use, not next-app use\n */\nexport function withGTServerSideProps<\n Props extends Record<string, unknown> = Record<string, unknown>,\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(\n _?: GetServerSideProps<Props, Params, Preview>\n): GetServerSideProps<WithGTServerSideProps<Props>, Params, Preview> {\n throw new Error(\n 'withGTServerSideProps() is only available for the Pages Router.'\n );\n}\n\n/**\n * Placeholder for withGTStaticProps()\n * This function is for next-pages use, not next-app use\n */\nexport const withGTStaticProps: WithGTStaticPropsFunction = () => {\n throw new Error(withGTStaticPropsRscError);\n};\n\n// ===== gt-react Components ===== //\nexport { Derive } from 'gt-react';\n\n// ===== gt-react Hooks ===== //\nexport { useDefaultLocale, useLocaleProperties, useLocales } from 'gt-react';\n\n// ===== gt-react Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\nexport type { WithGTServerSideProps, WithGTStaticProps };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.rsc.js","names":["initializeGTServer","getTranslationsSnapshotRscError","withGTStaticPropsRscError"],"sources":["../src/index.rsc.ts"],"sourcesContent":["import 'server-only';\n\nimport { initializeGTServer } from './setup/initGT.server';\nimport type {\n GetServerSideProps,\n GetServerSidePropsContext,\n PreviewData,\n} from 'next';\nimport type { ParsedUrlQuery } from 'querystring';\nimport {\n getTranslationsSnapshotRscError,\n withGTStaticPropsRscError,\n} from './errors/createErrors';\nimport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nimport type {\n WithGTStaticProps,\n WithGTStaticPropsFunction,\n} from './pages-dir/withGTStaticProps';\ninitializeGTServer();\n\n// ===== Components ===== //\nexport { Branch } from './branches/Branch';\nexport { Currency } from './variables/Currency';\nexport { DateTime } from './variables/DateTime';\nexport { GTProvider } from './provider/GTProvider';\nexport { Num } from './variables/Num';\nexport { Plural } from './branches/Plural';\nexport { RelativeTime } from './variables/RelativeTime';\nexport { GtInternalTranslateJsx, T } from './server-dir/buildtime/T';\nexport { GtInternalVar, Var } from './variables/Var';\n\n// ===== Hooks ===== //\nexport { useLocale } from './request/getLocale';\nexport { useRegion } from './request/getRegion';\nexport { useLocaleDirection } from './request/getLocaleDirection';\nexport { useLocalizeHref } from './link/getLocalizeHref';\nexport {\n useTranslations,\n useMessages,\n useGT,\n} from './server-dir/buildtime/strings';\n\n// ===== Client Boundary ===== //\n\nexport { Client_LocaleSelector as LocaleSelector } from './utils/client-boundary';\nexport { Client_RegionSelector as RegionSelector } from './utils/client-boundary';\n\n// ===== other ===== //\n\n/**\n * Placeholder for getTranslationsSnapshot()\n * This function is for next-pages use, not next-app use\n */\nexport function getTranslationsSnapshot(_: string) {\n throw new Error(getTranslationsSnapshotRscError);\n}\n\n/**\n * Placeholder for parseLocale()\n * This function is for next-pages use, not next-app use\n */\nexport function parseLocale<\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(_: GetServerSidePropsContext<Params, Preview>): string {\n throw new Error('parseLocale() is only available for the Pages Router.');\n}\n\n/**\n * Placeholder for withGTServerSideProps()\n * This function is for next-pages use, not next-app use\n */\nexport function withGTServerSideProps<\n Props extends Record<string, unknown> = Record<string, unknown>,\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(\n _?: GetServerSideProps<Props, Params, Preview>\n): GetServerSideProps<WithGTServerSideProps<Props>, Params, Preview> {\n throw new Error(\n 'withGTServerSideProps() is only available for the Pages Router.'\n );\n}\n\n/**\n * Placeholder for withGTStaticProps()\n * This function is for next-pages use, not next-app use\n */\nexport const withGTStaticProps: WithGTStaticPropsFunction = () => {\n throw new Error(withGTStaticPropsRscError);\n};\n\n// ===== gt-react Components ===== //\nexport { Derive } from 'gt-react';\n\n// ===== gt-react Hooks ===== //\nexport { useDefaultLocale, useLocaleProperties, useLocales } from 'gt-react';\n\n// ===== gt-react Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\nexport type { WithGTServerSideProps, WithGTStaticProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkBAA,4BAAAA,oBAAoB;;;;;AAmCpB,SAAgB,wBAAwB,GAAW;AACjD,OAAM,IAAI,MAAMC,4BAAAA,gCAAgC;;;;;;AAOlD,SAAgB,YAGd,GAAuD;AACvD,OAAM,IAAI,MAAM,wDAAwD;;;;;;AAO1E,SAAgB,sBAKd,GACmE;AACnE,OAAM,IAAI,MACR,kEACD;;;;;;AAOH,MAAa,0BAAqD;AAChE,OAAM,IAAI,MAAMC,4BAAAA,0BAA0B"}
|
package/dist/index.rsc.mjs
CHANGED
|
@@ -13,6 +13,7 @@ import { RelativeTime } from "./variables/RelativeTime.mjs";
|
|
|
13
13
|
import { GtInternalVar, Var } from "./variables/Var.mjs";
|
|
14
14
|
import { GtInternalTranslateJsx, T } from "./server-dir/buildtime/T.mjs";
|
|
15
15
|
import { useLocaleDirection } from "./request/getLocaleDirection.mjs";
|
|
16
|
+
import { useLocalizeHref } from "./link/getLocalizeHref.mjs";
|
|
16
17
|
import { useGT, useMessages, useTranslations } from "./server-dir/buildtime/strings.mjs";
|
|
17
18
|
import { Derive, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocaleProperties, getLocales, getVersionId, gtFallback, mFallback, msg, resolveCanonicalLocale, useDefaultLocale, useLocaleProperties, useLocales } from "gt-react";
|
|
18
19
|
import "server-only";
|
|
@@ -48,6 +49,6 @@ const withGTStaticProps = () => {
|
|
|
48
49
|
throw new Error(withGTStaticPropsRscError);
|
|
49
50
|
};
|
|
50
51
|
//#endregion
|
|
51
|
-
export { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx, GtInternalVar, LocaleSelector, Num, Plural, RegionSelector, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocaleProperties, getLocales, getTranslationsSnapshot, getVersionId, gtFallback, isLocaleSupported, mFallback, msg, parseLocale, resolveCanonicalLocale, useDefaultLocale, useGT, useLocale, useLocaleDirection, useLocaleProperties, useLocales, useMessages, useRegion, useTranslations, withGTServerSideProps, withGTStaticProps };
|
|
52
|
+
export { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx, GtInternalVar, LocaleSelector, Num, Plural, RegionSelector, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocaleProperties, getLocales, getTranslationsSnapshot, getVersionId, gtFallback, isLocaleSupported, mFallback, msg, parseLocale, resolveCanonicalLocale, useDefaultLocale, useGT, useLocale, useLocaleDirection, useLocaleProperties, useLocales, useLocalizeHref, useMessages, useRegion, useTranslations, withGTServerSideProps, withGTStaticProps };
|
|
52
53
|
|
|
53
54
|
//# sourceMappingURL=index.rsc.mjs.map
|
package/dist/index.rsc.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.rsc.mjs","names":[],"sources":["../src/index.rsc.ts"],"sourcesContent":["import 'server-only';\n\nimport { initializeGTServer } from './setup/initGT.server';\nimport type {\n GetServerSideProps,\n GetServerSidePropsContext,\n PreviewData,\n} from 'next';\nimport type { ParsedUrlQuery } from 'querystring';\nimport {\n getTranslationsSnapshotRscError,\n withGTStaticPropsRscError,\n} from './errors/createErrors';\nimport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nimport type {\n WithGTStaticProps,\n WithGTStaticPropsFunction,\n} from './pages-dir/withGTStaticProps';\ninitializeGTServer();\n\n// ===== Components ===== //\nexport { Branch } from './branches/Branch';\nexport { Currency } from './variables/Currency';\nexport { DateTime } from './variables/DateTime';\nexport { GTProvider } from './provider/GTProvider';\nexport { Num } from './variables/Num';\nexport { Plural } from './branches/Plural';\nexport { RelativeTime } from './variables/RelativeTime';\nexport { GtInternalTranslateJsx, T } from './server-dir/buildtime/T';\nexport { GtInternalVar, Var } from './variables/Var';\n\n// ===== Hooks ===== //\nexport { useLocale } from './request/getLocale';\nexport { useRegion } from './request/getRegion';\nexport { useLocaleDirection } from './request/getLocaleDirection';\nexport {\n useTranslations,\n useMessages,\n useGT,\n} from './server-dir/buildtime/strings';\n\n// ===== Client Boundary ===== //\n\nexport { Client_LocaleSelector as LocaleSelector } from './utils/client-boundary';\nexport { Client_RegionSelector as RegionSelector } from './utils/client-boundary';\n\n// ===== other ===== //\n\n/**\n * Placeholder for getTranslationsSnapshot()\n * This function is for next-pages use, not next-app use\n */\nexport function getTranslationsSnapshot(_: string) {\n throw new Error(getTranslationsSnapshotRscError);\n}\n\n/**\n * Placeholder for parseLocale()\n * This function is for next-pages use, not next-app use\n */\nexport function parseLocale<\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(_: GetServerSidePropsContext<Params, Preview>): string {\n throw new Error('parseLocale() is only available for the Pages Router.');\n}\n\n/**\n * Placeholder for withGTServerSideProps()\n * This function is for next-pages use, not next-app use\n */\nexport function withGTServerSideProps<\n Props extends Record<string, unknown> = Record<string, unknown>,\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(\n _?: GetServerSideProps<Props, Params, Preview>\n): GetServerSideProps<WithGTServerSideProps<Props>, Params, Preview> {\n throw new Error(\n 'withGTServerSideProps() is only available for the Pages Router.'\n );\n}\n\n/**\n * Placeholder for withGTStaticProps()\n * This function is for next-pages use, not next-app use\n */\nexport const withGTStaticProps: WithGTStaticPropsFunction = () => {\n throw new Error(withGTStaticPropsRscError);\n};\n\n// ===== gt-react Components ===== //\nexport { Derive } from 'gt-react';\n\n// ===== gt-react Hooks ===== //\nexport { useDefaultLocale, useLocaleProperties, useLocales } from 'gt-react';\n\n// ===== gt-react Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\nexport type { WithGTServerSideProps, WithGTStaticProps };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.rsc.mjs","names":[],"sources":["../src/index.rsc.ts"],"sourcesContent":["import 'server-only';\n\nimport { initializeGTServer } from './setup/initGT.server';\nimport type {\n GetServerSideProps,\n GetServerSidePropsContext,\n PreviewData,\n} from 'next';\nimport type { ParsedUrlQuery } from 'querystring';\nimport {\n getTranslationsSnapshotRscError,\n withGTStaticPropsRscError,\n} from './errors/createErrors';\nimport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nimport type {\n WithGTStaticProps,\n WithGTStaticPropsFunction,\n} from './pages-dir/withGTStaticProps';\ninitializeGTServer();\n\n// ===== Components ===== //\nexport { Branch } from './branches/Branch';\nexport { Currency } from './variables/Currency';\nexport { DateTime } from './variables/DateTime';\nexport { GTProvider } from './provider/GTProvider';\nexport { Num } from './variables/Num';\nexport { Plural } from './branches/Plural';\nexport { RelativeTime } from './variables/RelativeTime';\nexport { GtInternalTranslateJsx, T } from './server-dir/buildtime/T';\nexport { GtInternalVar, Var } from './variables/Var';\n\n// ===== Hooks ===== //\nexport { useLocale } from './request/getLocale';\nexport { useRegion } from './request/getRegion';\nexport { useLocaleDirection } from './request/getLocaleDirection';\nexport { useLocalizeHref } from './link/getLocalizeHref';\nexport {\n useTranslations,\n useMessages,\n useGT,\n} from './server-dir/buildtime/strings';\n\n// ===== Client Boundary ===== //\n\nexport { Client_LocaleSelector as LocaleSelector } from './utils/client-boundary';\nexport { Client_RegionSelector as RegionSelector } from './utils/client-boundary';\n\n// ===== other ===== //\n\n/**\n * Placeholder for getTranslationsSnapshot()\n * This function is for next-pages use, not next-app use\n */\nexport function getTranslationsSnapshot(_: string) {\n throw new Error(getTranslationsSnapshotRscError);\n}\n\n/**\n * Placeholder for parseLocale()\n * This function is for next-pages use, not next-app use\n */\nexport function parseLocale<\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(_: GetServerSidePropsContext<Params, Preview>): string {\n throw new Error('parseLocale() is only available for the Pages Router.');\n}\n\n/**\n * Placeholder for withGTServerSideProps()\n * This function is for next-pages use, not next-app use\n */\nexport function withGTServerSideProps<\n Props extends Record<string, unknown> = Record<string, unknown>,\n Params extends ParsedUrlQuery = ParsedUrlQuery,\n Preview extends PreviewData = PreviewData,\n>(\n _?: GetServerSideProps<Props, Params, Preview>\n): GetServerSideProps<WithGTServerSideProps<Props>, Params, Preview> {\n throw new Error(\n 'withGTServerSideProps() is only available for the Pages Router.'\n );\n}\n\n/**\n * Placeholder for withGTStaticProps()\n * This function is for next-pages use, not next-app use\n */\nexport const withGTStaticProps: WithGTStaticPropsFunction = () => {\n throw new Error(withGTStaticPropsRscError);\n};\n\n// ===== gt-react Components ===== //\nexport { Derive } from 'gt-react';\n\n// ===== gt-react Hooks ===== //\nexport { useDefaultLocale, useLocaleProperties, useLocales } from 'gt-react';\n\n// ===== gt-react Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\nexport type { WithGTServerSideProps, WithGTStaticProps };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkBA,oBAAoB;;;;;AAmCpB,SAAgB,wBAAwB,GAAW;AACjD,OAAM,IAAI,MAAM,gCAAgC;;;;;;AAOlD,SAAgB,YAGd,GAAuD;AACvD,OAAM,IAAI,MAAM,wDAAwD;;;;;;AAO1E,SAAgB,sBAKd,GACmE;AACnE,OAAM,IAAI,MACR,kEACD;;;;;;AAOH,MAAa,0BAAqD;AAChE,OAAM,IAAI,MAAM,0BAA0B"}
|
package/dist/index.server.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type { WithGTStaticProps } from './pages-dir/withGTStaticProps';
|
|
|
6
6
|
export { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx, GtInternalVar, T, LocaleSelector, Num, Plural, RegionSelector, RelativeTime, Var, } from 'gt-react';
|
|
7
7
|
export { useDefaultLocale, useGT, useLocaleDirection, useLocales, useLocaleProperties, useLocaleSelector, useLocale, useMessages, useRegion, useSetLocale, useTranslations, } from 'gt-react';
|
|
8
8
|
export { decodeMsg, decodeOptions, decodeVars, declareVar, derive, getDefaultLocale, getLocaleProperties, getLocales, resolveCanonicalLocale, getTranslationsSnapshot, getVersionId, gtFallback, mFallback, msg, } from 'gt-react';
|
|
9
|
+
export { useLocalizeHref } from './link/useLocalizeHref';
|
|
9
10
|
export { isLocaleSupported } from './request/localeValidation';
|
|
10
11
|
export type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';
|
|
11
12
|
//# sourceMappingURL=index.server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,YAAY,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,OAAO,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,UAAU,EACV,sBAAsB,EACtB,aAAa,EACb,CAAC,EACD,cAAc,EACd,GAAG,EACH,MAAM,EACN,cAAc,EACd,YAAY,EACZ,GAAG,GACJ,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,gBAAgB,EAChB,KAAK,EACL,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,SAAS,EACT,YAAY,EACZ,eAAe,GAChB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,SAAS,EACT,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,GAAG,GACJ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG/D,YAAY,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,YAAY,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAGvE,OAAO,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,UAAU,EACV,sBAAsB,EACtB,aAAa,EACb,CAAC,EACD,cAAc,EACd,GAAG,EACH,MAAM,EACN,cAAc,EACd,YAAY,EACZ,GAAG,GACJ,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,gBAAgB,EAChB,KAAK,EACL,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,SAAS,EACT,YAAY,EACZ,eAAe,GAChB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,SAAS,EACT,aAAa,EACb,UAAU,EACV,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,UAAU,EACV,SAAS,EACT,GAAG,GACJ,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG/D,YAAY,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.server.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
require("./_virtual/_rolldown/runtime.js");
|
|
4
|
+
const require_link_useLocalizeHref = require("./link/useLocalizeHref.js");
|
|
4
5
|
const require_request_localeValidation = require("./request/localeValidation.js");
|
|
5
6
|
const require_setup_initGT = require("./setup/initGT.js");
|
|
6
7
|
const require_pages_dir_parseLocale = require("./pages-dir/parseLocale.js");
|
|
@@ -229,6 +230,7 @@ Object.defineProperty(exports, "useLocales", {
|
|
|
229
230
|
return gt_react.useLocales;
|
|
230
231
|
}
|
|
231
232
|
});
|
|
233
|
+
exports.useLocalizeHref = require_link_useLocalizeHref.useLocalizeHref;
|
|
232
234
|
Object.defineProperty(exports, "useMessages", {
|
|
233
235
|
enumerable: true,
|
|
234
236
|
get: function() {
|
package/dist/index.server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.js","names":["initializeGT"],"sources":["../src/index.server.ts"],"sourcesContent":["'use client';\n\nimport { initializeGT } from './setup/initGT';\n/**\n * No initializeGTServer() here because we do not want to\n * initialize the AsyncConditionStore on the server side.\n *\n * No initializeGTClient() here because we do want to enforce\n * expiry times here.\n */\ninitializeGT();\n\n// ===== Pages Router ===== //\nexport { parseLocale } from './pages-dir/parseLocale';\nexport { withGTServerSideProps } from './pages-dir/withGTServerSideProps';\nexport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nexport { withGTStaticProps } from './pages-dir/withGTStaticProps';\nexport type { WithGTStaticProps } from './pages-dir/withGTStaticProps';\n\n// ===== Components ===== //\nexport {\n Branch,\n Currency,\n DateTime,\n Derive,\n GTProvider,\n GtInternalTranslateJsx,\n GtInternalVar,\n T,\n LocaleSelector,\n Num,\n Plural,\n RegionSelector,\n RelativeTime,\n Var,\n} from 'gt-react';\n\n// ===== Hooks ===== //\nexport {\n useDefaultLocale,\n useGT,\n useLocaleDirection,\n useLocales,\n useLocaleProperties,\n useLocaleSelector,\n useLocale,\n useMessages,\n useRegion,\n useSetLocale,\n useTranslations,\n} from 'gt-react';\n\n// ===== Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getTranslationsSnapshot,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.server.js","names":["initializeGT"],"sources":["../src/index.server.ts"],"sourcesContent":["'use client';\n\nimport { initializeGT } from './setup/initGT';\n/**\n * No initializeGTServer() here because we do not want to\n * initialize the AsyncConditionStore on the server side.\n *\n * No initializeGTClient() here because we do want to enforce\n * expiry times here.\n */\ninitializeGT();\n\n// ===== Pages Router ===== //\nexport { parseLocale } from './pages-dir/parseLocale';\nexport { withGTServerSideProps } from './pages-dir/withGTServerSideProps';\nexport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nexport { withGTStaticProps } from './pages-dir/withGTStaticProps';\nexport type { WithGTStaticProps } from './pages-dir/withGTStaticProps';\n\n// ===== Components ===== //\nexport {\n Branch,\n Currency,\n DateTime,\n Derive,\n GTProvider,\n GtInternalTranslateJsx,\n GtInternalVar,\n T,\n LocaleSelector,\n Num,\n Plural,\n RegionSelector,\n RelativeTime,\n Var,\n} from 'gt-react';\n\n// ===== Hooks ===== //\nexport {\n useDefaultLocale,\n useGT,\n useLocaleDirection,\n useLocales,\n useLocaleProperties,\n useLocaleSelector,\n useLocale,\n useMessages,\n useRegion,\n useSetLocale,\n useTranslations,\n} from 'gt-react';\n\n// ===== Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getTranslationsSnapshot,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { useLocalizeHref } from './link/useLocalizeHref';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAUAA,qBAAAA,cAAc"}
|
package/dist/index.server.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useLocalizeHref } from "./link/useLocalizeHref.mjs";
|
|
2
3
|
import { isLocaleSupported } from "./request/localeValidation.mjs";
|
|
3
4
|
import { initializeGT } from "./setup/initGT.mjs";
|
|
4
5
|
import { parseLocale } from "./pages-dir/parseLocale.mjs";
|
|
@@ -15,6 +16,6 @@ import { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx,
|
|
|
15
16
|
*/
|
|
16
17
|
initializeGT();
|
|
17
18
|
//#endregion
|
|
18
|
-
export { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx, GtInternalVar, LocaleSelector, Num, Plural, RegionSelector, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocaleProperties, getLocales, getTranslationsSnapshot, getVersionId, gtFallback, isLocaleSupported, mFallback, msg, parseLocale, resolveCanonicalLocale, useDefaultLocale, useGT, useLocale, useLocaleDirection, useLocaleProperties, useLocaleSelector, useLocales, useMessages, useRegion, useSetLocale, useTranslations, withGTServerSideProps, withGTStaticProps };
|
|
19
|
+
export { Branch, Currency, DateTime, Derive, GTProvider, GtInternalTranslateJsx, GtInternalVar, LocaleSelector, Num, Plural, RegionSelector, RelativeTime, T, Var, declareVar, decodeMsg, decodeOptions, decodeVars, derive, getDefaultLocale, getLocaleProperties, getLocales, getTranslationsSnapshot, getVersionId, gtFallback, isLocaleSupported, mFallback, msg, parseLocale, resolveCanonicalLocale, useDefaultLocale, useGT, useLocale, useLocaleDirection, useLocaleProperties, useLocaleSelector, useLocales, useLocalizeHref, useMessages, useRegion, useSetLocale, useTranslations, withGTServerSideProps, withGTStaticProps };
|
|
19
20
|
|
|
20
21
|
//# sourceMappingURL=index.server.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.mjs","names":[],"sources":["../src/index.server.ts"],"sourcesContent":["'use client';\n\nimport { initializeGT } from './setup/initGT';\n/**\n * No initializeGTServer() here because we do not want to\n * initialize the AsyncConditionStore on the server side.\n *\n * No initializeGTClient() here because we do want to enforce\n * expiry times here.\n */\ninitializeGT();\n\n// ===== Pages Router ===== //\nexport { parseLocale } from './pages-dir/parseLocale';\nexport { withGTServerSideProps } from './pages-dir/withGTServerSideProps';\nexport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nexport { withGTStaticProps } from './pages-dir/withGTStaticProps';\nexport type { WithGTStaticProps } from './pages-dir/withGTStaticProps';\n\n// ===== Components ===== //\nexport {\n Branch,\n Currency,\n DateTime,\n Derive,\n GTProvider,\n GtInternalTranslateJsx,\n GtInternalVar,\n T,\n LocaleSelector,\n Num,\n Plural,\n RegionSelector,\n RelativeTime,\n Var,\n} from 'gt-react';\n\n// ===== Hooks ===== //\nexport {\n useDefaultLocale,\n useGT,\n useLocaleDirection,\n useLocales,\n useLocaleProperties,\n useLocaleSelector,\n useLocale,\n useMessages,\n useRegion,\n useSetLocale,\n useTranslations,\n} from 'gt-react';\n\n// ===== Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getTranslationsSnapshot,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.server.mjs","names":[],"sources":["../src/index.server.ts"],"sourcesContent":["'use client';\n\nimport { initializeGT } from './setup/initGT';\n/**\n * No initializeGTServer() here because we do not want to\n * initialize the AsyncConditionStore on the server side.\n *\n * No initializeGTClient() here because we do want to enforce\n * expiry times here.\n */\ninitializeGT();\n\n// ===== Pages Router ===== //\nexport { parseLocale } from './pages-dir/parseLocale';\nexport { withGTServerSideProps } from './pages-dir/withGTServerSideProps';\nexport type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';\nexport { withGTStaticProps } from './pages-dir/withGTStaticProps';\nexport type { WithGTStaticProps } from './pages-dir/withGTStaticProps';\n\n// ===== Components ===== //\nexport {\n Branch,\n Currency,\n DateTime,\n Derive,\n GTProvider,\n GtInternalTranslateJsx,\n GtInternalVar,\n T,\n LocaleSelector,\n Num,\n Plural,\n RegionSelector,\n RelativeTime,\n Var,\n} from 'gt-react';\n\n// ===== Hooks ===== //\nexport {\n useDefaultLocale,\n useGT,\n useLocaleDirection,\n useLocales,\n useLocaleProperties,\n useLocaleSelector,\n useLocale,\n useMessages,\n useRegion,\n useSetLocale,\n useTranslations,\n} from 'gt-react';\n\n// ===== Functions ===== //\nexport {\n decodeMsg,\n decodeOptions,\n decodeVars,\n declareVar,\n derive,\n getDefaultLocale,\n getLocaleProperties,\n getLocales,\n resolveCanonicalLocale,\n getTranslationsSnapshot,\n getVersionId,\n gtFallback,\n mFallback,\n msg,\n} from 'gt-react';\nexport { useLocalizeHref } from './link/useLocalizeHref';\nexport { isLocaleSupported } from './request/localeValidation';\n\n// ===== Types ===== //\nexport type { GTTranslationOptions, RuntimeTranslationOptions } from 'gt-react';\n"],"mappings":";;;;;;;;;;;;;;;;AAUA,cAAc"}
|
package/dist/index.types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { T as _T } from './server-dir/buildtime/T';
|
|
2
|
+
import { useLocalizeHref as _useLocalizeHref } from './link/useLocalizeHref';
|
|
2
3
|
import type { GetServerSideProps, GetServerSidePropsContext, PreviewData } from 'next';
|
|
3
4
|
import type { ParsedUrlQuery } from 'querystring';
|
|
4
5
|
import type { WithGTServerSideProps } from './pages-dir/withGTServerSideProps';
|
|
@@ -316,6 +317,16 @@ export declare const useTranslations: typeof _useTranslations;
|
|
|
316
317
|
* console.log(locale); // 'en-US'
|
|
317
318
|
*/
|
|
318
319
|
export declare const useLocale: typeof _useLocale;
|
|
320
|
+
/**
|
|
321
|
+
* Returns a function that localizes hrefs the same way `gt-next/link` does,
|
|
322
|
+
* for navigation that does not render a `<Link>`, such as `router.push()` or
|
|
323
|
+
* a Button `href`. Works in Server and Client Components.
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* const localizeHref = useLocalizeHref();
|
|
327
|
+
* localizeHref('/checkout'); // '/fr/checkout', or '/checkout' for the default locale
|
|
328
|
+
*/
|
|
329
|
+
export declare const useLocalizeHref: typeof _useLocalizeHref;
|
|
319
330
|
export declare const useSetLocale: typeof _useSetLocale;
|
|
320
331
|
export declare const useLocaleSelector: typeof _useLocaleSelector;
|
|
321
332
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.types.d.ts","sourceRoot":"","sources":["../src/index.types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EACzB,WAAW,EACZ,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EACV,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,eAAe,IAAI,gBAAgB,EACnC,SAAS,IAAI,UAAU,EACvB,SAAS,IAAI,UAAU,EACvB,UAAU,IAAI,WAAW,EAC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AEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,EAAE,OAAO,iBAErC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,OAAO,oBAExC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAAO,mBAEvC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,WAAW,EAAE,CACxB,SAAS,CAAC,EAAE,QAAQ,KACjB,CAAC,CAAC,SAAS,MAAM,GAAG,IAAI,GAAG,SAAS,EACvC,UAAU,EAAE,CAAC,EACb,OAAO,CAAC,EAAE,oBAAoB,KAC3B,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,CAEhC,CAAC;AAEF,YAAY,EACV,oBAAoB,EACpB,yBAAyB,EACzB,qBAAqB,EACrB,iBAAiB,GAClB,CAAC;AAEF,YAAY,EAAE,YAAY,EAAE,CAAC;AAE7B,OAAO,EACL,GAAG,EACH,SAAS,EACT,aAAa,EACb,SAAS,EACT,UAAU,EACV,MAAM,EACN,UAAU,EACV,UAAU,EACV,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,sBAAsB,EACtB,YAAY,GACb,CAAC"}
|
package/dist/link/Link.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import NextLink from 'next/link';
|
|
2
2
|
import { type ComponentProps } from 'react';
|
|
3
|
-
type
|
|
4
|
-
export type LinkProps = NextLinkProps;
|
|
3
|
+
export type LinkProps = ComponentProps<typeof NextLink>;
|
|
5
4
|
/**
|
|
6
5
|
* Locale-aware wrapper around Next.js's `<Link>` component.
|
|
7
6
|
*
|
|
@@ -9,12 +8,17 @@ export type LinkProps = NextLinkProps;
|
|
|
9
8
|
* locale string to use a specific locale, or pass `locale={false}` to leave the
|
|
10
9
|
* href unchanged. External URLs are never prefixed.
|
|
11
10
|
*
|
|
11
|
+
* With `prefixDefaultLocale: false` (the default), current default-locale links
|
|
12
|
+
* are left unprefixed. Explicit default-locale links are left unprefixed only
|
|
13
|
+
* when `enableSmartRouting` is `false`. Set these options in `withGTConfig()`
|
|
14
|
+
* so Link can read them. Use `useLocalizeHref()` to localize hrefs outside Link.
|
|
15
|
+
*
|
|
12
16
|
* @example
|
|
13
17
|
* ```tsx
|
|
14
18
|
* import Link from 'gt-next/link';
|
|
15
19
|
*
|
|
16
20
|
* export function Navigation() {
|
|
17
|
-
* return <Link href="/home">Home</Link>; // /
|
|
21
|
+
* return <Link href="/home">Home</Link>; // /fr/home, or /home for the default locale
|
|
18
22
|
* }
|
|
19
23
|
* ```
|
|
20
24
|
*
|
|
@@ -51,5 +55,4 @@ export type LinkProps = NextLinkProps;
|
|
|
51
55
|
* @returns The rendered Next.js link.
|
|
52
56
|
*/
|
|
53
57
|
export declare const Link: import("react").ForwardRefExoticComponent<any>;
|
|
54
|
-
export {};
|
|
55
58
|
//# sourceMappingURL=Link.d.ts.map
|
package/dist/link/Link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../src/link/Link.tsx"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAc,KAAK,cAAc,EAAqB,MAAM,OAAO,CAAC;AAK3E,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,QAAQ,CAAC,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,eAAO,MAAM,IAAI,gDAef,CAAC"}
|
package/dist/link/Link.js
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
4
|
-
|
|
4
|
+
const require_link_useLocalizeHref = require("./useLocalizeHref.js");
|
|
5
5
|
let react = require("react");
|
|
6
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
7
|
let next_link_js = require("next/link.js");
|
|
8
8
|
next_link_js = require_runtime.__toESM(next_link_js);
|
|
9
9
|
//#region src/link/Link.tsx
|
|
10
|
-
const LinkWithLocale = (0, react.forwardRef)(function LinkWithLocale({ href, ...props }, ref) {
|
|
11
|
-
const locale = (0, gt_react.useLocale)();
|
|
12
|
-
return renderLink({
|
|
13
|
-
...props,
|
|
14
|
-
href,
|
|
15
|
-
locale
|
|
16
|
-
}, ref);
|
|
17
|
-
});
|
|
18
10
|
/**
|
|
19
11
|
* Locale-aware wrapper around Next.js's `<Link>` component.
|
|
20
12
|
*
|
|
@@ -22,12 +14,17 @@ const LinkWithLocale = (0, react.forwardRef)(function LinkWithLocale({ href, ...
|
|
|
22
14
|
* locale string to use a specific locale, or pass `locale={false}` to leave the
|
|
23
15
|
* href unchanged. External URLs are never prefixed.
|
|
24
16
|
*
|
|
17
|
+
* With `prefixDefaultLocale: false` (the default), current default-locale links
|
|
18
|
+
* are left unprefixed. Explicit default-locale links are left unprefixed only
|
|
19
|
+
* when `enableSmartRouting` is `false`. Set these options in `withGTConfig()`
|
|
20
|
+
* so Link can read them. Use `useLocalizeHref()` to localize hrefs outside Link.
|
|
21
|
+
*
|
|
25
22
|
* @example
|
|
26
23
|
* ```tsx
|
|
27
24
|
* import Link from 'gt-next/link';
|
|
28
25
|
*
|
|
29
26
|
* export function Navigation() {
|
|
30
|
-
* return <Link href="/home">Home</Link>; // /
|
|
27
|
+
* return <Link href="/home">Home</Link>; // /fr/home, or /home for the default locale
|
|
31
28
|
* }
|
|
32
29
|
* ```
|
|
33
30
|
*
|
|
@@ -64,41 +61,22 @@ const LinkWithLocale = (0, react.forwardRef)(function LinkWithLocale({ href, ...
|
|
|
64
61
|
* @returns The rendered Next.js link.
|
|
65
62
|
*/
|
|
66
63
|
const Link = (0, react.forwardRef)(function Link({ href, locale, ...props }, ref) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
function renderLink({ href, locale, ...props }, ref) {
|
|
64
|
+
const localizeHref = require_link_useLocalizeHref.useLocalizeHref();
|
|
65
|
+
let localizedHref = href;
|
|
66
|
+
if (typeof href === "string") localizedHref = localizeHref(href, locale);
|
|
67
|
+
else if (typeof href.pathname === "string") {
|
|
68
|
+
const pathname = localizeHref(href.pathname, locale);
|
|
69
|
+
if (pathname !== href.pathname) localizedHref = {
|
|
70
|
+
...href,
|
|
71
|
+
pathname
|
|
72
|
+
};
|
|
73
|
+
}
|
|
79
74
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(next_link_js.default, {
|
|
80
75
|
...props,
|
|
81
|
-
href:
|
|
76
|
+
href: localizedHref,
|
|
82
77
|
ref
|
|
83
78
|
});
|
|
84
|
-
}
|
|
85
|
-
function localizeHref(href, locale) {
|
|
86
|
-
if (!locale) return href;
|
|
87
|
-
if (typeof href === "string") return localizePath(href, locale);
|
|
88
|
-
if (typeof href.pathname !== "string") return href;
|
|
89
|
-
const localizedPathname = localizePath(href.pathname, locale);
|
|
90
|
-
if (localizedPathname === href.pathname) return href;
|
|
91
|
-
return {
|
|
92
|
-
...href,
|
|
93
|
-
pathname: localizedPathname
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function localizePath(href, locale) {
|
|
97
|
-
if (!href.startsWith("/") || href.startsWith("//")) return href;
|
|
98
|
-
const url = new URL(href, "http://localhost");
|
|
99
|
-
url.pathname = url.pathname === "/" ? `/${encodeURIComponent(locale)}` : `/${encodeURIComponent(locale)}${url.pathname}`;
|
|
100
|
-
return `${url.pathname}${url.search}${url.hash}`;
|
|
101
|
-
}
|
|
79
|
+
});
|
|
102
80
|
//#endregion
|
|
103
81
|
exports.Link = Link;
|
|
104
82
|
|
package/dist/link/Link.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","names":["NextLink"],"sources":["../../src/link/Link.tsx"],"sourcesContent":["'use client';\n\nimport NextLink from 'next/link';\nimport {
|
|
1
|
+
{"version":3,"file":"Link.js","names":["useLocalizeHref","NextLink"],"sources":["../../src/link/Link.tsx"],"sourcesContent":["'use client';\n\nimport NextLink from 'next/link';\nimport { forwardRef, type ComponentProps, type ComponentRef } from 'react';\nimport { useLocalizeHref } from './useLocalizeHref';\n\ntype LinkRef = ComponentRef<typeof NextLink>;\n\nexport type LinkProps = ComponentProps<typeof NextLink>;\n\n/**\n * Locale-aware wrapper around Next.js's `<Link>` component.\n *\n * Internal hrefs are prefixed with the current GT locale by default. Pass a\n * locale string to use a specific locale, or pass `locale={false}` to leave the\n * href unchanged. External URLs are never prefixed.\n *\n * With `prefixDefaultLocale: false` (the default), current default-locale links\n * are left unprefixed. Explicit default-locale links are left unprefixed only\n * when `enableSmartRouting` is `false`. Set these options in `withGTConfig()`\n * so Link can read them. Use `useLocalizeHref()` to localize hrefs outside Link.\n *\n * @example\n * ```tsx\n * import Link from 'gt-next/link';\n *\n * export function Navigation() {\n * return <Link href=\"/home\">Home</Link>; // /fr/home, or /home for the default locale\n * }\n * ```\n *\n * @example\n * ```tsx\n * import Link from 'gt-next/link';\n *\n * export function LocaleSwitcher() {\n * return <Link href=\"/home\" locale=\"fr\">French</Link>; // /fr/home\n * }\n * ```\n *\n * @example\n * ```tsx\n * import Link from 'gt-next/link';\n *\n * export function UnlocalizedLink() {\n * return <Link href=\"/legal\" locale={false}>Legal</Link>; // /legal\n * }\n * ```\n *\n * @example\n * ```tsx\n * import Link from 'gt-next/link';\n *\n * export function ExternalLink() {\n * return <Link href=\"https://example.com\">Example</Link>; // https://example.com\n * }\n * ```\n *\n * @see https://nextjs.org/docs/app/api-reference/components/link\n * @param href - The destination URL or URL object. Internal paths are localized.\n * @param locale - Locale to prefix, or `false` to disable GT locale prefixing.\n * @returns The rendered Next.js link.\n */\nexport const Link = forwardRef<LinkRef, LinkProps>(function Link(\n { href, locale, ...props },\n ref\n) {\n const localizeHref = useLocalizeHref();\n\n let localizedHref = href;\n if (typeof href === 'string') {\n localizedHref = localizeHref(href, locale);\n } else if (typeof href.pathname === 'string') {\n const pathname = localizeHref(href.pathname, locale);\n if (pathname !== href.pathname) localizedHref = { ...href, pathname };\n }\n\n return <NextLink {...props} href={localizedHref} ref={ref} />;\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,MAAa,QAAA,GAAA,MAAA,YAAsC,SAAS,KAC1D,EAAE,MAAM,QAAQ,GAAG,SACnB,KACA;CACA,MAAM,eAAeA,6BAAAA,iBAAiB;CAEtC,IAAI,gBAAgB;AACpB,KAAI,OAAO,SAAS,SAClB,iBAAgB,aAAa,MAAM,OAAO;UACjC,OAAO,KAAK,aAAa,UAAU;EAC5C,MAAM,WAAW,aAAa,KAAK,UAAU,OAAO;AACpD,MAAI,aAAa,KAAK,SAAU,iBAAgB;GAAE,GAAG;GAAM;GAAU;;AAGvE,QAAO,iBAAA,GAAA,kBAAA,KAACC,aAAAA,SAAD;EAAU,GAAI;EAAO,MAAM;EAAoB;EAAO,CAAA;EAC7D"}
|
package/dist/link/Link.mjs
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { useLocalizeHref } from "./useLocalizeHref.mjs";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import NextLink from "next/link.js";
|
|
6
6
|
//#region src/link/Link.tsx
|
|
7
|
-
const LinkWithLocale = forwardRef(function LinkWithLocale({ href, ...props }, ref) {
|
|
8
|
-
const locale = useLocale();
|
|
9
|
-
return renderLink({
|
|
10
|
-
...props,
|
|
11
|
-
href,
|
|
12
|
-
locale
|
|
13
|
-
}, ref);
|
|
14
|
-
});
|
|
15
7
|
/**
|
|
16
8
|
* Locale-aware wrapper around Next.js's `<Link>` component.
|
|
17
9
|
*
|
|
@@ -19,12 +11,17 @@ const LinkWithLocale = forwardRef(function LinkWithLocale({ href, ...props }, re
|
|
|
19
11
|
* locale string to use a specific locale, or pass `locale={false}` to leave the
|
|
20
12
|
* href unchanged. External URLs are never prefixed.
|
|
21
13
|
*
|
|
14
|
+
* With `prefixDefaultLocale: false` (the default), current default-locale links
|
|
15
|
+
* are left unprefixed. Explicit default-locale links are left unprefixed only
|
|
16
|
+
* when `enableSmartRouting` is `false`. Set these options in `withGTConfig()`
|
|
17
|
+
* so Link can read them. Use `useLocalizeHref()` to localize hrefs outside Link.
|
|
18
|
+
*
|
|
22
19
|
* @example
|
|
23
20
|
* ```tsx
|
|
24
21
|
* import Link from 'gt-next/link';
|
|
25
22
|
*
|
|
26
23
|
* export function Navigation() {
|
|
27
|
-
* return <Link href="/home">Home</Link>; // /
|
|
24
|
+
* return <Link href="/home">Home</Link>; // /fr/home, or /home for the default locale
|
|
28
25
|
* }
|
|
29
26
|
* ```
|
|
30
27
|
*
|
|
@@ -61,41 +58,22 @@ const LinkWithLocale = forwardRef(function LinkWithLocale({ href, ...props }, re
|
|
|
61
58
|
* @returns The rendered Next.js link.
|
|
62
59
|
*/
|
|
63
60
|
const Link = forwardRef(function Link({ href, locale, ...props }, ref) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
function renderLink({ href, locale, ...props }, ref) {
|
|
61
|
+
const localizeHref = useLocalizeHref();
|
|
62
|
+
let localizedHref = href;
|
|
63
|
+
if (typeof href === "string") localizedHref = localizeHref(href, locale);
|
|
64
|
+
else if (typeof href.pathname === "string") {
|
|
65
|
+
const pathname = localizeHref(href.pathname, locale);
|
|
66
|
+
if (pathname !== href.pathname) localizedHref = {
|
|
67
|
+
...href,
|
|
68
|
+
pathname
|
|
69
|
+
};
|
|
70
|
+
}
|
|
76
71
|
return /* @__PURE__ */ jsx(NextLink, {
|
|
77
72
|
...props,
|
|
78
|
-
href:
|
|
73
|
+
href: localizedHref,
|
|
79
74
|
ref
|
|
80
75
|
});
|
|
81
|
-
}
|
|
82
|
-
function localizeHref(href, locale) {
|
|
83
|
-
if (!locale) return href;
|
|
84
|
-
if (typeof href === "string") return localizePath(href, locale);
|
|
85
|
-
if (typeof href.pathname !== "string") return href;
|
|
86
|
-
const localizedPathname = localizePath(href.pathname, locale);
|
|
87
|
-
if (localizedPathname === href.pathname) return href;
|
|
88
|
-
return {
|
|
89
|
-
...href,
|
|
90
|
-
pathname: localizedPathname
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
function localizePath(href, locale) {
|
|
94
|
-
if (!href.startsWith("/") || href.startsWith("//")) return href;
|
|
95
|
-
const url = new URL(href, "http://localhost");
|
|
96
|
-
url.pathname = url.pathname === "/" ? `/${encodeURIComponent(locale)}` : `/${encodeURIComponent(locale)}${url.pathname}`;
|
|
97
|
-
return `${url.pathname}${url.search}${url.hash}`;
|
|
98
|
-
}
|
|
76
|
+
});
|
|
99
77
|
//#endregion
|
|
100
78
|
export { Link };
|
|
101
79
|
|
package/dist/link/Link.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.mjs","names":[],"sources":["../../src/link/Link.tsx"],"sourcesContent":["'use client';\n\nimport NextLink from 'next/link';\nimport {
|
|
1
|
+
{"version":3,"file":"Link.mjs","names":[],"sources":["../../src/link/Link.tsx"],"sourcesContent":["'use client';\n\nimport NextLink from 'next/link';\nimport { forwardRef, type ComponentProps, type ComponentRef } from 'react';\nimport { useLocalizeHref } from './useLocalizeHref';\n\ntype LinkRef = ComponentRef<typeof NextLink>;\n\nexport type LinkProps = ComponentProps<typeof NextLink>;\n\n/**\n * Locale-aware wrapper around Next.js's `<Link>` component.\n *\n * Internal hrefs are prefixed with the current GT locale by default. Pass a\n * locale string to use a specific locale, or pass `locale={false}` to leave the\n * href unchanged. External URLs are never prefixed.\n *\n * With `prefixDefaultLocale: false` (the default), current default-locale links\n * are left unprefixed. Explicit default-locale links are left unprefixed only\n * when `enableSmartRouting` is `false`. Set these options in `withGTConfig()`\n * so Link can read them. Use `useLocalizeHref()` to localize hrefs outside Link.\n *\n * @example\n * ```tsx\n * import Link from 'gt-next/link';\n *\n * export function Navigation() {\n * return <Link href=\"/home\">Home</Link>; // /fr/home, or /home for the default locale\n * }\n * ```\n *\n * @example\n * ```tsx\n * import Link from 'gt-next/link';\n *\n * export function LocaleSwitcher() {\n * return <Link href=\"/home\" locale=\"fr\">French</Link>; // /fr/home\n * }\n * ```\n *\n * @example\n * ```tsx\n * import Link from 'gt-next/link';\n *\n * export function UnlocalizedLink() {\n * return <Link href=\"/legal\" locale={false}>Legal</Link>; // /legal\n * }\n * ```\n *\n * @example\n * ```tsx\n * import Link from 'gt-next/link';\n *\n * export function ExternalLink() {\n * return <Link href=\"https://example.com\">Example</Link>; // https://example.com\n * }\n * ```\n *\n * @see https://nextjs.org/docs/app/api-reference/components/link\n * @param href - The destination URL or URL object. Internal paths are localized.\n * @param locale - Locale to prefix, or `false` to disable GT locale prefixing.\n * @returns The rendered Next.js link.\n */\nexport const Link = forwardRef<LinkRef, LinkProps>(function Link(\n { href, locale, ...props },\n ref\n) {\n const localizeHref = useLocalizeHref();\n\n let localizedHref = href;\n if (typeof href === 'string') {\n localizedHref = localizeHref(href, locale);\n } else if (typeof href.pathname === 'string') {\n const pathname = localizeHref(href.pathname, locale);\n if (pathname !== href.pathname) localizedHref = { ...href, pathname };\n }\n\n return <NextLink {...props} href={localizedHref} ref={ref} />;\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,MAAa,OAAO,WAA+B,SAAS,KAC1D,EAAE,MAAM,QAAQ,GAAG,SACnB,KACA;CACA,MAAM,eAAe,iBAAiB;CAEtC,IAAI,gBAAgB;AACpB,KAAI,OAAO,SAAS,SAClB,iBAAgB,aAAa,MAAM,OAAO;UACjC,OAAO,KAAK,aAAa,UAAU;EAC5C,MAAM,WAAW,aAAa,KAAK,UAAU,OAAO;AACpD,MAAI,aAAa,KAAK,SAAU,iBAAgB;GAAE,GAAG;GAAM;GAAU;;AAGvE,QAAO,oBAAC,UAAD;EAAU,GAAI;EAAO,MAAM;EAAoB;EAAO,CAAA;EAC7D"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type LinkLocale } from './localize-utils';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a function that localizes hrefs the same way `gt-next/link` does,
|
|
4
|
+
* for server code such as Server Components, route handlers, and Server
|
|
5
|
+
* Actions.
|
|
6
|
+
*
|
|
7
|
+
* Internal paths are prefixed with the target locale, except default-locale
|
|
8
|
+
* paths when `prefixDefaultLocale` is `false` (an explicit default `locale`
|
|
9
|
+
* keeps its prefix while `enableSmartRouting` is on). Localized path aliases
|
|
10
|
+
* and locale availability are still resolved by the middleware. External URLs
|
|
11
|
+
* are never prefixed.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { getLocalizeHref } from 'gt-next/server';
|
|
16
|
+
*
|
|
17
|
+
* export async function CheckoutButton() {
|
|
18
|
+
* const localizeHref = await getLocalizeHref();
|
|
19
|
+
* return <Button href={localizeHref('/checkout')}>Checkout</Button>;
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @returns A promise of a function taking an href and an optional locale (a
|
|
24
|
+
* locale string, or `false` to leave the href unchanged) that returns the
|
|
25
|
+
* localized href.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getLocalizeHref(): Promise<(href: string, locale?: LinkLocale) => string>;
|
|
28
|
+
/**
|
|
29
|
+
* Server Component version of `useLocalizeHref()`: localizes hrefs the same
|
|
30
|
+
* way `gt-next/link` does, using the request locale.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* import { useLocalizeHref } from 'gt-next';
|
|
35
|
+
*
|
|
36
|
+
* export function CheckoutButton() {
|
|
37
|
+
* const localizeHref = useLocalizeHref();
|
|
38
|
+
* return <Button href={localizeHref('/checkout')}>Checkout</Button>;
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function useLocalizeHref(): (href: string, locale?: LinkLocale) => string;
|
|
43
|
+
//# sourceMappingURL=getLocalizeHref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLocalizeHref.d.ts","sourceRoot":"","sources":["../../src/link/getLocalizeHref.ts"],"names":[],"mappings":"AAGA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAC9C,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,KAAK,MAAM,CAC9C,CAKA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,WAtBtB,MAAM,WAAW,UAAU,KAAK,MAAM,CAwB9C"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../_virtual/_rolldown/runtime.js");
|
|
3
|
+
const require_link_localize_utils = require("./localize-utils.js");
|
|
4
|
+
const require_utils_use = require("../utils/use.js");
|
|
5
|
+
const require_request_getLocale = require("../request/getLocale.js");
|
|
6
|
+
let gt_i18n_internal = require("gt-i18n/internal");
|
|
7
|
+
//#region src/link/getLocalizeHref.ts
|
|
8
|
+
/**
|
|
9
|
+
* Returns a function that localizes hrefs the same way `gt-next/link` does,
|
|
10
|
+
* for server code such as Server Components, route handlers, and Server
|
|
11
|
+
* Actions.
|
|
12
|
+
*
|
|
13
|
+
* Internal paths are prefixed with the target locale, except default-locale
|
|
14
|
+
* paths when `prefixDefaultLocale` is `false` (an explicit default `locale`
|
|
15
|
+
* keeps its prefix while `enableSmartRouting` is on). Localized path aliases
|
|
16
|
+
* and locale availability are still resolved by the middleware. External URLs
|
|
17
|
+
* are never prefixed.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* import { getLocalizeHref } from 'gt-next/server';
|
|
22
|
+
*
|
|
23
|
+
* export async function CheckoutButton() {
|
|
24
|
+
* const localizeHref = await getLocalizeHref();
|
|
25
|
+
* return <Button href={localizeHref('/checkout')}>Checkout</Button>;
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @returns A promise of a function taking an href and an optional locale (a
|
|
30
|
+
* locale string, or `false` to leave the href unchanged) that returns the
|
|
31
|
+
* localized href.
|
|
32
|
+
*/
|
|
33
|
+
async function getLocalizeHref() {
|
|
34
|
+
const currentLocale = await require_request_getLocale.getLocale();
|
|
35
|
+
const defaultLocale = (0, gt_i18n_internal.getI18nConfig)().getDefaultLocale();
|
|
36
|
+
return (href, locale) => require_link_localize_utils.localizeHref(href, locale, currentLocale, defaultLocale);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Server Component version of `useLocalizeHref()`: localizes hrefs the same
|
|
40
|
+
* way `gt-next/link` does, using the request locale.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* import { useLocalizeHref } from 'gt-next';
|
|
45
|
+
*
|
|
46
|
+
* export function CheckoutButton() {
|
|
47
|
+
* const localizeHref = useLocalizeHref();
|
|
48
|
+
* return <Button href={localizeHref('/checkout')}>Checkout</Button>;
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
function useLocalizeHref() {
|
|
53
|
+
return require_utils_use.use(getLocalizeHref());
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
exports.getLocalizeHref = getLocalizeHref;
|
|
57
|
+
exports.useLocalizeHref = useLocalizeHref;
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=getLocalizeHref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLocalizeHref.js","names":["getLocale","localizeHref","use"],"sources":["../../src/link/getLocalizeHref.ts"],"sourcesContent":["import { getI18nConfig } from 'gt-i18n/internal';\nimport { getLocale } from '../request/getLocale';\nimport { use } from '../utils/use';\nimport { localizeHref, type LinkLocale } from './localize-utils';\n\n/**\n * Returns a function that localizes hrefs the same way `gt-next/link` does,\n * for server code such as Server Components, route handlers, and Server\n * Actions.\n *\n * Internal paths are prefixed with the target locale, except default-locale\n * paths when `prefixDefaultLocale` is `false` (an explicit default `locale`\n * keeps its prefix while `enableSmartRouting` is on). Localized path aliases\n * and locale availability are still resolved by the middleware. External URLs\n * are never prefixed.\n *\n * @example\n * ```tsx\n * import { getLocalizeHref } from 'gt-next/server';\n *\n * export async function CheckoutButton() {\n * const localizeHref = await getLocalizeHref();\n * return <Button href={localizeHref('/checkout')}>Checkout</Button>;\n * }\n * ```\n *\n * @returns A promise of a function taking an href and an optional locale (a\n * locale string, or `false` to leave the href unchanged) that returns the\n * localized href.\n */\nexport async function getLocalizeHref(): Promise<\n (href: string, locale?: LinkLocale) => string\n> {\n const currentLocale = await getLocale();\n const defaultLocale = getI18nConfig().getDefaultLocale();\n return (href, locale) =>\n localizeHref(href, locale, currentLocale, defaultLocale);\n}\n\n/**\n * Server Component version of `useLocalizeHref()`: localizes hrefs the same\n * way `gt-next/link` does, using the request locale.\n *\n * @example\n * ```tsx\n * import { useLocalizeHref } from 'gt-next';\n *\n * export function CheckoutButton() {\n * const localizeHref = useLocalizeHref();\n * return <Button href={localizeHref('/checkout')}>Checkout</Button>;\n * }\n * ```\n */\nexport function useLocalizeHref() {\n return use(getLocalizeHref());\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,eAAsB,kBAEpB;CACA,MAAM,gBAAgB,MAAMA,0BAAAA,WAAW;CACvC,MAAM,iBAAA,GAAA,iBAAA,gBAA+B,CAAC,kBAAkB;AACxD,SAAQ,MAAM,WACZC,4BAAAA,aAAa,MAAM,QAAQ,eAAe,cAAc;;;;;;;;;;;;;;;;AAiB5D,SAAgB,kBAAkB;AAChC,QAAOC,kBAAAA,IAAI,iBAAiB,CAAC"}
|