@lingui/conf 5.4.1 → 5.5.0
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 +11 -8
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +11 -8
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -5,6 +5,7 @@ const jestValidate = require('jest-validate');
|
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const fs = require('fs');
|
|
7
7
|
const cosmiconfig = require('cosmiconfig');
|
|
8
|
+
const jiti = require('jiti');
|
|
8
9
|
|
|
9
10
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
10
11
|
|
|
@@ -283,10 +284,14 @@ function makeConfig(userConfig, opts = {}) {
|
|
|
283
284
|
}
|
|
284
285
|
config = setCldrParentLocales(config);
|
|
285
286
|
config = normalizeRuntimeConfigModule(config);
|
|
286
|
-
|
|
287
|
+
const out = replaceRootDir(
|
|
287
288
|
config,
|
|
288
289
|
config.rootDir
|
|
289
290
|
);
|
|
291
|
+
return {
|
|
292
|
+
...out,
|
|
293
|
+
resolvedConfigPath: opts.resolvedConfigPath
|
|
294
|
+
};
|
|
290
295
|
}
|
|
291
296
|
const defaultConfig = {
|
|
292
297
|
catalogs: [
|
|
@@ -378,12 +383,10 @@ function configExists(path2) {
|
|
|
378
383
|
return path2 && fs__default.existsSync(path2);
|
|
379
384
|
}
|
|
380
385
|
function JitiLoader() {
|
|
381
|
-
return (filepath
|
|
382
|
-
const
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
const jiti = require("jiti")(__filename, opts);
|
|
386
|
-
return jiti(filepath);
|
|
386
|
+
return (filepath) => {
|
|
387
|
+
const jiti$1 = jiti.createJiti(__filename);
|
|
388
|
+
const mod = jiti$1(filepath);
|
|
389
|
+
return mod?.default ?? mod;
|
|
387
390
|
};
|
|
388
391
|
}
|
|
389
392
|
const moduleName = "lingui";
|
|
@@ -432,7 +435,7 @@ function getConfig({
|
|
|
432
435
|
rootDir: result ? path__default.dirname(result.filepath) : defaultRootDir,
|
|
433
436
|
...userConfig
|
|
434
437
|
},
|
|
435
|
-
{ skipValidation }
|
|
438
|
+
{ skipValidation, resolvedConfigPath: result.filepath }
|
|
436
439
|
);
|
|
437
440
|
}
|
|
438
441
|
|
package/dist/index.d.cts
CHANGED
|
@@ -310,6 +310,7 @@ type LinguiConfig = {
|
|
|
310
310
|
};
|
|
311
311
|
type ModuleSourceNormalized = readonly [module: string, specifier: string];
|
|
312
312
|
type LinguiConfigNormalized = Omit<LinguiConfig, "runtimeConfigModule"> & {
|
|
313
|
+
resolvedConfigPath?: string;
|
|
313
314
|
fallbackLocales?: FallbackLocales;
|
|
314
315
|
runtimeConfigModule: {
|
|
315
316
|
i18n: ModuleSourceNormalized;
|
|
@@ -320,6 +321,7 @@ type LinguiConfigNormalized = Omit<LinguiConfig, "runtimeConfigModule"> & {
|
|
|
320
321
|
|
|
321
322
|
declare function makeConfig(userConfig: Partial<LinguiConfig>, opts?: {
|
|
322
323
|
skipValidation?: boolean;
|
|
324
|
+
resolvedConfigPath?: string;
|
|
323
325
|
}): LinguiConfigNormalized;
|
|
324
326
|
|
|
325
327
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -310,6 +310,7 @@ type LinguiConfig = {
|
|
|
310
310
|
};
|
|
311
311
|
type ModuleSourceNormalized = readonly [module: string, specifier: string];
|
|
312
312
|
type LinguiConfigNormalized = Omit<LinguiConfig, "runtimeConfigModule"> & {
|
|
313
|
+
resolvedConfigPath?: string;
|
|
313
314
|
fallbackLocales?: FallbackLocales;
|
|
314
315
|
runtimeConfigModule: {
|
|
315
316
|
i18n: ModuleSourceNormalized;
|
|
@@ -320,6 +321,7 @@ type LinguiConfigNormalized = Omit<LinguiConfig, "runtimeConfigModule"> & {
|
|
|
320
321
|
|
|
321
322
|
declare function makeConfig(userConfig: Partial<LinguiConfig>, opts?: {
|
|
322
323
|
skipValidation?: boolean;
|
|
324
|
+
resolvedConfigPath?: string;
|
|
323
325
|
}): LinguiConfigNormalized;
|
|
324
326
|
|
|
325
327
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -310,6 +310,7 @@ type LinguiConfig = {
|
|
|
310
310
|
};
|
|
311
311
|
type ModuleSourceNormalized = readonly [module: string, specifier: string];
|
|
312
312
|
type LinguiConfigNormalized = Omit<LinguiConfig, "runtimeConfigModule"> & {
|
|
313
|
+
resolvedConfigPath?: string;
|
|
313
314
|
fallbackLocales?: FallbackLocales;
|
|
314
315
|
runtimeConfigModule: {
|
|
315
316
|
i18n: ModuleSourceNormalized;
|
|
@@ -320,6 +321,7 @@ type LinguiConfigNormalized = Omit<LinguiConfig, "runtimeConfigModule"> & {
|
|
|
320
321
|
|
|
321
322
|
declare function makeConfig(userConfig: Partial<LinguiConfig>, opts?: {
|
|
322
323
|
skipValidation?: boolean;
|
|
324
|
+
resolvedConfigPath?: string;
|
|
323
325
|
}): LinguiConfigNormalized;
|
|
324
326
|
|
|
325
327
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { validate, multipleValidOptions } from 'jest-validate';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import { cosmiconfigSync } from 'cosmiconfig';
|
|
6
|
+
import { createJiti } from 'jiti';
|
|
6
7
|
|
|
7
8
|
function replaceRootDir(config, rootDir) {
|
|
8
9
|
return function replaceDeep(value, rootDir2) {
|
|
@@ -275,10 +276,14 @@ function makeConfig(userConfig, opts = {}) {
|
|
|
275
276
|
}
|
|
276
277
|
config = setCldrParentLocales(config);
|
|
277
278
|
config = normalizeRuntimeConfigModule(config);
|
|
278
|
-
|
|
279
|
+
const out = replaceRootDir(
|
|
279
280
|
config,
|
|
280
281
|
config.rootDir
|
|
281
282
|
);
|
|
283
|
+
return {
|
|
284
|
+
...out,
|
|
285
|
+
resolvedConfigPath: opts.resolvedConfigPath
|
|
286
|
+
};
|
|
282
287
|
}
|
|
283
288
|
const defaultConfig = {
|
|
284
289
|
catalogs: [
|
|
@@ -370,12 +375,10 @@ function configExists(path2) {
|
|
|
370
375
|
return path2 && fs.existsSync(path2);
|
|
371
376
|
}
|
|
372
377
|
function JitiLoader() {
|
|
373
|
-
return (filepath
|
|
374
|
-
const
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
const jiti = require("jiti")(__filename, opts);
|
|
378
|
-
return jiti(filepath);
|
|
378
|
+
return (filepath) => {
|
|
379
|
+
const jiti = createJiti(__filename);
|
|
380
|
+
const mod = jiti(filepath);
|
|
381
|
+
return mod?.default ?? mod;
|
|
379
382
|
};
|
|
380
383
|
}
|
|
381
384
|
const moduleName = "lingui";
|
|
@@ -424,7 +427,7 @@ function getConfig({
|
|
|
424
427
|
rootDir: result ? path.dirname(result.filepath) : defaultRootDir,
|
|
425
428
|
...userConfig
|
|
426
429
|
},
|
|
427
|
-
{ skipValidation }
|
|
430
|
+
{ skipValidation, resolvedConfigPath: result.filepath }
|
|
428
431
|
);
|
|
429
432
|
}
|
|
430
433
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/conf",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "Get lingui configuration from package.json",
|
|
6
6
|
"keywords": [
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@babel/runtime": "^7.20.13",
|
|
34
34
|
"cosmiconfig": "^8.0.0",
|
|
35
35
|
"jest-validate": "^29.4.3",
|
|
36
|
-
"jiti": "^
|
|
36
|
+
"jiti": "^2.5.1",
|
|
37
37
|
"picocolors": "^1.1.1"
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"@lingui/jest-mocks": "*",
|
|
46
46
|
"unbuild": "^2.0.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "26700f071cd540651822b7f786d3c1d07c9d8625"
|
|
49
49
|
}
|