@lingui/conf 3.17.0 → 3.17.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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.17.1](https://github.com/lingui/js-lingui/compare/v3.17.0...v3.17.1) (2023-02-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **compile:** remove verbose output when using flow with template ([#1388](https://github.com/lingui/js-lingui/issues/1388)) ([31316f9](https://github.com/lingui/js-lingui/commit/31316f938957dba8e908f9f60a452a2673a934ee))
12
+ * **conf:** lazy load cosmiconfig's TypeScriptLoader ([#1403](https://github.com/lingui/js-lingui/issues/1403)) ([617a333](https://github.com/lingui/js-lingui/commit/617a3330f6eee5ffe5670a6b41f06d0a8116fc92))
13
+
14
+
15
+
16
+
17
+
6
18
  # [3.17.0](https://github.com/lingui/js-lingui/compare/v3.16.1...v3.17.0) (2023-02-01)
7
19
 
8
20
 
package/build/index.d.ts CHANGED
@@ -1,98 +1,124 @@
1
- import type { GeneratorOptions } from "@babel/core";
1
+ import type { GeneratorOptions } from "@babel/core"
2
2
 
3
- export declare type CatalogFormat = "lingui" | "minimal" | "po" | "csv" | "po-gettext";
3
+ export declare type CatalogFormat =
4
+ | "lingui"
5
+ | "minimal"
6
+ | "po"
7
+ | "csv"
8
+ | "po-gettext"
4
9
  export type CatalogFormatOptions = {
5
- origins?: boolean;
6
- lineNumbers?: boolean;
10
+ origins?: boolean
11
+ lineNumbers?: boolean
7
12
  }
8
- export declare type OrderBy = "messageId" | "origin";
13
+ export declare type OrderBy = "messageId" | "origin"
9
14
  declare type CatalogConfig = {
10
- name?: string;
11
- path: string;
12
- include: string[];
13
- exclude?: string[];
14
- };
15
+ name?: string
16
+ path: string
17
+ include: string[]
18
+ exclude?: string[]
19
+ }
15
20
 
16
21
  export type LocaleObject = {
17
- [locale: string]: string[] | string
22
+ [locale: string]: string[] | string
18
23
  }
19
24
 
20
25
  export type DefaultLocaleObject = {
21
- default: string
26
+ default: string
22
27
  }
23
28
 
24
29
  export declare type FallbackLocales = LocaleObject | DefaultLocaleObject
25
30
 
26
31
  declare type CatalogService = {
27
- name: string;
28
- apiKey: string;
32
+ name: string
33
+ apiKey: string
29
34
  }
30
35
 
31
36
  declare type ExtractorType = {
32
- match(filename: string): boolean;
33
- extract(filename: string, targetDir: string, options?: any): void;
37
+ match(filename: string): boolean
38
+ extract(filename: string, targetDir: string, options?: any): void
34
39
  }
35
40
 
