next-i18next 13.1.3 → 13.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -357,6 +357,8 @@ module.exports = {
357
357
 
358
358
  This means that the i18n configuration file will be in the same directory as `next.config.js` and it doesn't matter where your current working directory is. This helps for example for `nx` when you have monorepo and start your application from project root but the application is in `apps/{appName}`.
359
359
 
360
+ **Notice** If your config `next-i18next.config.js` is not in the same directory as `next.config.js`, you must copy it manually (or by custom script).
361
+
360
362
  ## Notes
361
363
 
362
364
  ### Vercel and Netlify
@@ -42,6 +42,16 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
42
42
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
43
43
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
44
44
  var DEFAULT_CONFIG_PATH = './next-i18next.config.js';
45
+
46
+ /**
47
+ * One line expression like `const { I18NEXT_DEFAULT_CONFIG_PATH: DEFAULT_CONFIG_PATH = './next-i18next.config.js' } = process.env;`
48
+ * is breaking the build, so keep it like this.
49
+ *
50
+ * @see https://github.com/i18next/next-i18next/pull/2084#issuecomment-1420511358
51
+ */
52
+ if (process.env.I18NEXT_DEFAULT_CONFIG_PATH) {
53
+ DEFAULT_CONFIG_PATH = process.env.I18NEXT_DEFAULT_CONFIG_PATH;
54
+ }
45
55
  var serverSideTranslations = /*#__PURE__*/function () {
46
56
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(initialLocale) {
47
57
  var namespacesRequired,
@@ -75,7 +85,7 @@ var serverSideTranslations = /*#__PURE__*/function () {
75
85
  throw new Error('Initial locale argument was not passed into serverSideTranslations');
76
86
  case 5:
77
87
  userConfig = configOverride;
78
- configPath = _path["default"].resolve(process.env.I18NEXT_DEFAULT_CONFIG_PATH || DEFAULT_CONFIG_PATH);
88
+ configPath = _path["default"].resolve(DEFAULT_CONFIG_PATH);
79
89
  if (!(!userConfig && _fs["default"].existsSync(configPath))) {
80
90
  _context.next = 11;
81
91
  break;
@@ -4,13 +4,23 @@ import { createConfig } from './config/createConfig';
4
4
  import createClient from './createClient/node';
5
5
  import { globalI18n } from './appWithTranslation';
6
6
  import { getFallbackForLng, unique } from './utils';
7
- const DEFAULT_CONFIG_PATH = './next-i18next.config.js';
7
+ let DEFAULT_CONFIG_PATH = './next-i18next.config.js';
8
+
9
+ /**
10
+ * One line expression like `const { I18NEXT_DEFAULT_CONFIG_PATH: DEFAULT_CONFIG_PATH = './next-i18next.config.js' } = process.env;`
11
+ * is breaking the build, so keep it like this.
12
+ *
13
+ * @see https://github.com/i18next/next-i18next/pull/2084#issuecomment-1420511358
14
+ */
15
+ if (process.env.I18NEXT_DEFAULT_CONFIG_PATH) {
16
+ DEFAULT_CONFIG_PATH = process.env.I18NEXT_DEFAULT_CONFIG_PATH;
17
+ }
8
18
  export const serverSideTranslations = async (initialLocale, namespacesRequired = undefined, configOverride = null, extraLocales = false) => {
9
19
  if (typeof initialLocale !== 'string') {
10
20
  throw new Error('Initial locale argument was not passed into serverSideTranslations');
11
21
  }
12
22
  let userConfig = configOverride;
13
- const configPath = path.resolve(process.env.I18NEXT_DEFAULT_CONFIG_PATH || DEFAULT_CONFIG_PATH);
23
+ const configPath = path.resolve(DEFAULT_CONFIG_PATH);
14
24
  if (!userConfig && fs.existsSync(configPath)) {
15
25
  userConfig = await import(configPath);
16
26
  }
@@ -10,6 +10,16 @@ import createClient from './createClient/node';
10
10
  import { globalI18n } from './appWithTranslation';
11
11
  import { getFallbackForLng, unique } from './utils';
12
12
  var DEFAULT_CONFIG_PATH = './next-i18next.config.js';
13
+
14
+ /**
15
+ * One line expression like `const { I18NEXT_DEFAULT_CONFIG_PATH: DEFAULT_CONFIG_PATH = './next-i18next.config.js' } = process.env;`
16
+ * is breaking the build, so keep it like this.
17
+ *
18
+ * @see https://github.com/i18next/next-i18next/pull/2084#issuecomment-1420511358
19
+ */
20
+ if (process.env.I18NEXT_DEFAULT_CONFIG_PATH) {
21
+ DEFAULT_CONFIG_PATH = process.env.I18NEXT_DEFAULT_CONFIG_PATH;
22
+ }
13
23
  export var serverSideTranslations = /*#__PURE__*/function () {
14
24
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(initialLocale) {
15
25
  var namespacesRequired,
@@ -43,7 +53,7 @@ export var serverSideTranslations = /*#__PURE__*/function () {
43
53
  throw new Error('Initial locale argument was not passed into serverSideTranslations');
44
54
  case 5:
45
55
  userConfig = configOverride;
46
- configPath = path.resolve(process.env.I18NEXT_DEFAULT_CONFIG_PATH || DEFAULT_CONFIG_PATH);
56
+ configPath = path.resolve(DEFAULT_CONFIG_PATH);
47
57
  if (!(!userConfig && fs.existsSync(configPath))) {
48
58
  _context.next = 11;
49
59
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-i18next",
3
- "version": "13.1.3",
3
+ "version": "13.1.5",
4
4
  "repository": "git@github.com:i18next/next-i18next.git",
5
5
  "author": "i18next",
6
6
  "funding": [
@@ -81,67 +81,67 @@
81
81
  "prepare": "husky install"
82
82
  },
83
83
  "devDependencies": {
84
- "@babel/cli": "7.19.3",
85
- "@babel/core": "7.20.5",
84
+ "@babel/cli": "7.20.7",
85
+ "@babel/core": "7.20.12",
86
86
  "@babel/plugin-proposal-class-properties": "7.18.6",
87
87
  "@babel/plugin-transform-runtime": "7.19.6",
88
88
  "@babel/preset-env": "7.20.2",
89
89
  "@babel/preset-react": "7.18.6",
90
90
  "@babel/preset-typescript": "7.18.6",
91
- "@size-limit/file": "^8.1.0",
92
- "@size-limit/webpack": "^8.1.0",
93
- "@size-limit/webpack-why": "^8.1.0",
91
+ "@size-limit/file": "^8.1.2",
92
+ "@size-limit/webpack": "^8.1.2",
93
+ "@size-limit/webpack-why": "^8.1.2",
94
94
  "@testing-library/react": "^13.4.0",
95
- "@types/jest": "^29.2.4",
96
- "@types/node": "^18.11.15",
97
- "@types/react": "^18.0.26",
98
- "@types/react-dom": "^18.0.9",
95
+ "@types/jest": "^29.4.0",
96
+ "@types/node": "^18.13.0",
97
+ "@types/react": "^18.0.27",
98
+ "@types/react-dom": "^18.0.10",
99
99
  "@types/testing-library__cypress": "^5.0.9",
100
- "@typescript-eslint/eslint-plugin": "^5.46.1",
101
- "@typescript-eslint/parser": "^5.46.1",
100
+ "@typescript-eslint/eslint-plugin": "^5.51.0",
101
+ "@typescript-eslint/parser": "^5.51.0",
102
102
  "all-contributors-cli": "^6.24.0",
103
103
  "babel-core": "7.0.0-bridge.0",
104
104
  "babel-plugin-add-module-exports": "1.0.4",
105
105
  "babel-plugin-transform-async-to-generator": "6.24.1",
106
106
  "cpy-cli": "^4.2.0",
107
107
  "cypress": "^11.0.1",
108
- "es-check": "^7.0.1",
109
- "eslint": "^8.29.0",
110
- "eslint-config-prettier": "^8.5.0",
108
+ "es-check": "^7.1.0",
109
+ "eslint": "^8.33.0",
110
+ "eslint-config-prettier": "^8.6.0",
111
111
  "eslint-plugin-cypress": "^2.12.1",
112
- "eslint-plugin-import": "^2.26.0",
113
- "eslint-plugin-jest": "^27.1.6",
112
+ "eslint-plugin-import": "^2.27.5",
113
+ "eslint-plugin-jest": "^27.2.1",
114
114
  "eslint-plugin-prefer-arrow": "^1.2.3",
115
- "eslint-plugin-react": "^7.31.11",
115
+ "eslint-plugin-react": "^7.32.2",
116
116
  "eslint-plugin-typescript-sort-keys": "^2.1.0",
117
- "gh-release": "6.0.4",
118
- "husky": "^8.0.2",
119
- "i18next": "^22.4.5",
120
- "jest": "^29.3.1",
121
- "jest-environment-jsdom": "^29.3.1",
122
- "next": "^13.0.7",
117
+ "gh-release": "7.0.2",
118
+ "husky": "^8.0.3",
119
+ "i18next": "^22.4.9",
120
+ "jest": "^29.4.2",
121
+ "jest-environment-jsdom": "^29.4.2",
122
+ "next": "^13.1.6",
123
123
  "npm-run-all": "^4.1.5",
124
- "prettier": "2.8.1",
124
+ "prettier": "2.8.3",
125
125
  "react": "^18.2.0",
126
126
  "react-dom": "^18.2.0",
127
- "react-i18next": "^12.1.1",
128
- "rimraf": "^3.0.2",
129
- "size-limit": "^8.1.0",
130
- "start-server-and-test": "^1.15.2",
131
- "typescript": "^4.9.4",
127
+ "react-i18next": "^12.1.5",
128
+ "rimraf": "^4.1.2",
129
+ "size-limit": "^8.1.2",
130
+ "start-server-and-test": "^1.15.3",
131
+ "typescript": "^4.9.5",
132
132
  "webpack": "^5.75.0"
133
133
  },
134
134
  "dependencies": {
135
- "@babel/runtime": "^7.20.6",
135
+ "@babel/runtime": "^7.20.13",
136
136
  "@types/hoist-non-react-statics": "^3.3.1",
137
137
  "core-js": "^3",
138
138
  "hoist-non-react-statics": "^3.3.2",
139
- "i18next-fs-backend": "^2.1.0"
139
+ "i18next-fs-backend": "^2.1.1"
140
140
  },
141
141
  "peerDependencies": {
142
142
  "i18next": "^22.0.6",
143
143
  "next": ">= 12.0.0",
144
144
  "react": ">= 17.0.2",
145
- "react-i18next": "^12.1.1"
145
+ "react-i18next": "^12.1.5"
146
146
  }
147
147
  }