@lingo.dev/react-next 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  const require_chunk = require("./chunk.cjs");
2
2
  let _lingo_dev_react = require("@lingo.dev/react");
3
- let next_router = require("next/router");
3
+ let next_router = require("next/router.js");
4
4
  let react = require("react");
5
5
  let react_jsx_runtime = require("react/jsx-runtime");
6
- let next_head = require("next/head");
6
+ let next_head = require("next/head.js");
7
7
  next_head = require_chunk.__toESM(next_head);
8
8
  //#region src/pages/with-lingo-app.tsx
9
9
  /**
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime0 from "react/jsx-runtime";
2
2
  import { ComponentType } from "react";
3
- import { AppProps } from "next/app";
3
+ import { AppProps } from "next/app.js";
4
4
 
5
5
  //#region src/pages/with-lingo-app.d.ts
6
6
 
@@ -8,14 +8,12 @@ declare function withLingoApp<P extends AppProps>(App: ComponentType<P>): {
8
8
  (props: P): react_jsx_runtime0.JSX.Element;
9
9
  displayName: string;
10
10
  };
11
- //# sourceMappingURL=with-lingo-app.d.ts.map
12
11
  //#endregion
13
12
  //#region src/pages/use-locale-switch.d.ts
14
13
  /**
15
14
  * Hook for locale switching. Sets NEXT_LOCALE cookie + navigates via router.
16
15
  */
17
16
  declare function useLocaleSwitch(): (locale: string) => void;
18
- //# sourceMappingURL=use-locale-switch.d.ts.map
19
17
  //#endregion
20
18
  //#region src/pages/lingo-head.d.ts
21
19
  /**
@@ -30,5 +28,4 @@ declare function LingoHead({
30
28
  baseUrl
31
29
  }: LingoHeadProps): react_jsx_runtime0.JSX.Element | null;
32
30
  //#endregion
33
- export { useLocaleSwitch as n, withLingoApp as r, LingoHead as t };
34
- //# sourceMappingURL=lingo-head.d.cts.map
31
+ export { useLocaleSwitch as n, withLingoApp as r, LingoHead as t };
@@ -1,6 +1,6 @@
1
1
  import { ComponentType } from "react";
2
2
  import * as react_jsx_runtime0 from "react/jsx-runtime";
3
- import { AppProps } from "next/app";
3
+ import { AppProps } from "next/app.js";
4
4
 
5
5
  //#region src/pages/with-lingo-app.d.ts
6
6
 
@@ -8,14 +8,12 @@ declare function withLingoApp<P extends AppProps>(App: ComponentType<P>): {
8
8
  (props: P): react_jsx_runtime0.JSX.Element;
9
9
  displayName: string;
10
10
  };
11
- //# sourceMappingURL=with-lingo-app.d.ts.map
12
11
  //#endregion
13
12
  //#region src/pages/use-locale-switch.d.ts
14
13
  /**
15
14
  * Hook for locale switching. Sets NEXT_LOCALE cookie + navigates via router.
16
15
  */
17
16
  declare function useLocaleSwitch(): (locale: string) => void;
18
- //# sourceMappingURL=use-locale-switch.d.ts.map
19
17
  //#endregion
20
18
  //#region src/pages/lingo-head.d.ts