36
41
  export declare type LinguiConfig = {
37
- catalogs: CatalogConfig[];
38
- compileNamespace: "es" | "cjs" | "ts" | string;
39
- extractBabelOptions: Record<string, unknown>;
40
- compilerBabelOptions: GeneratorOptions;
41
- fallbackLocales: FallbackLocales;
42
- format: CatalogFormat;
43
- extractors?: ExtractorType[];
44
- prevFormat: CatalogFormat;
45
- formatOptions: CatalogFormatOptions;
46
- localeDir: string;
47
- locales: string[];
48
- catalogsMergePath: string;
49
- orderBy: OrderBy;
50
- pseudoLocale: string;
51
- rootDir: string;
52
- runtimeConfigModule: [source: string, identifier?: string] | {
42
+ catalogs: CatalogConfig[]
43
+ compileNamespace: "es" | "cjs" | "ts" | string
44
+ extractBabelOptions: Record<string, unknown>
45
+ compilerBabelOptions: GeneratorOptions
46
+ fallbackLocales: FallbackLocales
47
+ format: CatalogFormat
48
+ extractors?: ExtractorType[]
49
+ prevFormat: CatalogFormat
50
+ formatOptions: CatalogFormatOptions
51
+ localeDir: string
52
+ locales: string[]
53
+ catalogsMergePath: string
54
+ orderBy: OrderBy
55
+ pseudoLocale: string
56
+ rootDir: string
57
+ runtimeConfigModule:
58
+ | [source: string, identifier?: string]
59
+ | {
53
60
  i18n?: [source: string, identifier?: string]
54
61
  Trans?: [source: string, identifier?: string]
55
- };
56
- sourceLocale: string;
57
- service: CatalogService;
58
- };
59
- export declare const defaultConfig: LinguiConfig;
60
- export declare function getConfig({ cwd, configPath, skipValidation, }?: {
61
- cwd?: string;
62
- configPath?: string;
63
- skipValidation?: boolean;
64
- }): LinguiConfig;
62
+ }
63
+ sourceLocale: string
64
+ service: CatalogService
65
+ }
66
+ export declare const defaultConfig: LinguiConfig
67
+ export declare function getConfig({
68
+ cwd,
69
+ configPath,
70
+ skipValidation,
71
+ }?: {
72
+ cwd?: string
73
+ configPath?: string
74
+ skipValidation?: boolean
75
+ }): LinguiConfig
76
+
77
+ export declare function makeConfig(
78
+ userConfig: Partial<LinguiConfig>,
79
+ opts?: {
80
+ skipValidation?: boolean
81
+ }
82
+ ): LinguiConfig
83
+
65
84
  export declare const configValidation: {
66
- exampleConfig: {
67
- extractBabelOptions: {
68
- extends: string;
69
- rootMode: string;
70
- plugins: string[];
71
- presets: string[];
72
- };
73
- compilerBabelOptions: GeneratorOptions;
74
- catalogs: CatalogConfig[];
75
- compileNamespace: "es" | "ts" | "cjs" | string;
76
- fallbackLocales: FallbackLocales;
77
- format: CatalogFormat;
78
- formatOptions: CatalogFormatOptions;
79
- locales: string[];
80
- orderBy: OrderBy;
81
- pseudoLocale: string;
82
- rootDir: string;
83
- runtimeConfigModule: LinguiConfig['runtimeConfigModule'];
84
- sourceLocale: string;
85
- service: CatalogService;
86
- };
87
- deprecatedConfig: {
88
- fallbackLocale: (config: LinguiConfig & DeprecatedFallbackLanguage) => string;
89
- localeDir: (config: LinguiConfig & DeprecatedLocaleDir) => string;
90
- srcPathDirs: (config: LinguiConfig & DeprecatedLocaleDir) => string;
91
- srcPathIgnorePatterns: (config: LinguiConfig & DeprecatedLocaleDir) => string;
92
- };
93
- comment: string;
94
- };
95
- export declare function replaceRootDir(config: LinguiConfig, rootDir: string): LinguiConfig;
85
+ exampleConfig: {
86
+ extractBabelOptions: {
87
+ extends: string
88
+ rootMode: string
89
+ plugins: string[]
90
+ presets: string[]
91
+ }
92
+ compilerBabelOptions: GeneratorOptions
93
+ catalogs: CatalogConfig[]
94
+ compileNamespace: "es" | "ts" | "cjs" | string
95
+ fallbackLocales: FallbackLocales
96
+ format: CatalogFormat
97
+ formatOptions: CatalogFormatOptions
98
+ locales: string[]
99
+ orderBy: OrderBy
100
+ pseudoLocale: string
101
+ rootDir: string
102
+ runtimeConfigModule: LinguiConfig["runtimeConfigModule"]
103
+ sourceLocale: string
104
+ service: CatalogService
105
+ }
106
+ deprecatedConfig: {
107
+ fallbackLocale: (
108
+ config: LinguiConfig & DeprecatedFallbackLanguage
109
+ ) => string
110
+ localeDir: (config: LinguiConfig & DeprecatedLocaleDir) => string
111
+ srcPathDirs: (config: LinguiConfig & DeprecatedLocaleDir) => string
112
+ srcPathIgnorePatterns: (
113
+ config: LinguiConfig & DeprecatedLocaleDir
114
+ ) => string
115
+ }
116
+ comment: string
117
+ }
118
+ export declare function replaceRootDir(
119
+ config: LinguiConfig,
120
+ rootDir: string
121
+ ): LinguiConfig
96
122
  /**
97
123
  * Replace fallbackLocale with fallbackLocales
98
124
  *
@@ -100,10 +126,12 @@ export declare function replaceRootDir(config: LinguiConfig, rootDir: string): L
100
126
  * Remove anytime after 4.x
101
127
  */
