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