@lingui/conf 4.7.1 → 4.8.0-next.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 +17 -13
- package/dist/index.d.cts +6 -8
- package/dist/index.d.mts +6 -8
- package/dist/index.d.ts +6 -8
- package/dist/index.mjs +17 -13
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -242,24 +242,28 @@ const getSymbolSource = (defaults, config) => {
|
|
|
242
242
|
}
|
|
243
243
|
return defaults;
|
|
244
244
|
}
|
|
245
|
-
|
|
245
|
+
const override = config[name];
|
|
246
|
+
if (!override) {
|
|
247
|
+
return defaults;
|
|
248
|
+
}
|
|
249
|
+
return [override[0], override[1] || name];
|
|
246
250
|
};
|
|
247
251
|
function normalizeRuntimeConfigModule(config) {
|
|
248
|
-
const [i18nImportModule, i18nImportName] = getSymbolSource(
|
|
249
|
-
["@lingui/core", "i18n"],
|
|
250
|
-
config.runtimeConfigModule
|
|
251
|
-
);
|
|
252
|
-
const [TransImportModule, TransImportName] = getSymbolSource(
|
|
253
|
-
["@lingui/react", "Trans"],
|
|
254
|
-
config.runtimeConfigModule
|
|
255
|
-
);
|
|
256
252
|
return {
|
|
257
253
|
...config,
|
|
258
254
|
runtimeConfigModule: {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
255
|
+
i18n: getSymbolSource(
|
|
256
|
+
["@lingui/core", "i18n"],
|
|
257
|
+
config.runtimeConfigModule
|
|
258
|
+
),
|
|
259
|
+
useLingui: getSymbolSource(
|
|
260
|
+
["@lingui/react", "useLingui"],
|
|
261
|
+
config.runtimeConfigModule
|
|
262
|
+
),
|
|
263
|
+
Trans: getSymbolSource(
|
|
264
|
+
["@lingui/react", "Trans"],
|
|
265
|
+
config.runtimeConfigModule
|
|
266
|
+
)
|
|
263
267
|
}
|
|
264
268
|
};
|
|
265
269
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -91,7 +91,7 @@ type LocaleObject = {
|
|
|
91
91
|
default?: string;
|
|
92
92
|
};
|
|
93
93
|
type FallbackLocales = LocaleObject;
|
|
94
|
-
type ModuleSource = [string, string
|
|
94
|
+
type ModuleSource = readonly [module: string, specifier?: string];
|
|
95
95
|
type CatalogService = {
|
|
96
96
|
name: string;
|
|
97
97
|
apiKey: string;
|
|
@@ -179,22 +179,20 @@ type LinguiConfig = {
|
|
|
179
179
|
orderBy?: OrderBy;
|
|
180
180
|
pseudoLocale?: string;
|
|
181
181
|
rootDir?: string;
|
|
182
|
-
runtimeConfigModule?: ModuleSource |
|
|
183
|
-
[symbolName: string]: ModuleSource;
|
|
184
|
-
};
|
|
182
|
+
runtimeConfigModule?: ModuleSource | Partial<Record<"useLingui" | "Trans" | "i18n", ModuleSource>>;
|
|
185
183
|
sourceLocale?: string;
|
|
186
184
|
service?: CatalogService;
|
|
187
185
|
experimental?: {
|
|
188
186
|
extractor?: ExperimentalExtractorOptions;
|
|
189
187
|
};
|
|
190
188
|
};
|
|
189
|
+
type ModuleSourceNormalized = readonly [module: string, specifier: string];
|
|
191
190
|
type LinguiConfigNormalized = Omit<LinguiConfig, "runtimeConfigModule"> & {
|
|
192
191
|
fallbackLocales?: FallbackLocales;
|
|
193
192
|
runtimeConfigModule: {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
TransImportName: string;
|
|
193
|
+
i18n: ModuleSourceNormalized;
|
|
194
|
+
useLingui: ModuleSourceNormalized;
|
|
195
|
+
Trans: ModuleSourceNormalized;
|
|
198
196
|
};
|
|
199
197
|
};
|
|
200
198
|
|
package/dist/index.d.mts
CHANGED
|
@@ -91,7 +91,7 @@ type LocaleObject = {
|
|
|
91
91
|
default?: string;
|
|
92
92
|
};
|
|
93
93
|
type FallbackLocales = LocaleObject;
|
|
94
|
-
type ModuleSource = [string, string
|
|
94
|
+
type ModuleSource = readonly [module: string, specifier?: string];
|
|
95
95
|
type CatalogService = {
|
|
96
96
|
name: string;
|
|
97
97
|
apiKey: string;
|
|
@@ -179,22 +179,20 @@ type LinguiConfig = {
|
|
|
179
179
|
orderBy?: OrderBy;
|
|
180
180
|
pseudoLocale?: string;
|
|
181
181
|
rootDir?: string;
|
|
182
|
-
runtimeConfigModule?: ModuleSource |
|
|
183
|
-
[symbolName: string]: ModuleSource;
|
|
184
|
-
};
|
|
182
|
+
runtimeConfigModule?: ModuleSource | Partial<Record<"useLingui" | "Trans" | "i18n", ModuleSource>>;
|
|
185
183
|
sourceLocale?: string;
|
|
186
184
|
service?: CatalogService;
|
|
187
185
|
experimental?: {
|
|
188
186
|
extractor?: ExperimentalExtractorOptions;
|
|
189
187
|
};
|
|
190
188
|
};
|
|
189
|
+
type ModuleSourceNormalized = readonly [module: string, specifier: string];
|
|
191
190
|
type LinguiConfigNormalized = Omit<LinguiConfig, "runtimeConfigModule"> & {
|
|
192
191
|
fallbackLocales?: FallbackLocales;
|
|
193
192
|
runtimeConfigModule: {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
TransImportName: string;
|
|
193
|
+
i18n: ModuleSourceNormalized;
|
|
194
|
+
useLingui: ModuleSourceNormalized;
|
|
195
|
+
Trans: ModuleSourceNormalized;
|
|
198
196
|
};
|
|
199
197
|
};
|
|
200
198
|
|
package/dist/index.d.ts
CHANGED
|
@@ -91,7 +91,7 @@ type LocaleObject = {
|
|
|
91
91
|
default?: string;
|
|
92
92
|
};
|
|
93
93
|
type FallbackLocales = LocaleObject;
|
|
94
|
-
type ModuleSource = [string, string
|
|
94
|
+
type ModuleSource = readonly [module: string, specifier?: string];
|
|
95
95
|
type CatalogService = {
|
|
96
96
|
name: string;
|
|
97
97
|
apiKey: string;
|
|
@@ -179,22 +179,20 @@ type LinguiConfig = {
|
|
|
179
179
|
orderBy?: OrderBy;
|
|
180
180
|
pseudoLocale?: string;
|
|
181
181
|
rootDir?: string;
|
|
182
|
-
runtimeConfigModule?: ModuleSource |
|
|
183
|
-
[symbolName: string]: ModuleSource;
|
|
184
|
-
};
|
|
182
|
+
runtimeConfigModule?: ModuleSource | Partial<Record<"useLingui" | "Trans" | "i18n", ModuleSource>>;
|
|
185
183
|
sourceLocale?: string;
|
|
186
184
|
service?: CatalogService;
|
|
187
185
|
experimental?: {
|
|
188
186
|
extractor?: ExperimentalExtractorOptions;
|
|
189
187
|
};
|
|
190
188
|
};
|
|
189
|
+
type ModuleSourceNormalized = readonly [module: string, specifier: string];
|
|
191
190
|
type LinguiConfigNormalized = Omit<LinguiConfig, "runtimeConfigModule"> & {
|
|
192
191
|
fallbackLocales?: FallbackLocales;
|
|
193
192
|
runtimeConfigModule: {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
TransImportName: string;
|
|
193
|
+
i18n: ModuleSourceNormalized;
|
|
194
|
+
useLingui: ModuleSourceNormalized;
|
|
195
|
+
Trans: ModuleSourceNormalized;
|
|
198
196
|
};
|
|
199
197
|
};
|
|
200
198
|
|
package/dist/index.mjs
CHANGED
|
@@ -234,24 +234,28 @@ const getSymbolSource = (defaults, config) => {
|
|
|
234
234
|
}
|
|
235
235
|
return defaults;
|
|
236
236
|
}
|
|
237
|
-
|
|
237
|
+
const override = config[name];
|
|
238
|
+
if (!override) {
|
|
239
|
+
return defaults;
|
|
240
|
+
}
|
|
241
|
+
return [override[0], override[1] || name];
|
|
238
242
|
};
|
|
239
243
|
function normalizeRuntimeConfigModule(config) {
|
|
240
|
-
const [i18nImportModule, i18nImportName] = getSymbolSource(
|
|
241
|
-
["@lingui/core", "i18n"],
|
|
242
|
-
config.runtimeConfigModule
|
|
243
|
-
);
|
|
244
|
-
const [TransImportModule, TransImportName] = getSymbolSource(
|
|
245
|
-
["@lingui/react", "Trans"],
|
|
246
|
-
config.runtimeConfigModule
|
|
247
|
-
);
|
|
248
244
|
return {
|
|
249
245
|
...config,
|
|
250
246
|
runtimeConfigModule: {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
247
|
+
i18n: getSymbolSource(
|
|
248
|
+
["@lingui/core", "i18n"],
|
|
249
|
+
config.runtimeConfigModule
|
|
250
|
+
),
|
|
251
|
+
useLingui: getSymbolSource(
|
|
252
|
+
["@lingui/react", "useLingui"],
|
|
253
|
+
config.runtimeConfigModule
|
|
254
|
+
),
|
|
255
|
+
Trans: getSymbolSource(
|
|
256
|
+
["@lingui/react", "Trans"],
|
|
257
|
+
config.runtimeConfigModule
|
|
258
|
+
)
|
|
255
259
|
}
|
|
256
260
|
};
|
|
257
261
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingui/conf",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0-next.1",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "Get lingui configuration from package.json",
|
|
6
6
|
"keywords": [
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"/dist"
|
|
39
39
|
],
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@lingui/jest-mocks": "
|
|
41
|
+
"@lingui/jest-mocks": "^3.0.3",
|
|
42
42
|
"tsd": "^0.26.1",
|
|
43
43
|
"unbuild": "^2.0.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "62a736f74796c6c3e5bfd23d2e95154fc7f3ff42"
|
|
46
46
|
}
|