102
128
  declare type DeprecatedFallbackLanguage = {
103
- fallbackLocale: string | null;
104
- };
129
+ fallbackLocale: string | null
130
+ }
105
131
 
106
- export declare function fallbackLanguageMigration(config: LinguiConfig & DeprecatedFallbackLanguage): LinguiConfig;
132
+ export declare function fallbackLanguageMigration(
133
+ config: LinguiConfig & DeprecatedFallbackLanguage
134
+ ): LinguiConfig
107
135
  /**
108
136
  * Replace localeDir, srcPathDirs and srcPathIgnorePatterns with catalogs
109
137
  *
@@ -111,10 +139,12 @@ export declare function fallbackLanguageMigration(config: LinguiConfig & Depreca
111
139
  * Remove anytime after 4.x
112
140
  */
113
141
  declare type DeprecatedLocaleDir = {
114
- localeDir: string;
115
- srcPathDirs: string[];
116
- srcPathIgnorePatterns: string[];
117
- };
118
- export declare function catalogMigration(config: LinguiConfig & DeprecatedLocaleDir): LinguiConfig;
119
- export {};
142
+ localeDir: string
143
+ srcPathDirs: string[]
144
+ srcPathIgnorePatterns: string[]
145
+ }
146
+ export declare function catalogMigration(
147
+ config: LinguiConfig & DeprecatedLocaleDir
148
+ ): LinguiConfig
149
+ export {}
120
150
  //# sourceMappingURL=index.d.ts.map
package/build/index.js CHANGED
@@ -3,31 +3,24 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.catalogMigration = catalogMigration;
7
+ exports.defaultConfig = exports.configValidation = void 0;
8
+ exports.fallbackLanguageMigration = fallbackLanguageMigration;
6
9
  exports.getConfig = getConfig;
10
+ exports.makeConfig = makeConfig;
7
11
  exports.replaceRootDir = replaceRootDir;
8
- exports.fallbackLanguageMigration = fallbackLanguageMigration;
9
- exports.catalogMigration = catalogMigration;
10
- exports.configValidation = exports.defaultConfig = void 0;
11
-
12
12
  var _path = _interopRequireDefault(require("path"));
13
-
14
13
  var _fs = _interopRequireDefault(require("fs"));
15
-
16
14
  var _chalk = _interopRequireDefault(require("chalk"));
17
-
18
15
  var _cosmiconfig = require("cosmiconfig");
19
-
20
16
  var _jestValidate = require("jest-validate");
21
-
22
- var _cosmiconfigTypescriptLoader = require("cosmiconfig-typescript-loader");
23
-
24
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
26
18
  // Enforce posix path delimiters internally
27
- const pathJoinPosix = (...values) => _path.default // normalize double slashes
28
- .join(...values) // convert platform specific path.sep to posix
19
+ const pathJoinPosix = (...values) => _path.default
20
+ // normalize double slashes
21
+ .join(...values)
22
+ // convert platform specific path.sep to posix
29
23
  .split(_path.default.sep).join("/");
