@lingui/conf 4.7.0 → 4.8.0-next.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 CHANGED
@@ -242,7 +242,11 @@ const getSymbolSource = (defaults, config) => {
242
242
  }
243
243
  return defaults;
244
244
  }
245
- return config[name] || defaults;
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
252
  const [i18nImportModule, i18nImportName] = getSymbolSource(
@@ -253,13 +257,19 @@ function normalizeRuntimeConfigModule(config) {
253
257
  ["@lingui/react", "Trans"],
254
258
  config.runtimeConfigModule
255
259
  );
260
+ const [useLinguiImportModule, useLinguiImportName] = getSymbolSource(
261
+ ["@lingui/react", "useLingui"],
262
+ config.runtimeConfigModule
263
+ );
256
264
  return {
257
265
  ...config,
258
266
  runtimeConfigModule: {
259
267
  i18nImportModule,
260
268
  i18nImportName,
261
269
  TransImportModule,
262
- TransImportName
270
+ TransImportName,
271
+ useLinguiImportModule,
272
+ useLinguiImportName
263
273
  }
264
274
  };
265
275
  }
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,9 +179,7 @@ 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?: {
@@ -195,6 +193,8 @@ type LinguiConfigNormalized = Omit<LinguiConfig, "runtimeConfigModule"> & {
195
193
  i18nImportName: string;
196
194
  TransImportModule: string;
197
195
  TransImportName: string;
196
+ useLinguiImportModule: string;
197
+ useLinguiImportName: string;
198
198
  };
199
199
  };
200
200
 
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,9 +179,7 @@ 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?: {
@@ -195,6 +193,8 @@ type LinguiConfigNormalized = Omit<LinguiConfig, "runtimeConfigModule"> & {
195
193
  i18nImportName: string;
196
194
  TransImportModule: string;
197
195
  TransImportName: string;
196
+ useLinguiImportModule: string;
197
+ useLinguiImportName: string;
198
198
  };
199
199
  };
200
200
 
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,9 +179,7 @@ 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?: {
@@ -195,6 +193,8 @@ type LinguiConfigNormalized = Omit<LinguiConfig, "runtimeConfigModule"> & {
195
193
  i18nImportName: string;
196
194
  TransImportModule: string;
197
195
  TransImportName: string;
196
+ useLinguiImportModule: string;
197
+ useLinguiImportName: string;
198
198
  };
199
199
  };
200
200
 
package/dist/index.mjs CHANGED
@@ -234,7 +234,11 @@ const getSymbolSource = (defaults, config) => {
234
234
  }
235
235
  return defaults;
236
236
  }
237
- return config[name] || defaults;
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
244
  const [i18nImportModule, i18nImportName] = getSymbolSource(
@@ -245,13 +249,19 @@ function normalizeRuntimeConfigModule(config) {
245
249
  ["@lingui/react", "Trans"],
246
250
  config.runtimeConfigModule
247
251
  );
252
+ const [useLinguiImportModule, useLinguiImportName] = getSymbolSource(
253
+ ["@lingui/react", "useLingui"],
254
+ config.runtimeConfigModule
255
+ );
248
256
  return {
249
257
  ...config,
250
258
  runtimeConfigModule: {
251
259
  i18nImportModule,
252
260
  i18nImportName,
253
261
  TransImportModule,
254
- TransImportName
262
+ TransImportName,
263
+ useLinguiImportModule,
264
+ useLinguiImportName
255
265
  }
256
266
  };
257
267
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/conf",
3
- "version": "4.7.0",
3
+ "version": "4.8.0-next.0",
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": "ebb6353aef59d1b1a29a10ba6ffe94eb42c51a77"
45
+ "gitHead": "d085ac65d66ce6c2f866b703b6346e53ff0bf6b3"
46
46
  }