21
19
  /**
@@ -30,5 +28,4 @@ declare function LingoHead({
30
28
  baseUrl
31
29
  }: LingoHeadProps): react_jsx_runtime0.JSX.Element | null;
32
30
  //#endregion
33
- export { useLocaleSwitch as n, withLingoApp as r, LingoHead as t };
34
- //# sourceMappingURL=lingo-head.d.ts.map
31
+ export { useLocaleSwitch as n, withLingoApp as r, LingoHead as t };
@@ -1,8 +1,8 @@
1
1
  import { LingoProvider, createLingo } from "@lingo.dev/react";
2
- import { useRouter } from "next/router";
2
+ import { useRouter } from "next/router.js";
3
3
  import { useCallback, useEffect } from "react";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
- import Head from "next/head";
5
+ import Head from "next/head.js";
6
6
  //#region src/pages/with-lingo-app.tsx
7
7
  /**
8
8
  * HOC for _app.tsx. Wraps the app in LingoProvider and handles RTL direction.
@@ -63,5 +63,3 @@ function LingoHead({ baseUrl = "" }) {
63
63
  }
64
64
  //#endregion
65
65
  export { useLocaleSwitch as n, withLingoApp as r, LingoHead as t };
66
-
67
- //# sourceMappingURL=lingo-head.js.map
@@ -31,5 +31,4 @@ declare function withLingoPaths<P extends ParsedUrlQuery>(handler: () => Promise
31
31
  fallback?: false | "blocking" | true;
32
32
  }): (ctx: GetStaticPathsContext) => Promise<GetStaticPathsResult<P>>;
33
33
  //#endregion
34
- export { withLingoProps as n, withLingoPaths as t };
35
- //# sourceMappingURL=with-lingo-paths.d.cts.map
34
+ export { withLingoProps as n, withLingoPaths as t };
@@ -31,5 +31,4 @@ declare function withLingoPaths<P extends ParsedUrlQuery>(handler: () => Promise
31
31
  fallback?: false | "blocking" | true;
32
32
  }): (ctx: GetStaticPathsContext) => Promise<GetStaticPathsResult<P>>;
33
33
  //#endregion
34
- export { withLingoProps as n, withLingoPaths as t };
35
- //# sourceMappingURL=with-lingo-paths.d.ts.map
34
+ export { withLingoProps as n, withLingoPaths as t };
@@ -64,5 +64,3 @@ function withLingoPaths(handler, options) {
64
64
  }
65
65
  //#endregion
66
66
  export { withLingoProps as n, withLingoPaths as t };
67
-
68
- //# sourceMappingURL=with-lingo-paths.js.map
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@lingo.dev/react-next",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
+ "files": [
5
+ "dist"
6
+ ],
4
7
  "type": "module",
8
+ "sideEffects": false,
5
9
  "exports": {
6
10
  "./pages": {
7
11
  "import": {
@@ -34,17 +38,8 @@
34
38
  }
35
39
  }
36
40
  },
37
- "files": [
38
- "dist"
39
- ],
40
- "sideEffects": false,
41
- "peerDependencies": {
42
- "next": ">=13",
43
- "react": "^18.0.0 || ^19.0.0",
44
- "@lingo.dev/react": "1.0.2"
45
- },
46
41
  "dependencies": {
47
- "@lingo.dev/spec": "1.0.2"
42
+ "@lingo.dev/spec": "1.1.0"
48
43
  },
49
44
  "devDependencies": {
50
45
  "@testing-library/jest-dom": "^6.9.1",
@@ -52,6 +47,7 @@
52
47
  "@types/node": "^25.5.0",
53
48
  "@types/react": "^19.0.0",
54
49
  "@types/react-dom": "^19.0.0",
50
+ "@typescript/native-preview": "7.0.0-dev.20260330.1",
55
51
  "jsdom": "^27.4.0",
56
52
  "next": "^16.0.0",
57
53
  "react": "^19.0.0",
@@ -59,11 +55,16 @@
59
55
  "tsdown": "^0.12.5",
60
56
  "typescript": "^5.8.2",
61
57
  "vitest": "^4.0.18",
62
- "@lingo.dev/react": "1.0.2"
58
+ "@lingo.dev/react": "1.1.0"
59
+ },
60
+ "peerDependencies": {
61
+ "next": ">=13",
62
+ "react": "^18.0.0 || ^19.0.0",
63
+ "@lingo.dev/react": "1.1.0"
63
64
  },
64
65
  "scripts": {
65
66
  "build": "tsdown",
66
- "typecheck": "tsc --noEmit",
67
- "test": "vitest run"
67
+ "test": "vitest run",
68
+ "typecheck": "tsgo"
68
69
  }
69
70
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"lingo-head.d.cts","names":[],"sources":["../src/pages/with-lingo-app.tsx","../src/pages/use-locale-switch.ts","../src/pages/lingo-head.tsx"],"sourcesContent":[],"mappings":";;;;;;AAasD,iBAAtC,YAAsC,CAAA,UAAf,QAAe,CAAA,CAAA,GAAA,EAAA,aAAA,CAAc,CAAd,CAAA,CAAA,EAAA;QAC3B,EAAA,CAAA,CAAA,EAAC,kBAAA,CAAA,GAAA,CAAA,OAAD;aAAC,EAAA,MAAA;CAAA;;;;;;;iBCPZ,eAAA,CAAA;;;;;;;;KCCX,cAAA;EFKW;EAAY,OAAA,CAAA,EAAA,MAAA;;AAAwC,iBEApD,SAAA,CFAoD;EAAA;AAAA,CAAA,EEAxB,cFAwB,CAAA,EEAV,kBAAA,CAAA,GAAA,CAAA,OAAA,GFAU,IAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"lingo-head.d.ts","names":[],"sources":["../src/pages/with-lingo-app.tsx","../src/pages/use-locale-switch.ts","../src/pages/lingo-head.tsx"],"sourcesContent":[],"mappings":";;;;;;AAasD,iBAAtC,YAAsC,CAAA,UAAf,QAAe,CAAA,CAAA,GAAA,EAAA,aAAA,CAAc,CAAd,CAAA,CAAA,EAAA;QAC3B,EAAA,CAAA,CAAA,EAAC,kBAAA,CAAA,GAAA,CAAA,OAAD;aAAC,EAAA,MAAA;CAAA;;;;;;;iBCPZ,eAAA,CAAA;;;;;;;;KCCX,cAAA;EFKW;EAAY,OAAA,CAAA,EAAA,MAAA;;AAAwC,iBEApD,SAAA,CFAoD;EAAA;AAAA,CAAA,EEAxB,cFAwB,CAAA,EEAV,kBAAA,CAAA,GAAA,CAAA,OAAA,GFAU,IAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"lingo-head.js","names":[],"sources":["../src/pages/with-lingo-app.tsx","../src/pages/use-locale-switch.ts","../src/pages/lingo-head.tsx"],"sourcesContent":["/**\n * HOC for _app.tsx. Wraps the app in LingoProvider and handles RTL direction.\n *\n * - SSR: injects a blocking <script> to set dir=\"rtl\" before hydration (no flash)\n * - CSR: useEffect keeps dir in sync on locale change\n * - Dev mode: warns when a page is missing withLingoProps\n */\n\nimport { LingoProvider, createLingo } from \"@lingo.dev/react\";\nimport { useRouter } from \"next/router\";\nimport { useEffect, type ComponentType } from \"react\";\nimport type { AppProps } from \"next/app\";\n\nexport function withLingoApp<P extends AppProps>(App: ComponentType<P>) {\n function LingoApp(props: P) {\n const { locale, defaultLocale } = useRouter();\n const resolvedLocale = locale ?? defaultLocale ?? \"en\";\n const messages = props.pageProps?.__lingoMessages ?? {};\n const { direction } = createLingo(resolvedLocale);\n\n useEffect(() => {\n document.documentElement.dir = direction;\n }, [direction]);\n\n if (process.env.NODE_ENV === \"development\" && !props.pageProps?.__lingoMessages) {\n console.warn(\n \"[@lingo.dev/react-next] No __lingoMessages in pageProps. Add withLingoProps({ route: '...' }) to this page.\",\n );\n }\n\n return (\n <>\n {direction === \"rtl\" && <script dangerouslySetInnerHTML={{ __html: `document.documentElement.dir=\"rtl\"` }} />}\n <LingoProvider locale={resolvedLocale} messages={messages}>\n <App {...props} />\n </LingoProvider>\n </>\n );\n }\n\n LingoApp.displayName = `withLingoApp(${App.displayName || App.name || \"App\"})`;\n return LingoApp;\n}\n","/**\n * Hook for locale switching. Sets NEXT_LOCALE cookie + navigates via router.\n */\n\nimport { useRouter } from \"next/router\";\nimport { useCallback } from \"react\";\n\nexport function useLocaleSwitch() {\n const router = useRouter();\n return useCallback(\n (locale: string) => {\n document.cookie = `NEXT_LOCALE=${locale}; path=/; max-age=31536000; SameSite=Lax`;\n router.push(router.asPath, router.asPath, { locale });\n },\n [router],\n );\n}\n","/**\n * Generates <link rel=\"alternate\" hreflang=\"...\"> tags for SEO.\n * Auto-derives all locale variants from Next.js router config.\n */\n\nimport Head from \"next/head\";\nimport { useRouter } from \"next/router\";\n\ntype LingoHeadProps = {\n /** Base URL for absolute hreflang hrefs (e.g., \"https://example.com\"). Recommended for production. */\n baseUrl?: string;\n};\n\nexport function LingoHead({ baseUrl = \"\" }: LingoHeadProps) {\n const { locales, defaultLocale, asPath } = useRouter();\n\n if (!locales) return null;\n\n return (\n <Head>\n {locales.map((l) => (\n <link key={l} rel=\"alternate\" hrefLang={l} href={`${baseUrl}${l === defaultLocale ? \"\" : `/${l}`}${asPath}`} />\n ))}\n <link rel=\"alternate\" hrefLang=\"x-default\" href={`${baseUrl}${asPath}`} />\n </Head>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,aAAiC,KAAuB;CACtE,SAAS,SAAS,OAAU;EAC1B,MAAM,EAAE,QAAQ,kBAAkB,WAAW;EAC7C,MAAM,iBAAiB,UAAU,iBAAiB;EAClD,MAAM,WAAW,MAAM,WAAW,mBAAmB,EAAE;EACvD,MAAM,EAAE,cAAc,YAAY,eAAe;AAEjD,kBAAgB;AACd,YAAS,gBAAgB,MAAM;KAC9B,CAAC,UAAU,CAAC;AAEf,MAAI,QAAQ,IAAI,aAAa,iBAAiB,CAAC,MAAM,WAAW,gBAC9D,SAAQ,KACN,8GACD;AAGH,SACE,qBAAA,UAAA,EAAA,UAAA,CACG,cAAc,SAAS,oBAAC,UAAD,EAAQ,yBAAyB,EAAE,QAAQ,sCAAsC,EAAI,CAAA,EAC7G,oBAAC,eAAD;GAAe,QAAQ;GAA0B;aA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A7C,CAAkE,CAAlE,CAAA,CAAA,EAAA,CAAA,GAAA,EACT,qBADS,EAAA,GACY,OADZ,CAAA;EAAA,QAAA,EACY,KAAA,CAAA,QADZ;YAAW,CAAA,EAAA,MAAA,GAAA,OAAA;;UAAkC,EAAA,IAAA;YACtD,CAAA,EAAA,MAAA,GAAA,OAAA;;OAe0C,EAAA,CAAA,GAAI,cAAJ;YAAI,CAAA,EAAA,MAAA,GAAA,OAAA;;;;KCzB9D,SDAoB,CAAA,UCAA,cDAA,CAAA,GAAA;QAAW,ECAiB,CDAjB;;AAIqC,iBCFzD,cDEyD,CAAA,UCFhC,cDEgC,CAAA,CAAA,OAAA,EAAA,GAAA,GCDxD,ODCwD,CCDhD,SDCgD,CCDtC,CDCsC,CAAA,EAAA,CAAA,EAAA,QAAA,EAAA;UAArB,CAAA,EAAA,KAAA,GAAA,UAAA,GAAA,IAAA;QAAR,ECEvB,qBDFuB,EAAA,GCEC,ODFD,CCES,oBDFT,CCE8B,CDF9B,CAAA,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"with-lingo-paths.js","names":[],"sources":["../src/pages/load-messages.ts","../src/pages/with-lingo-props.ts","../src/pages/with-lingo-paths.ts"],"sourcesContent":["/**\n * Loads translated messages from JSONC locale files.\n * Internal module - used by withLingoProps, not exported publicly.\n *\n * Reads JSONC directly (no build step). Filters orphaned entries.\n * Splits messages by route using @src metadata from extraction.\n */\n\nimport { readLocaleFile, getActiveEntries } from \"@lingo.dev/spec\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nconst MESSAGES_DIR = \"locales\";\n\n/**\n * Loads messages for a specific locale and route.\n * Returns page-specific messages + shared messages (components, lib, etc.).\n */\nexport function loadMessages(locale: string, route: string): Record<string, string> {\n const filePath = path.resolve(process.cwd(), MESSAGES_DIR, `${locale}.jsonc`);\n\n if (!fs.existsSync(filePath)) {\n if (process.env.NODE_ENV === \"development\") {\n console.warn(`[@lingo.dev/react-next] No locale file for \"${locale}\". Run \"lingo extract && lingo localize\".`);\n }\n return {};\n }\n\n const content = fs.readFileSync(filePath, \"utf8\");\n const file = readLocaleFile(content);\n const active = getActiveEntries(file.entries);\n\n return active\n .filter((entry) => {\n if (!entry.metadata.src) return true; // no @src = shared\n const srcRoute = entry.metadata.src.replace(/\\.\\w+:\\d+$/, \"\"); // strip \".tsx:42\"\n if (srcRoute === route) return true; // exact page match\n // Non-page files (components, lib, hooks, etc.) are shared across all pages\n return !srcRoute.startsWith(\"pages/\") && !srcRoute.startsWith(\"src/pages/\");\n })\n .reduce(\n (acc, entry) => {\n acc[entry.key] = entry.value;\n return acc;\n },\n {} as Record<string, string>,\n );\n}\n","/**\n * Wraps getStaticProps/getServerSideProps to load route-specific messages.\n * Every page must use this - route is required for per-route splitting.\n */\n\nimport type { GetStaticPropsContext, GetStaticPropsResult } from \"next\";\nimport { loadMessages } from \"./load-messages\";\n\ntype WithLingoPropsConfig<P extends Record<string, any>> = {\n /** Page route for per-route message splitting (e.g., \"pages/about\"). */\n route: string;\n /** Optional handler for additional page data (custom props, revalidate, redirect, notFound). */\n handler?: (ctx: GetStaticPropsContext) => Promise<GetStaticPropsResult<P>>;\n};\n\ntype LingoPageProps = { __lingoMessages: Record<string, string> };\n\nexport function withLingoProps<P extends Record<string, any> = {}>(config: WithLingoPropsConfig<P>) {\n return async (ctx: GetStaticPropsContext) => {\n const locale = ctx.locale ?? ctx.defaultLocale ?? \"en\";\n const messages = loadMessages(locale, config.route);\n\n if (!config.handler) {\n return { props: { __lingoMessages: messages } as P & LingoPageProps };\n }\n\n const result = await config.handler(ctx);\n\n if (\"redirect\" in result) return result;\n if (\"notFound\" in result) return result;\n\n return {\n ...result,\n props: { ...result.props, __lingoMessages: messages } as P & LingoPageProps,\n };\n };\n}\n","/**\n * Wraps getStaticPaths to auto-expand paths across all configured locales.\n * Defaults to fallback: \"blocking\" for large locale x path combinations.\n */\n\nimport type { GetStaticPathsContext, GetStaticPathsResult } from \"next\";\nimport type { ParsedUrlQuery } from \"node:querystring\";\n\ntype PathEntry<P extends ParsedUrlQuery> = { params: P };\n\nexport function withLingoPaths<P extends ParsedUrlQuery>(\n handler: () => Promise<PathEntry<P>[]>,\n options?: { fallback?: false | \"blocking\" | true },\n) {\n return async (ctx: GetStaticPathsContext): Promise<GetStaticPathsResult<P>> => {\n const paths = await handler();\n const locales = ctx.locales ?? [\"en\"];\n return {\n paths: locales.flatMap((locale) => paths.map((entry) => ({ ...entry, locale }))),\n fallback: options?.fallback ?? \"blocking\",\n };\n };\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,eAAe;;;;;AAMrB,SAAgB,aAAa,QAAgB,OAAuC;CAClF,MAAM,WAAW,KAAK,QAAQ,QAAQ,KAAK,EAAE,cAAc,GAAG,OAAO,QAAQ;AAE7E,KAAI,CAAC,GAAG,WAAW,SAAS,EAAE;AAC5B,MAAI,QAAQ,IAAI,aAAa,cAC3B,SAAQ,KAAK,+CAA+C,OAAO,2CAA2C;AAEhH,SAAO,EAAE;;AAOX,QAFe,iBADF,eADG,GAAG,aAAa,UAAU,OAAO,CACb,CACC,QAAQ,CAG1C,QAAQ,UAAU;AACjB,MAAI,CAAC,MAAM,SAAS,IAAK,QAAO;EAChC,MAAM,WAAW,MAAM,SAAS,IAAI,QAAQ,cAAc,GAAG;AAC7D,MAAI,aAAa,MAAO,QAAO;AAE/B,SAAO,CAAC,SAAS,WAAW,SAAS,IAAI,CAAC,SAAS,WAAW,aAAa;GAC3E,CACD,QACE,KAAK,UAAU;AACd,MAAI,MAAM,OAAO,MAAM;AACvB,SAAO;IAET,EAAE,CACH;;;;AC7BL,SAAgB,eAAmD,QAAiC;AAClG,QAAO,OAAO,QAA+B;EAE3C,MAAM,WAAW,aADF,IAAI,UAAU,IAAI,iBAAiB,MACZ,OAAO,MAAM;AAEnD,MAAI,CAAC,OAAO,QACV,QAAO,EAAE,OAAO,EAAE,iBAAiB,UAAU,EAAwB;EAGvE,MAAM,SAAS,MAAM,OAAO,QAAQ,IAAI;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