30
-
31
24
  const defaultConfig = {
32
25
  catalogs: [{
33
26
  path: pathJoinPosix("<rootDir>", "locale", "{locale}", "messages"),
@@ -64,11 +57,21 @@ const defaultConfig = {
64
57
  }
65
58
  };
66
59
  exports.defaultConfig = defaultConfig;
67
-
68
60
  function configExists(path) {
69
61
  return path && _fs.default.existsSync(path);
70
62
  }
71
-
63
+ function TypeScriptLoader() {
64
+ let loaderInstance;
65
+ return (filepath, content) => {
66
+ if (!loaderInstance) {
67
+ const {
68
+ TypeScriptLoader
69
+ } = require("cosmiconfig-typescript-loader");
70
+ loaderInstance = TypeScriptLoader();
71
+ }
72
+ return loaderInstance(filepath, content);
73
+ };
74
+ }
72
75
  function getConfig({
73
76
  cwd,
74
77
  configPath,
@@ -79,28 +82,38 @@ function getConfig({
79
82
  const configExplorer = (0, _cosmiconfig.cosmiconfigSync)(moduleName, {
80
83
  searchPlaces: ["package.json", `.${moduleName}rc`, `.${moduleName}rc.json`, `.${moduleName}rc.yaml`, `.${moduleName}rc.yml`, `.${moduleName}rc.ts`, `.${moduleName}rc.js`, `${moduleName}.config.ts`, `${moduleName}.config.js`],
81
84
  loaders: {
82
- ".ts": (0, _cosmiconfigTypescriptLoader.TypeScriptLoader)()
85
+ ".ts": TypeScriptLoader()
83
86
  }
84
87
  });
85
88
  const result = configExists(configPath) ? configExplorer.load(configPath) : configExplorer.search(defaultRootDir);
86
89
  const userConfig = result ? result.config : {};
87
- const config = { ...defaultConfig,
90
+ return makeConfig({
88
91
  rootDir: result ? _path.default.dirname(result.filepath) : defaultRootDir,
89
92
  ...userConfig
93
+ }, {
94
+ skipValidation
95
+ });
96
+ }
97
+ function makeConfig(userConfig, opts = {}) {
98
+ const config = {
99
+ ...defaultConfig,
100
+ ...userConfig
90
101
  };
91
-
92
- if (!skipValidation) {
102
+ if (!opts.skipValidation) {
93
103
  (0, _jestValidate.validate)(config, configValidation);
94
- return pipe( // List config migrations from oldest to newest
95
- fallbackLanguageMigration, catalogMigration, // Custom validation
96
- validateLocales, // `replaceRootDir` should always be the last
104
+ return pipe(
105
+ // List config migrations from oldest to newest
106
+ fallbackLanguageMigration, catalogMigration,
107
+ // Custom validation
108
+ validateLocales,
109
+ // `replaceRootDir` should always be the last
97
110
  config => replaceRootDir(config, config.rootDir))(config);
98
111
  } else {
99
112
  return replaceRootDir(config, config.rootDir);
100
113
  }
101
114
  }
102
-
103
- const exampleConfig = { ...defaultConfig,
115
+ const exampleConfig = {
116
+ ...defaultConfig,
104
117
  extractors: (0, _jestValidate.multipleValidOptions)([], ["babel"], [{
105
118
  match: fileName => false,
106
119
  extract: (filename, targetDir, options) => {}
@@ -121,10 +134,10 @@ const exampleConfig = { ...defaultConfig,
121
134
  rootMode: "rootmode",
122
135
  plugins: ["plugin"],
123
136
  presets: ["preset"],
124
- targets: (0, _jestValidate.multipleValidOptions)({}, '> 0.5%', ['> 0.5%', 'not dead'], undefined),
137
+ targets: (0, _jestValidate.multipleValidOptions)({}, "> 0.5%", ["> 0.5%", "not dead"], undefined),
125
138
  assumptions: (0, _jestValidate.multipleValidOptions)({}, undefined),
126
139
  browserslistConfigFile: (0, _jestValidate.multipleValidOptions)(true, undefined),
127
- browserslistEnv: (0, _jestValidate.multipleValidOptions)('.browserslistrc', undefined)
140
+ browserslistEnv: (0, _jestValidate.multipleValidOptions)(".browserslistrc", undefined)
128
141
  }
129
142
  };
130
143
  const deprecatedConfig = {
@@ -178,20 +191,16 @@ const configValidation = {
178
191
  comment: "Documentation: https://lingui.dev/ref/conf"
179
192
  };
180
193
  exports.configValidation = configValidation;
181
-
182
194
  function validateLocales(config) {
183
195
  if (!Array.isArray(config.locales) || !config.locales.length) {
184
196
  console.error("No locales defined!\n");
185
197
  console.error(`Add ${_chalk.default.yellow("'locales'")} to your configuration. See ${_chalk.default.underline("https://lingui.dev/ref/conf#locales")}`);
186
198
  }
187
-
188
199
  return config;
189
200
  }
190
-
191
201
  function replaceRootDir(config, rootDir) {
192
202
  return function replaceDeep(value, rootDir) {
193
203
  const replace = s => s.replace("<rootDir>", rootDir);
194
-
195
204
  if (value == null) {
196
205
  return value;
197
206
  } else if (typeof value === "string") {
@@ -205,47 +214,43 @@ function replaceRootDir(config, rootDir) {
205
214
  if (key !== newKey) delete value[key];
206
215
  });
207
216
  }
208
-
209
217
  return value;
210
218
  }(config, rootDir);
211
219
  }
220
+
212
221
  /**
213
222
  * Replace fallbackLocale, by the new standard fallbackLocales
214
223
  * - https://github.com/lingui/js-lingui/issues/791
215
224
  * - Remove anytime after 4.x
216
225
  */
217
226
 
218
-
219
227
  function fallbackLanguageMigration(config) {
220
228
  const {
221
229
  fallbackLocale,
222
230
  fallbackLocales
223
231
  } = config;
224
- if (fallbackLocales === false) return { ...config,
232
+ if (fallbackLocales === false) return {
233
+ ...config,
225
234
  fallbackLocales: null
226
235
  };
227
- const DEFAULT_FALLBACK = fallbackLocales?.default || fallbackLocale;
228
-
236
+ const DEFAULT_FALLBACK = (fallbackLocales === null || fallbackLocales === void 0 ? void 0 : fallbackLocales.default) || fallbackLocale;
229
237
  if (DEFAULT_FALLBACK) {
230
238
  if (!config.fallbackLocales) config.fallbackLocales = {};
231
239
  config.fallbackLocales.default = DEFAULT_FALLBACK;
232
240
  }
233
-
234
241
  if (config.fallbackLocales !== false && !config.fallbackLocales.default) {
235
242
  config.locales.forEach(locale => {
236
243
  const fl = getCldrParentLocale(locale.toLowerCase());
237
-
238
244
  if (fl && !config.fallbackLocales[locale]) {
239
- config.fallbackLocales = { ...config.fallbackLocales,
245
+ config.fallbackLocales = {
246
+ ...config.fallbackLocales,
240
247
  [locale]: fl
241
248
  };
242
249
  }
243
250
  });
244
251
  }
245
-
246
252
  return config;
247
253
  }
248
-
249
254
  function getCldrParentLocale(sourceLocale) {
250
255
  return {
251
256
  "en-ag": "en",
@@ -424,6 +429,7 @@ function getCldrParentLocale(sourceLocale) {
424
429
  "zh-hant-mo": "zh-hant-hk"
425
430
  }[sourceLocale];
426
431
  }
432
+
427
433
  /**
428
434
  * Replace localeDir, srcPathDirs and srcPathIgnorePatterns with catalogs
429
435
  *
@@ -431,7 +437,6 @@ function getCldrParentLocale(sourceLocale) {
431
437
  * Remove anytime after 4.x
432
438
  */
433
439
 
434
-
435
440
  function catalogMigration(config) {
436
441
  let {
437
442
  localeDir,
@@ -439,30 +444,24 @@ function catalogMigration(config) {
439
444
  srcPathIgnorePatterns,
440
445
  ...newConfig
441
446
  } = config;
442
-
443
447
  if (localeDir || srcPathDirs || srcPathIgnorePatterns) {
444
448
  // Replace missing values with default ones
445
449
  if (localeDir === undefined) localeDir = pathJoinPosix("<rootDir>", "locale", "{locale}", "messages");
446
450
  if (srcPathDirs === undefined) srcPathDirs = ["<rootDir>"];
447
451
  if (srcPathIgnorePatterns === undefined) srcPathIgnorePatterns = ["**/node_modules/**"];
448
452
  let newLocaleDir = localeDir.split(_path.default.sep).join("/");
449
-
450
453
  if (newLocaleDir.slice(-1) !== _path.default.sep) {
451
454
  newLocaleDir += "/";
452
455
  }
453
-
454
456
  if (!Array.isArray(newConfig.catalogs)) {
455
457
  newConfig.catalogs = [];
456
458
  }
457
-
458
459
  newConfig.catalogs.push({
459
460
  path: pathJoinPosix(newLocaleDir, "{locale}", "messages"),
460
461
  include: srcPathDirs,
461
462
  exclude: srcPathIgnorePatterns
462
463
  });
463
464
  }
464
-
465
465
  return newConfig;
466
466
  }
467
-
468
467
  const pipe = (...functions) => args => functions.reduce((arg, fn) => fn(arg), args);
package/index.d.ts CHANGED
@@ -1,98 +1,124 @@
1
- import type { GeneratorOptions } from "@babel/core";
1
+ import type { GeneratorOptions } from "@babel/core"
2
2
 
3
- export declare type CatalogFormat = "lingui" | "minimal" | "po" | "csv" | "po-gettext";
3
+ export declare type CatalogFormat =
4
+ | "lingui"
5
+ | "minimal"
6
+ | "po"
7
+ | "csv"
8
+ | "po-gettext"
4
9
  export type CatalogFormatOptions = {
5
- origins?: boolean;
6
- lineNumbers?: boolean;
10
+ origins?: boolean
11
+ lineNumbers?: boolean
7
12
  }
8
- export declare type OrderBy = "messageId" | "origin";
13
+ export declare type OrderBy = "messageId" | "origin"
9
14
  declare type CatalogConfig = {
10
- name?: string;
11
- path: string;
12
- include: string[];
13
- exclude?: string[];
14
- };
15
+ name?: string
16
+ path: string
17
+ include: string[]
18
+ exclude?: string[]
19
+ }
15
20
 
16
21
  export type LocaleObject = {
17
- [locale: string]: string[] | string
22
+ [locale: string]: string[] | string
18
23
  }
19
24
 
20
25
  export type DefaultLocaleObject = {
21
- default: string
26
+ default: string
22
27
  }
23
28
 
24
29
  export declare type FallbackLocales = LocaleObject | DefaultLocaleObject
25
30
 
26
31
  declare type CatalogService = {
27
- name: string;
28
- apiKey: string;
32
+ name: string
33
+ apiKey: string
29
34
  }
30
35
 
31
36
  declare type ExtractorType = {
32
- match(filename: string): boolean;
33
- extract(filename: string, targetDir: string, options?: any): void;
37
+ match(filename: string): boolean
38
+ extract(filename: string, targetDir: string, options?: any): void
34
39
  }
35
40
 
36
41
  export declare type LinguiConfig = {
37
- catalogs: CatalogConfig[];
38
- compileNamespace: "es" | "cjs" | "ts" | string;
39
- extractBabelOptions: Record<string, unknown>;
40
- compilerBabelOptions: GeneratorOptions;
41
- fallbackLocales: FallbackLocales;
42
- format: CatalogFormat;
43
- extractors?: ExtractorType[];
44
- prevFormat: CatalogFormat;
45
- formatOptions: CatalogFormatOptions;
46
- localeDir: string;
47
- locales: string[];
48
- catalogsMergePath: string;
49
- orderBy: OrderBy;
50
- pseudoLocale: string;
51
- rootDir: string;
52
- runtimeConfigModule: [source: string, identifier?: string] | {
42
+ catalogs: CatalogConfig[]
43
+ compileNamespace: "es" | "cjs" | "ts" | string
44
+ extractBabelOptions: Record<string, unknown>
45
+ compilerBabelOptions: GeneratorOptions
46
+ fallbackLocales: FallbackLocales
47
+ format: CatalogFormat
48
+ extractors?: ExtractorType[]
49
+ prevFormat: CatalogFormat
50
+ formatOptions: CatalogFormatOptions
51
+ localeDir: string
52
+ locales: string[]
53
+ catalogsMergePath: string
54
+ orderBy: OrderBy
55
+ pseudoLocale: string
56
+ rootDir: string
57
+ runtimeConfigModule:
58
+ | [source: string, identifier?: string]
59
+ | {
53
60
  i18n?: [source: string, identifier?: string]
54
61
  Trans?: [source: string, identifier?: string]
55
- };
56
- sourceLocale: string;
57
- service: CatalogService;
58
- };
59
- export declare const defaultConfig: LinguiConfig;
60
- export declare function getConfig({ cwd, configPath, skipValidation, }?: {
61
- cwd?: string;
62
- configPath?: string;
63
- skipValidation?: boolean;
64
- }): LinguiConfig;
62
+ }
63
+ sourceLocale: string
64
+ service: CatalogService
65
+ }
66
+ export declare const defaultConfig: LinguiConfig
67
+ export declare function getConfig({
68
+ cwd,
69
+ configPath,
70
+ skipValidation,
71
+ }?: {
72
+ cwd?: string
73
+ configPath?: string
74
+ skipValidation?: boolean
75
+ }): LinguiConfig
76
+
77
+ export declare function makeConfig(
78
+ userConfig: Partial<LinguiConfig>,
79
+ opts?: {
80
+ skipValidation?: boolean
81
+ }
82
+ ): LinguiConfig
83
+
65
84
  export declare const configValidation: {
66
- exampleConfig: {
67
- extractBabelOptions: {
68
- extends: string;
69
- rootMode: string;
70
- plugins: string[];
71
- presets: string[];
72
- };
73
- compilerBabelOptions: GeneratorOptions;
74
- catalogs: CatalogConfig[];
75
- compileNamespace: "es" | "ts" | "cjs" | string;
76
- fallbackLocales: FallbackLocales;
77
- format: CatalogFormat;
78
- formatOptions: CatalogFormatOptions;
79
- locales: string[];
80
- orderBy: OrderBy;
81
- pseudoLocale: string;
82
- rootDir: string;
83
- runtimeConfigModule: LinguiConfig['runtimeConfigModule'];
84
- sourceLocale: string;
85
- service: CatalogService;
86
- };
87
- deprecatedConfig: {
88
- fallbackLocale: (config: LinguiConfig & DeprecatedFallbackLanguage) => string;
89
- localeDir: (config: LinguiConfig & DeprecatedLocaleDir) => string;
90
- srcPathDirs: (config: LinguiConfig & DeprecatedLocaleDir) => string;
91
- srcPathIgnorePatterns: (config: LinguiConfig & DeprecatedLocaleDir) => string;
92
- };
93
- comment: string;
94
- };
95
- export declare function replaceRootDir(config: LinguiConfig, rootDir: string): LinguiConfig;
85
+ exampleConfig: {
86
+ extractBabelOptions: {
87
+ extends: string
88
+ rootMode: string
89
+ plugins: string[]
90
+ presets: string[]
91
+ }
92
+ compilerBabelOptions: GeneratorOptions
93
+ catalogs: CatalogConfig[]
94
+ compileNamespace: "es" | "ts" | "cjs" | string
95
+ fallbackLocales: FallbackLocales
96
+ format: CatalogFormat
97
+ formatOptions: CatalogFormatOptions
98
+ locales: string[]
99
+ orderBy: OrderBy
100
+ pseudoLocale: string
101
+ rootDir: string
102
+ runtimeConfigModule: LinguiConfig["runtimeConfigModule"]
103
+ sourceLocale: string
104
+ service: CatalogService
105
+ }
106
+ deprecatedConfig: {
107
+ fallbackLocale: (
108
+ config: LinguiConfig & DeprecatedFallbackLanguage
109
+ ) => string
110
+ localeDir: (config: LinguiConfig & DeprecatedLocaleDir) => string
111
+ srcPathDirs: (config: LinguiConfig & DeprecatedLocaleDir) => string
112
+ srcPathIgnorePatterns: (
113
+ config: LinguiConfig & DeprecatedLocaleDir
114
+ ) => string
115
+ }
116
+ comment: string
117
+ }
118
+ export declare function replaceRootDir(
119
+ config: LinguiConfig,
120
+ rootDir: string
121
+ ): LinguiConfig
96
122
  /**
97
123
  * Replace fallbackLocale with fallbackLocales
98
124
  *
@@ -100,10 +126,12 @@ export declare function replaceRootDir(config: LinguiConfig, rootDir: string): L
100
126
  * Remove anytime after 4.x
101
127
  */
102
128
  declare type DeprecatedFallbackLanguage = {
103
- fallbackLocale: string | null;
104
- };
129
+ fallbackLocale: string | null
130
+ }
105
131
 
106
- export declare function fallbackLanguageMigration(config: LinguiConfig & DeprecatedFallbackLanguage): LinguiConfig;
132
+ export declare function fallbackLanguageMigration(
133
+ config: LinguiConfig & DeprecatedFallbackLanguage
134
+ ): LinguiConfig
107
135
  /**
108
136
  * Replace localeDir, srcPathDirs and srcPathIgnorePatterns with catalogs
109
137
  *
@@ -111,10 +139,12 @@ export declare function fallbackLanguageMigration(config: LinguiConfig & Depreca
111
139
  * Remove anytime after 4.x
112
140
  */
113
141
  declare type DeprecatedLocaleDir = {
114
- localeDir: string;
115
- srcPathDirs: string[];
116
- srcPathIgnorePatterns: string[];
117
- };
118
- export declare function catalogMigration(config: LinguiConfig & DeprecatedLocaleDir): LinguiConfig;
119
- export {};
142
+ localeDir: string
143
+ srcPathDirs: string[]
144
+ srcPathIgnorePatterns: string[]
145
+ }
146
+ export declare function catalogMigration(
147
+ config: LinguiConfig & DeprecatedLocaleDir
148
+ ): LinguiConfig
149
+ export {}
120
150
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/conf",
3
- "version": "3.17.0",
3
+ "version": "3.17.1",
4
4
  "sideEffects": false,
5
5
  "description": "Get lingui configuration from package.json",
6
6
  "keywords": [
@@ -19,7 +19,7 @@
19
19
  "node": ">=14.0.0"
20
20
  },
21
21
  "dependencies": {
22
- "@babel/runtime": "^7.11.2",
22
+ "@babel/runtime": "^7.20.13",
23
23
  "chalk": "^4.1.0",
24
24
  "cosmiconfig": "^8.0.0",
25
25
  "cosmiconfig-typescript-loader": "^4.3.0",
@@ -35,5 +35,17 @@
35
35
  "devDependencies": {
36
36
  "ts-node": "^10.9.1"
37
37
  },
38
- "gitHead": "1c8bc46213b35b25da8fe7a80ddcf6f6a5d9d539"
38
+ "peerDependencies": {
39
+ "ts-node": ">=10",
40
+ "typescript": ">=4"
41
+ },
42
+ "peerDependenciesMeta": {
43
+ "ts-node": {
44
+ "optional": true
45
+ },
46
+ "typescript": {
47
+ "optional": true
48
+ }
49
+ },
50
+ "gitHead": "76ef4e8d1c668578ce2c3829ebf35d22ca5e679c"
39
51
  }