@lingui/conf 3.15.0 → 3.16.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 +386 -0
- package/build/LICENSE +21 -0
- package/build/index.d.ts +120 -0
- package/build/index.js +484 -0
- package/index.d.ts +5 -2
- package/index.js +1 -481
- package/package.json +5 -4
package/index.js
CHANGED
|
@@ -1,481 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.getConfig = getConfig;
|
|
9
|
-
exports.replaceRootDir = replaceRootDir;
|
|
10
|
-
exports.fallbackLanguageMigration = fallbackLanguageMigration;
|
|
11
|
-
exports.catalogMigration = catalogMigration;
|
|
12
|
-
exports.configValidation = exports.defaultConfig = void 0;
|
|
13
|
-
|
|
14
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
|
-
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
17
|
-
|
|
18
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
-
|
|
20
|
-
var _path = _interopRequireDefault(require("path"));
|
|
21
|
-
|
|
22
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
23
|
-
|
|
24
|
-
var _chalk = _interopRequireDefault(require("chalk"));
|
|
25
|
-
|
|
26
|
-
var _cosmiconfig = require("cosmiconfig");
|
|
27
|
-
|
|
28
|
-
var _jestValidate = require("jest-validate");
|
|
29
|
-
|
|
30
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
31
|
-
|
|
32
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
33
|
-
|
|
34
|
-
// Enforce posix path delimiters internally
|
|
35
|
-
var pathJoinPosix = function pathJoinPosix() {
|
|
36
|
-
return _path.default // normalize double slashes
|
|
37
|
-
.join.apply(_path.default // normalize double slashes
|
|
38
|
-
, arguments) // convert platform specific path.sep to posix
|
|
39
|
-
.split(_path.default.sep).join("/");
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
var defaultConfig = {
|
|
43
|
-
catalogs: [{
|
|
44
|
-
path: pathJoinPosix("<rootDir>", "locale", "{locale}", "messages"),
|
|
45
|
-
include: ["<rootDir>"],
|
|
46
|
-
exclude: ["*/node_modules/*"]
|
|
47
|
-
}],
|
|
48
|
-
catalogsMergePath: "",
|
|
49
|
-
compileNamespace: "cjs",
|
|
50
|
-
compilerBabelOptions: {
|
|
51
|
-
minified: true,
|
|
52
|
-
jsescOption: {
|
|
53
|
-
minimal: true
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
extractBabelOptions: {
|
|
57
|
-
plugins: [],
|
|
58
|
-
presets: []
|
|
59
|
-
},
|
|
60
|
-
fallbackLocales: {},
|
|
61
|
-
format: "po",
|
|
62
|
-
formatOptions: {
|
|
63
|
-
origins: true,
|
|
64
|
-
lineNumbers: true
|
|
65
|
-
},
|
|
66
|
-
locales: [],
|
|
67
|
-
orderBy: "messageId",
|
|
68
|
-
pseudoLocale: "",
|
|
69
|
-
rootDir: ".",
|
|
70
|
-
runtimeConfigModule: ["@lingui/core", "i18n"],
|
|
71
|
-
sourceLocale: "",
|
|
72
|
-
service: {
|
|
73
|
-
name: "",
|
|
74
|
-
apiKey: ""
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
exports.defaultConfig = defaultConfig;
|
|
78
|
-
|
|
79
|
-
function configExists(path) {
|
|
80
|
-
return path && _fs.default.existsSync(path);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function getConfig() {
|
|
84
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
85
|
-
cwd = _ref.cwd,
|
|
86
|
-
configPath = _ref.configPath,
|
|
87
|
-
_ref$skipValidation = _ref.skipValidation,
|
|
88
|
-
skipValidation = _ref$skipValidation === void 0 ? false : _ref$skipValidation;
|
|
89
|
-
|
|
90
|
-
var defaultRootDir = cwd || process.cwd();
|
|
91
|
-
var moduleName = "lingui";
|
|
92
|
-
var configExplorer = (0, _cosmiconfig.cosmiconfigSync)(moduleName, {
|
|
93
|
-
searchPlaces: ["package.json", ".".concat(moduleName, "rc"), ".".concat(moduleName, "rc.json"), ".".concat(moduleName, "rc.yaml"), ".".concat(moduleName, "rc.yml"), ".".concat(moduleName, "rc.ts"), ".".concat(moduleName, "rc.js"), "".concat(moduleName, ".config.ts"), "".concat(moduleName, ".config.js")],
|
|
94
|
-
loaders: {
|
|
95
|
-
".ts": TypeScriptLoader
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
var result = configExists(configPath) ? configExplorer.load(configPath) : configExplorer.search(defaultRootDir);
|
|
99
|
-
var userConfig = result ? result.config : {};
|
|
100
|
-
|
|
101
|
-
var config = _objectSpread(_objectSpread({}, defaultConfig), {}, {
|
|
102
|
-
rootDir: result ? _path.default.dirname(result.filepath) : defaultRootDir
|
|
103
|
-
}, userConfig);
|
|
104
|
-
|
|
105
|
-
if (!skipValidation) {
|
|
106
|
-
(0, _jestValidate.validate)(config, configValidation);
|
|
107
|
-
return pipe( // List config migrations from oldest to newest
|
|
108
|
-
fallbackLanguageMigration, catalogMigration, // Custom validation
|
|
109
|
-
validateLocales, // `replaceRootDir` should always be the last
|
|
110
|
-
function (config) {
|
|
111
|
-
return replaceRootDir(config, config.rootDir);
|
|
112
|
-
})(config);
|
|
113
|
-
} else {
|
|
114
|
-
return replaceRootDir(config, config.rootDir);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
var exampleConfig = _objectSpread(_objectSpread({}, defaultConfig), {}, {
|
|
119
|
-
extractors: (0, _jestValidate.multipleValidOptions)([], ["babel"], [{
|
|
120
|
-
match: function match(fileName) {
|
|
121
|
-
return false;
|
|
122
|
-
},
|
|
123
|
-
extract: function extract(filename, targetDir, options) {}
|
|
124
|
-
}]),
|
|
125
|
-
runtimeConfigModule: (0, _jestValidate.multipleValidOptions)({
|
|
126
|
-
i18n: ["@lingui/core", "i18n"],
|
|
127
|
-
Trans: ["@lingui/react", "Trans"]
|
|
128
|
-
}, ["@lingui/core", "i18n"]),
|
|
129
|
-
fallbackLocales: (0, _jestValidate.multipleValidOptions)({}, {
|
|
130
|
-
"en-US": "en"
|
|
131
|
-
}, {
|
|
132
|
-
"en-US": ["en"]
|
|
133
|
-
}, {
|
|
134
|
-
default: "en"
|
|
135
|
-
}, false),
|
|
136
|
-
extractBabelOptions: {
|
|
137
|
-
extends: "babelconfig.js",
|
|
138
|
-
rootMode: "rootmode",
|
|
139
|
-
plugins: ["plugin"],
|
|
140
|
-
presets: ["preset"],
|
|
141
|
-
targets: (0, _jestValidate.multipleValidOptions)({}, '> 0.5%', ['> 0.5%', 'not dead'], undefined),
|
|
142
|
-
assumptions: (0, _jestValidate.multipleValidOptions)({}, undefined),
|
|
143
|
-
browserslistConfigFile: (0, _jestValidate.multipleValidOptions)(true, undefined),
|
|
144
|
-
browserslistEnv: (0, _jestValidate.multipleValidOptions)('.browserslistrc', undefined)
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
var deprecatedConfig = {
|
|
149
|
-
fallbackLocale: function fallbackLocale(config) {
|
|
150
|
-
return " Option ".concat(_chalk.default.bold("fallbackLocale"), " was replaced by ").concat(_chalk.default.bold("fallbackLocales"), "\n\n You can find more information here: https://github.com/lingui/js-lingui/issues/791\n\n @lingui/cli now treats your current configuration as:\n {\n ").concat(_chalk.default.bold('"fallbackLocales"'), ": {\n default: ").concat(_chalk.default.bold("\"".concat(config.fallbackLocale, "\"")), "\n }\n }\n\n Please update your configuration.\n ");
|
|
151
|
-
},
|
|
152
|
-
localeDir: function localeDir(config) {
|
|
153
|
-
return " Option ".concat(_chalk.default.bold("localeDir"), " is deprecated. Configure source paths using ").concat(_chalk.default.bold("catalogs"), " instead.\n\n @lingui/cli now treats your current configuration as:\n\n {\n ").concat(_chalk.default.bold('"catalogs"'), ": ").concat(JSON.stringify(catalogMigration(config).catalogs, null, 2), "\n }\n\n Please update your configuration.\n ");
|
|
154
|
-
},
|
|
155
|
-
srcPathDirs: function srcPathDirs(config) {
|
|
156
|
-
return " Option ".concat(_chalk.default.bold("srcPathDirs"), " is deprecated. Configure source paths using ").concat(_chalk.default.bold("catalogs"), " instead.\n\n @lingui/cli now treats your current configuration as:\n\n {\n ").concat(_chalk.default.bold('"catalogs"'), ": ").concat(JSON.stringify(catalogMigration(config).catalogs, null, 2), "\n }\n\n Please update your configuration.\n ");
|
|
157
|
-
},
|
|
158
|
-
srcPathIgnorePatterns: function srcPathIgnorePatterns(config) {
|
|
159
|
-
return " Option ".concat(_chalk.default.bold("srcPathIgnorePatterns"), " is deprecated. Configure excluded source paths using ").concat(_chalk.default.bold("catalogs"), " instead.\n\n @lingui/cli now treats your current configuration as:\n\n {\n ").concat(_chalk.default.bold('"catalogs"'), ": ").concat(JSON.stringify(catalogMigration(config).catalogs, null, 2), "\n }\n\n Please update your configuration.\n ");
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
var configValidation = {
|
|
163
|
-
exampleConfig: exampleConfig,
|
|
164
|
-
deprecatedConfig: deprecatedConfig,
|
|
165
|
-
comment: "Documentation: https://lingui.js.org/ref/conf.html"
|
|
166
|
-
};
|
|
167
|
-
exports.configValidation = configValidation;
|
|
168
|
-
|
|
169
|
-
function validateLocales(config) {
|
|
170
|
-
if (!Array.isArray(config.locales) || !config.locales.length) {
|
|
171
|
-
console.error("No locales defined!\n");
|
|
172
|
-
console.error("Add ".concat(_chalk.default.yellow("'locales'"), " to your configuration. See ").concat(_chalk.default.underline("https://lingui.js.org/ref/conf.html#locales")));
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return config;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function replaceRootDir(config, rootDir) {
|
|
179
|
-
return function replaceDeep(value, rootDir) {
|
|
180
|
-
var replace = function replace(s) {
|
|
181
|
-
return s.replace("<rootDir>", rootDir);
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
if (value == null) {
|
|
185
|
-
return value;
|
|
186
|
-
} else if (typeof value === "string") {
|
|
187
|
-
return replace(value);
|
|
188
|
-
} else if (Array.isArray(value)) {
|
|
189
|
-
return value.map(function (item) {
|
|
190
|
-
return replaceDeep(item, rootDir);
|
|
191
|
-
});
|
|
192
|
-
} else if ((0, _typeof2.default)(value) === "object") {
|
|
193
|
-
Object.keys(value).forEach(function (key) {
|
|
194
|
-
var newKey = replaceDeep(key, rootDir);
|
|
195
|
-
value[newKey] = replaceDeep(value[key], rootDir);
|
|
196
|
-
if (key !== newKey) delete value[key];
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return value;
|
|
201
|
-
}(config, rootDir);
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Replace fallbackLocale, by the new standard fallbackLocales
|
|
205
|
-
* - https://github.com/lingui/js-lingui/issues/791
|
|
206
|
-
* - Remove anytime after 4.x
|
|
207
|
-
*/
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
function fallbackLanguageMigration(config) {
|
|
211
|
-
var fallbackLocale = config.fallbackLocale,
|
|
212
|
-
fallbackLocales = config.fallbackLocales;
|
|
213
|
-
if (fallbackLocales === false) return _objectSpread(_objectSpread({}, config), {}, {
|
|
214
|
-
fallbackLocales: null
|
|
215
|
-
});
|
|
216
|
-
var DEFAULT_FALLBACK = (fallbackLocales === null || fallbackLocales === void 0 ? void 0 : fallbackLocales.default) || fallbackLocale;
|
|
217
|
-
|
|
218
|
-
if (DEFAULT_FALLBACK) {
|
|
219
|
-
if (!config.fallbackLocales) config.fallbackLocales = {};
|
|
220
|
-
config.fallbackLocales.default = DEFAULT_FALLBACK;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
if (config.fallbackLocales !== false && !config.fallbackLocales.default) {
|
|
224
|
-
config.locales.forEach(function (locale) {
|
|
225
|
-
var fl = getCldrParentLocale(locale.toLowerCase());
|
|
226
|
-
|
|
227
|
-
if (fl && !config.fallbackLocales[locale]) {
|
|
228
|
-
config.fallbackLocales = _objectSpread(_objectSpread({}, config.fallbackLocales), {}, (0, _defineProperty2.default)({}, locale, fl));
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
return config;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function getCldrParentLocale(sourceLocale) {
|
|
237
|
-
return {
|
|
238
|
-
"en-ag": "en",
|
|
239
|
-
"en-ai": "en",
|
|
240
|
-
"en-au": "en",
|
|
241
|
-
"en-bb": "en",
|
|
242
|
-
"en-bm": "en",
|
|
243
|
-
"en-bs": "en",
|
|
244
|
-
"en-bw": "en",
|
|
245
|
-
"en-bz": "en",
|
|
246
|
-
"en-ca": "en",
|
|
247
|
-
"en-cc": "en",
|
|
248
|
-
"en-ck": "en",
|
|
249
|
-
"en-cm": "en",
|
|
250
|
-
"en-cx": "en",
|
|
251
|
-
"en-cy": "en",
|
|
252
|
-
"en-dg": "en",
|
|
253
|
-
"en-dm": "en",
|
|
254
|
-
"en-er": "en",
|
|
255
|
-
"en-fj": "en",
|
|
256
|
-
"en-fk": "en",
|
|
257
|
-
"en-fm": "en",
|
|
258
|
-
"en-gb": "en",
|
|
259
|
-
"en-gd": "en",
|
|
260
|
-
"en-gg": "en",
|
|
261
|
-
"en-gh": "en",
|
|
262
|
-
"en-gi": "en",
|
|
263
|
-
"en-gm": "en",
|
|
264
|
-
"en-gy": "en",
|
|
265
|
-
"en-hk": "en",
|
|
266
|
-
"en-ie": "en",
|
|
267
|
-
"en-il": "en",
|
|
268
|
-
"en-im": "en",
|
|
269
|
-
"en-in": "en",
|
|
270
|
-
"en-io": "en",
|
|
271
|
-
"en-je": "en",
|
|
272
|
-
"en-jm": "en",
|
|
273
|
-
"en-ke": "en",
|
|
274
|
-
"en-ki": "en",
|
|
275
|
-
"en-kn": "en",
|
|
276
|
-
"en-ky": "en",
|
|
277
|
-
"en-lc": "en",
|
|
278
|
-
"en-lr": "en",
|
|
279
|
-
"en-ls": "en",
|
|
280
|
-
"en-mg": "en",
|
|
281
|
-
"en-mo": "en",
|
|
282
|
-
"en-ms": "en",
|
|
283
|
-
"en-mt": "en",
|
|
284
|
-
"en-mu": "en",
|
|
285
|
-
"en-mw": "en",
|
|
286
|
-
"en-my": "en",
|
|
287
|
-
"en-na": "en",
|
|
288
|
-
"en-nf": "en",
|
|
289
|
-
"en-ng": "en",
|
|
290
|
-
"en-nr": "en",
|
|
291
|
-
"en-nu": "en",
|
|
292
|
-
"en-nz": "en",
|
|
293
|
-
"en-pg": "en",
|
|
294
|
-
"en-ph": "en",
|
|
295
|
-
"en-pk": "en",
|
|
296
|
-
"en-pn": "en",
|
|
297
|
-
"en-pw": "en",
|
|
298
|
-
"en-rw": "en",
|
|
299
|
-
"en-sb": "en",
|
|
300
|
-
"en-sc": "en",
|
|
301
|
-
"en-sd": "en",
|
|
302
|
-
"en-sg": "en",
|
|
303
|
-
"en-sh": "en",
|
|
304
|
-
"en-sl": "en",
|
|
305
|
-
"en-ss": "en",
|
|
306
|
-
"en-sx": "en",
|
|
307
|
-
"en-sz": "en",
|
|
308
|
-
"en-tc": "en",
|
|
309
|
-
"en-tk": "en",
|
|
310
|
-
"en-to": "en",
|
|
311
|
-
"en-tt": "en",
|
|
312
|
-
"en-tv": "en",
|
|
313
|
-
"en-tz": "en",
|
|
314
|
-
"en-ug": "en",
|
|
315
|
-
"en-us": "en",
|
|
316
|
-
"en-vc": "en",
|
|
317
|
-
"en-vg": "en",
|
|
318
|
-
"en-vu": "en",
|
|
319
|
-
"en-ws": "en",
|
|
320
|
-
"en-za": "en",
|
|
321
|
-
"en-zm": "en",
|
|
322
|
-
"en-zw": "en",
|
|
323
|
-
"en-at": "en",
|
|
324
|
-
"en-be": "en",
|
|
325
|
-
"en-ch": "en",
|
|
326
|
-
"en-de": "en",
|
|
327
|
-
"en-dk": "en",
|
|
328
|
-
"en-fi": "en",
|
|
329
|
-
"en-nl": "en",
|
|
330
|
-
"en-se": "en",
|
|
331
|
-
"en-si": "en",
|
|
332
|
-
"es-ar": "es",
|
|
333
|
-
"es-bo": "es",
|
|
334
|
-
"es-br": "es",
|
|
335
|
-
"es-bz": "es",
|
|
336
|
-
"es-cl": "es",
|
|
337
|
-
"es-co": "es",
|
|
338
|
-
"es-cr": "es",
|
|
339
|
-
"es-cu": "es",
|
|
340
|
-
"es-do": "es",
|
|
341
|
-
"es-ec": "es",
|
|
342
|
-
"es-es": "es",
|
|
343
|
-
"es-gt": "es",
|
|
344
|
-
"es-hn": "es",
|
|
345
|
-
"es-mx": "es",
|
|
346
|
-
"es-ni": "es",
|
|
347
|
-
"es-pa": "es",
|
|
348
|
-
"es-pe": "es",
|
|
349
|
-
"es-pr": "es",
|
|
350
|
-
"es-py": "es",
|
|
351
|
-
"es-sv": "es",
|
|
352
|
-
"es-us": "es",
|
|
353
|
-
"es-uy": "es",
|
|
354
|
-
"es-ve": "es",
|
|
355
|
-
"pt-ao": "pt",
|
|
356
|
-
"pt-ch": "pt",
|
|
357
|
-
"pt-cv": "pt",
|
|
358
|
-
"pt-fr": "pt",
|
|
359
|
-
"pt-gq": "pt",
|
|
360
|
-
"pt-gw": "pt",
|
|
361
|
-
"pt-lu": "pt",
|
|
362
|
-
"pt-mo": "pt",
|
|
363
|
-
"pt-mz": "pt",
|
|
364
|
-
"pt-pt": "pt",
|
|
365
|
-
"pt-st": "pt",
|
|
366
|
-
"pt-tl": "pt",
|
|
367
|
-
"az-arab": "az",
|
|
368
|
-
"az-cyrl": "az",
|
|
369
|
-
"blt-latn": "blt",
|
|
370
|
-
"bm-nkoo": "bm",
|
|
371
|
-
"bs-cyrl": "bs",
|
|
372
|
-
"byn-latn": "byn",
|
|
373
|
-
"cu-glag": "cu",
|
|
374
|
-
"dje-arab": "dje",
|
|
375
|
-
"dyo-arab": "dyo",
|
|
376
|
-
"en-dsrt": "en",
|
|
377
|
-
"en-shaw": "en",
|
|
378
|
-
"ff-adlm": "ff",
|
|
379
|
-
"ff-arab": "ff",
|
|
380
|
-
"ha-arab": "ha",
|
|
381
|
-
"hi-latn": "hi",
|
|
382
|
-
"iu-latn": "iu",
|
|
383
|
-
"kk-arab": "kk",
|
|
384
|
-
"ks-deva": "ks",
|
|
385
|
-
"ku-arab": "ku",
|
|
386
|
-
"ky-arab": "ky",
|
|
387
|
-
"ky-latn": "ky",
|
|
388
|
-
"ml-arab": "ml",
|
|
389
|
-
"mn-mong": "mn",
|
|
390
|
-
"mni-mtei": "mni",
|
|
391
|
-
"ms-arab": "ms",
|
|
392
|
-
"pa-arab": "pa",
|
|
393
|
-
"sat-deva": "sat",
|
|
394
|
-
"sd-deva": "sd",
|
|
395
|
-
"sd-khoj": "sd",
|
|
396
|
-
"sd-sind": "sd",
|
|
397
|
-
"shi-latn": "shi",
|
|
398
|
-
"so-arab": "so",
|
|
399
|
-
"sr-latn": "sr",
|
|
400
|
-
"sw-arab": "sw",
|
|
401
|
-
"tg-arab": "tg",
|
|
402
|
-
"ug-cyrl": "ug",
|
|
403
|
-
"uz-arab": "uz",
|
|
404
|
-
"uz-cyrl": "uz",
|
|
405
|
-
"vai-latn": "vai",
|
|
406
|
-
"wo-arab": "wo",
|
|
407
|
-
"yo-arab": "yo",
|
|
408
|
-
"yue-hans": "yue",
|
|
409
|
-
"zh-hant": "zh",
|
|
410
|
-
"zh-hant-hk": "zh",
|
|
411
|
-
"zh-hant-mo": "zh-hant-hk"
|
|
412
|
-
}[sourceLocale];
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Replace localeDir, srcPathDirs and srcPathIgnorePatterns with catalogs
|
|
416
|
-
*
|
|
417
|
-
* Released in @lingui/conf 3.0
|
|
418
|
-
* Remove anytime after 4.x
|
|
419
|
-
*/
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
function catalogMigration(config) {
|
|
423
|
-
var localeDir = config.localeDir,
|
|
424
|
-
srcPathDirs = config.srcPathDirs,
|
|
425
|
-
srcPathIgnorePatterns = config.srcPathIgnorePatterns,
|
|
426
|
-
newConfig = (0, _objectWithoutProperties2.default)(config, ["localeDir", "srcPathDirs", "srcPathIgnorePatterns"]);
|
|
427
|
-
|
|
428
|
-
if (localeDir || srcPathDirs || srcPathIgnorePatterns) {
|
|
429
|
-
// Replace missing values with default ones
|
|
430
|
-
if (localeDir === undefined) localeDir = pathJoinPosix("<rootDir>", "locale", "{locale}", "messages");
|
|
431
|
-
if (srcPathDirs === undefined) srcPathDirs = ["<rootDir>"];
|
|
432
|
-
if (srcPathIgnorePatterns === undefined) srcPathIgnorePatterns = ["**/node_modules/**"];
|
|
433
|
-
var newLocaleDir = localeDir.split(_path.default.sep).join("/");
|
|
434
|
-
|
|
435
|
-
if (newLocaleDir.slice(-1) !== _path.default.sep) {
|
|
436
|
-
newLocaleDir += "/";
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
if (!Array.isArray(newConfig.catalogs)) {
|
|
440
|
-
newConfig.catalogs = [];
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
newConfig.catalogs.push({
|
|
444
|
-
path: pathJoinPosix(newLocaleDir, "{locale}", "messages"),
|
|
445
|
-
include: srcPathDirs,
|
|
446
|
-
exclude: srcPathIgnorePatterns
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
return newConfig;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
var pipe = function pipe() {
|
|
454
|
-
for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
455
|
-
functions[_key] = arguments[_key];
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
return function (args) {
|
|
459
|
-
return functions.reduce(function (arg, fn) {
|
|
460
|
-
return fn(arg);
|
|
461
|
-
}, args);
|
|
462
|
-
};
|
|
463
|
-
};
|
|
464
|
-
/** Typescript loader using just typescript API and eval(), instead of using ts-node/register which is slower */
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
function TypeScriptLoader(filePath) {
|
|
468
|
-
var tsc = require("typescript");
|
|
469
|
-
|
|
470
|
-
var fileContent = _fs.default.readFileSync(filePath, "utf-8");
|
|
471
|
-
|
|
472
|
-
var _tsc$transpileModule = tsc.transpileModule(fileContent, {
|
|
473
|
-
compilerOptions: {
|
|
474
|
-
module: tsc.ModuleKind.CommonJS
|
|
475
|
-
}
|
|
476
|
-
}),
|
|
477
|
-
outputText = _tsc$transpileModule.outputText;
|
|
478
|
-
|
|
479
|
-
var configFileParsed = eval(outputText);
|
|
480
|
-
return configFileParsed;
|
|
481
|
-
}
|
|
1
|
+
export * from "./src"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/conf",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "Get lingui configuration from package.json",
|
|
6
6
|
"keywords": [
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"name": "Tomáš Ehrlich",
|
|
15
15
|
"email": "tomas.ehrlich@gmail.com"
|
|
16
16
|
},
|
|
17
|
-
"main": "index.js",
|
|
17
|
+
"main": "build/index.js",
|
|
18
18
|
"engines": {
|
|
19
|
-
"node": ">=
|
|
19
|
+
"node": ">=14.0.0"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@babel/runtime": "^7.11.2",
|
|
@@ -31,5 +31,6 @@
|
|
|
31
31
|
"README.md",
|
|
32
32
|
"index.js",
|
|
33
33
|
"index.d.ts"
|
|
34
|
-
]
|
|
34
|
+
],
|
|
35
|
+
"gitHead": "bae762a1ef15d0a4d883bc8c1837603b4e79175e"
|
|
35
36
|
}
|