@lingui/conf 5.5.0 → 5.5.1

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/dist/index.cjs CHANGED
@@ -14,6 +14,9 @@ const path__default = /*#__PURE__*/_interopDefaultCompat(path);
14
14
  const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
15
15
 
16
16
  function replaceRootDir(config, rootDir) {
17
+ if (!rootDir) {
18
+ return config;
19
+ }
17
20
  return function replaceDeep(value, rootDir2) {
18
21
  const replace = (s) => s.replace("<rootDir>", rootDir2);
19
22
  if (value == null) {
@@ -41,7 +44,7 @@ function setCldrParentLocales(config) {
41
44
  fallbackLocales: {}
42
45
  };
43
46
  }
44
- if (!config.fallbackLocales.default) {
47
+ if (!config.fallbackLocales?.default) {
45
48
  config.locales.forEach((locale) => {
46
49
  const fl = getCldrParentLocale(locale.toLowerCase());
47
50
  if (fl && !config.fallbackLocales[locale]) {
@@ -380,7 +383,7 @@ function defineConfig(config) {
380
383
  }
381
384
 
382
385
  function configExists(path2) {
383
- return path2 && fs__default.existsSync(path2);
386
+ return !!path2 && fs__default.existsSync(path2);
384
387
  }
385
388
  function JitiLoader() {
386
389
  return (filepath) => {
package/dist/index.d.cts CHANGED
@@ -88,10 +88,9 @@ type CatalogConfig = {
88
88
  include: string[];
89
89
  exclude?: string[];
90
90
  };
91
- type LocaleObject = {
92
- [locale: string]: string[] | string;
93
- default?: string;
94
- };
91
+ type LocaleObject = Record<string, string[] | string> | (Record<string, string[] | string> & {
92
+ default: string;
93
+ });
95
94
  type FallbackLocales = LocaleObject;
96
95
  type ModuleSource = readonly [module: string, specifier?: string];
97
96
  type CatalogService = {
@@ -229,7 +228,7 @@ type LinguiConfig = {
229
228
  *
230
229
  * Note that using <rootDir> as a string token in any other path-based config settings will refer back to this value.
231
230
  *
232
- * @defaul: The root of the directory containing your Lingui configuration file or the package.json.
231
+ * @default: The root of the directory containing your Lingui configuration file or the package.json.
233
232
  */
234
233
  rootDir?: string;
235
234
  /**
package/dist/index.d.mts CHANGED
@@ -88,10 +88,9 @@ type CatalogConfig = {
88
88
  include: string[];
89
89
  exclude?: string[];
90
90
  };
91
- type LocaleObject = {
92
- [locale: string]: string[] | string;
93
- default?: string;
94
- };
91
+ type LocaleObject = Record<string, string[] | string> | (Record<string, string[] | string> & {
92
+ default: string;
93
+ });
95
94
  type FallbackLocales = LocaleObject;
96
95
  type ModuleSource = readonly [module: string, specifier?: string];
97
96
  type CatalogService = {
@@ -229,7 +228,7 @@ type LinguiConfig = {
229
228
  *
230
229
  * Note that using <rootDir> as a string token in any other path-based config settings will refer back to this value.
231
230
  *
232
- * @defaul: The root of the directory containing your Lingui configuration file or the package.json.
231
+ * @default: The root of the directory containing your Lingui configuration file or the package.json.
233
232
  */
234
233
  rootDir?: string;
235
234
  /**
package/dist/index.d.ts CHANGED
@@ -88,10 +88,9 @@ type CatalogConfig = {
88
88
  include: string[];
89
89
  exclude?: string[];
90
90
  };
91
- type LocaleObject = {
92
- [locale: string]: string[] | string;
93
- default?: string;
94
- };
91
+ type LocaleObject = Record<string, string[] | string> | (Record<string, string[] | string> & {
92
+ default: string;
93
+ });
95
94
  type FallbackLocales = LocaleObject;
96
95
  type ModuleSource = readonly [module: string, specifier?: string];
97
96
  type CatalogService = {
@@ -229,7 +228,7 @@ type LinguiConfig = {
229
228
  *
230
229
  * Note that using <rootDir> as a string token in any other path-based config settings will refer back to this value.
231
230
  *
232
- * @defaul: The root of the directory containing your Lingui configuration file or the package.json.
231
+ * @default: The root of the directory containing your Lingui configuration file or the package.json.
233
232
  */
234
233
  rootDir?: string;
235
234
  /**
package/dist/index.mjs CHANGED
@@ -6,6 +6,9 @@ import { cosmiconfigSync } from 'cosmiconfig';
6
6
  import { createJiti } from 'jiti';
7
7
 
8
8
  function replaceRootDir(config, rootDir) {
9
+ if (!rootDir) {
10
+ return config;
11
+ }
9
12
  return function replaceDeep(value, rootDir2) {
10
13
  const replace = (s) => s.replace("<rootDir>", rootDir2);
11
14
  if (value == null) {
@@ -33,7 +36,7 @@ function setCldrParentLocales(config) {
33
36
  fallbackLocales: {}
34
37
  };
35
38
  }
36
- if (!config.fallbackLocales.default) {
39
+ if (!config.fallbackLocales?.default) {
37
40
  config.locales.forEach((locale) => {
38
41
  const fl = getCldrParentLocale(locale.toLowerCase());
39
42
  if (fl && !config.fallbackLocales[locale]) {
@@ -372,7 +375,7 @@ function defineConfig(config) {
372
375
  }
373
376
 
374
377
  function configExists(path2) {
375
- return path2 && fs.existsSync(path2);
378
+ return !!path2 && fs.existsSync(path2);
376
379
  }
377
380
  function JitiLoader() {
378
381
  return (filepath) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/conf",
3
- "version": "5.5.0",
3
+ "version": "5.5.1",
4
4
  "sideEffects": false,
5
5
  "description": "Get lingui configuration from package.json",
6
6
  "keywords": [
@@ -45,5 +45,5 @@
45
45
  "@lingui/jest-mocks": "*",
46
46
  "unbuild": "^2.0.0"
47
47
  },
48
- "gitHead": "26700f071cd540651822b7f786d3c1d07c9d8625"
48
+ "gitHead": "3bd1384568848e15e60fb40324e9e0476ca152e6"
49
49
  }