next-i18next 13.1.0 → 13.1.2

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.
@@ -41,8 +41,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
41
41
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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
- var _process$env$I18NEXT_ = process.env.I18NEXT_DEFAULT_CONFIG_PATH,
45
- DEFAULT_CONFIG_PATH = _process$env$I18NEXT_ === void 0 ? './next-i18next.config.js' : _process$env$I18NEXT_;
44
+ var DEFAULT_CONFIG_PATH = process.env.I18NEXT_DEFAULT_CONFIG_PATH || './next-i18next.config.js';
46
45
  var serverSideTranslations = /*#__PURE__*/function () {
47
46
  var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(initialLocale) {
48
47
  var namespacesRequired,
@@ -90,7 +89,7 @@ var serverSideTranslations = /*#__PURE__*/function () {
90
89
  _context.next = 12;
91
90
  break;
92
91
  }
93
- throw new Error('next-i18next was unable to find a user config');
92
+ throw new Error("next-i18next was unable to find a user config at ".concat(_path["default"].resolve(DEFAULT_CONFIG_PATH)));
94
93
  case 12:
95
94
  config = (0, _createConfig.createConfig)(_objectSpread(_objectSpread({}, userConfig), {}, {
96
95
  lng: initialLocale
@@ -4,9 +4,7 @@ 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 {
8
- I18NEXT_DEFAULT_CONFIG_PATH: DEFAULT_CONFIG_PATH = './next-i18next.config.js'
9
- } = process.env;
7
+ const DEFAULT_CONFIG_PATH = process.env.I18NEXT_DEFAULT_CONFIG_PATH || './next-i18next.config.js';
10
8
  export const serverSideTranslations = async (initialLocale, namespacesRequired = undefined, configOverride = null, extraLocales = false) => {
11
9
  if (typeof initialLocale !== 'string') {
12
10
  throw new Error('Initial locale argument was not passed into serverSideTranslations');
@@ -16,7 +14,7 @@ export const serverSideTranslations = async (initialLocale, namespacesRequired =
16
14
  userConfig = await import(path.resolve(DEFAULT_CONFIG_PATH));
17
15
  }
18
16
  if (userConfig === null) {
19
- throw new Error('next-i18next was unable to find a user config');
17
+ throw new Error(`next-i18next was unable to find a user config at ${path.resolve(DEFAULT_CONFIG_PATH)}`);
20
18
  }
21
19
  const config = createConfig({
22
20
  ...userConfig,
@@ -9,8 +9,7 @@ import { createConfig } from './config/createConfig';
9
9
  import createClient from './createClient/node';
10
10
  import { globalI18n } from './appWithTranslation';
11
11
  import { getFallbackForLng, unique } from './utils';
12
- var _process$env$I18NEXT_ = process.env.I18NEXT_DEFAULT_CONFIG_PATH,
13
- DEFAULT_CONFIG_PATH = _process$env$I18NEXT_ === void 0 ? './next-i18next.config.js' : _process$env$I18NEXT_;
12
+ var DEFAULT_CONFIG_PATH = process.env.I18NEXT_DEFAULT_CONFIG_PATH || './next-i18next.config.js';
14
13
  export var serverSideTranslations = /*#__PURE__*/function () {
15
14
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(initialLocale) {
16
15
  var namespacesRequired,
@@ -56,7 +55,7 @@ export var serverSideTranslations = /*#__PURE__*/function () {
56
55
  _context.next = 12;
57
56
  break;
58
57
  }
59
- throw new Error('next-i18next was unable to find a user config');
58
+ throw new Error("next-i18next was unable to find a user config at ".concat(path.resolve(DEFAULT_CONFIG_PATH)));
60
59
  case 12:
61
60
  config = createConfig(_objectSpread(_objectSpread({}, userConfig), {}, {
62
61
  lng: initialLocale
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-i18next",
3
- "version": "13.1.0",
3
+ "version": "13.1.2",
4
4
  "repository": "git@github.com:i18next/next-i18next.git",
5
5
  "author": "i18next",
6
6
  "funding": [