@graphcommerce/lingui-next 2.1.8 → 2.1.11

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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # Change Log
2
2
 
3
+ ## 2.1.11
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1543](https://github.com/graphcommerce-org/graphcommerce/pull/1543) [`1e0a8b0a3`](https://github.com/graphcommerce-org/graphcommerce/commit/1e0a8b0a3842d150fdfd6e040b408a6fb3f76c7c) Thanks [@paales](https://github.com/paales)! - update lingui version
8
+
9
+ ## 2.1.10
10
+
11
+ ### Patch Changes
12
+
13
+ - [#1532](https://github.com/graphcommerce-org/graphcommerce/pull/1532) [`aec1f42fa`](https://github.com/graphcommerce-org/graphcommerce/commit/aec1f42fa2c02764c3071bfcccbf5eb6a13fbaef) Thanks [@paales](https://github.com/paales)! - fix: Error: useLingui hook was used without I18nProvider
14
+
15
+ ## 2.1.9
16
+
17
+ ### Patch Changes
18
+
19
+ - [#1490](https://github.com/graphcommerce-org/graphcommerce/pull/1490) [`d311ef48b`](https://github.com/graphcommerce-org/graphcommerce/commit/d311ef48bb3e97806d992af5516d6b7f183ec9cb) Thanks [@paales](https://github.com/paales)! - upgraded packages
20
+
3
21
  ## 2.1.8
4
22
 
5
23
  ### Patch Changes
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/lingui-next",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "2.1.8",
5
+ "version": "2.1.11",
6
6
  "sideEffects": false,
7
7
  "scripts": {
8
8
  "dev": "tsc -W"
@@ -14,24 +14,19 @@
14
14
  "project": "./tsconfig.json"
15
15
  }
16
16
  },
17
- "dependencies": {
18
- "@lingui/core": "^3.13.3",
19
- "@lingui/react": "^3.13.3",
20
- "babel-plugin-macros": "^3.1.0"
21
- },
22
17
  "devDependencies": {
23
- "@graphcommerce/eslint-config-pwa": "^4.1.7",
18
+ "@graphcommerce/eslint-config-pwa": "^4.1.8",
24
19
  "@graphcommerce/prettier-config-pwa": "^4.0.6",
25
20
  "@graphcommerce/typescript-config-pwa": "^4.0.3",
26
- "@lingui/conf": "^3.13.2",
21
+ "@lingui/conf": "^3.14.0",
27
22
  "@playwright/test": "^1.21.1"
28
23
  },
29
24
  "peerDependencies": {
30
- "@lingui/react": "^3.13.2",
31
25
  "@lingui/core": "^3.13.2",
26
+ "@lingui/react": "^3.13.2",
32
27
  "make-plural": "^6.2.2",
33
- "next": "12.1.2",
34
- "react": "^17.0.2",
35
- "react-dom": "^17.0.2"
28
+ "next": "^12.1.2",
29
+ "react": "^18.0.0",
30
+ "react-dom": "^18.0.0"
36
31
  }
37
32
  }
@@ -1,11 +1,13 @@
1
1
  import { i18n } from '@lingui/core'
2
2
  // eslint-disable-next-line @next/next/no-document-import-in-page
3
- import { DocumentContext } from 'next/document'
3
+ import { DocumentContext, DocumentInitialProps } from 'next/document'
4
4
  // eslint-disable-next-line @next/next/no-document-import-in-page
5
5
  import type NextDocument from 'next/document'
6
6
  import React from 'react'
7
7
  import { MessageLoader } from '../types'
8
8
 
9
+ export type LinguiDocumentProps = { linguiScriptTag: React.ReactNode }
10
+
9
11
  export function withLingui(
10
12
  Document: typeof NextDocument,
11
13
  load: MessageLoader,
@@ -23,10 +25,9 @@ export function withLingui(
23
25
  i18n.load(locale, messages)
24
26
  i18n.activate(locale)
25
27
 
26
- return {
28
+ const props: DocumentInitialProps & LinguiDocumentProps = {
27
29
  ...initial,
28
- head: [
29
- ...(React.Children.toArray(initial.head) as Array<JSX.Element | null>),
30
+ linguiScriptTag: (
30
31
  <script
31
32
  key='lingui'
32
33
  type='application/json'
@@ -34,9 +35,10 @@ export function withLingui(
34
35
  lang={locale}
35
36
  // eslint-disable-next-line react/no-danger
36
37
  dangerouslySetInnerHTML={{ __html: JSON.stringify(messages) }}
37
- />,
38
- ],
38
+ />
39
+ ),
39
40
  }
41
+ return props
40
42
  } catch (e) {
41
43
  if (process.env.NODE_ENV !== 'production') console.error(e)
42
44
  return initial