@i18n-micro/types 1.2.8 → 1.2.10

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.d.cts CHANGED
@@ -162,10 +162,10 @@ export interface ModuleOptions {
162
162
  strategy?: Strategies;
163
163
  /**
164
164
  * Base URL for SEO meta tags (canonical, og:url, hreflang).
165
- * - `undefined` — dynamically resolved from the current request URL
165
+ * - A concrete URL string (e.g. `'https://example.com'`) — used as-is (highest priority).
166
+ * - `undefined` — falls back to `site.url` from `nuxt-site-config` when that module is
167
+ * present, otherwise the current request origin
166
168
  * (`useRequestURL().origin` on server, `window.location.origin` on client).
167
- * Best for multi-domain deployments.
168
- * - A concrete URL string (e.g. `'https://example.com'`) — used as-is.
169
169
  * @default undefined
170
170
  */
171
171
  metaBaseUrl?: string;
@@ -183,6 +183,13 @@ export interface ModuleOptions {
183
183
  * @default true
184
184
  */
185
185
  metaTrustForwardedProto?: boolean;
186
+ /**
187
+ * Also emit a bare-language `hreflang` derived from each locale's `iso`
188
+ * (e.g. `es-ES` → also `es`). The first regional locale in `locales` claims
189
+ * the bare tag for that language. Routing `code` is never used — only `iso || code`.
190
+ * @default false
191
+ */
192
+ hreflangBaseLanguage?: boolean;
186
193
  /**
187
194
  * Register the `defineI18nRoute()` macro plugin, enabling per-page `defineI18nRoute()` calls.
188
195
  * @default true
@@ -267,9 +274,14 @@ export interface ModuleOptions {
267
274
  */
268
275
  autoDetectLanguage?: boolean;
269
276
  /**
270
- * URL path on which automatic language detection and redirect occur.
271
- * - `'/'` — detect only on the root path.
272
- * - `'*'` — detect and redirect on every path (including locale-prefixed ones).
277
+ * Where cookie / Accept-Language preference redirects may run (when `redirects` is enabled).
278
+ * - `'/'` — only `/` (deep links in the default locale stay reachable; default)
279
+ * - `'no_prefix'` — only paths without a locale prefix
280
+ * - `'*'` — every path, including rewriting an explicit locale prefix
281
+ * (e.g. `/fr/about` → `/de/about` when the cookie prefers `de`)
282
+ * - any other string — exact path match (e.g. `'/welcome'`)
283
+ *
284
+ * Prefixed strategy cleanup (e.g. `/en` → `/` under `prefix_except_default`) is not gated.
273
285
  * @default '/'
274
286
  */
275
287
  autoDetectPath?: string;
@@ -294,13 +306,17 @@ export interface ModuleOptions {
294
306
  [key: string]: string;
295
307
  };
296
308
  /**
297
- * Custom pluralization function or a path to a file exporting one.
298
- * When a string path is provided, the file is imported at build time.
299
- * The function receives `(key, count, params, locale, getter)` and should return
300
- * the correct plural form as a string, or `null` to fall back to the built-in logic.
301
- * @default built-in pluralization (singular/plural by count)
309
+ * Custom pluralization function.
310
+ * Receives `(key, count, params, locale, getter)` and should return the selected
311
+ * plural form as a string, or `null`/`undefined` to fall back to the built-in
312
+ * `defaultPlural` logic (so you can override only some locales).
313
+ *
314
+ * For the Nuxt module the function is serialized with `.toString()` into
315
+ * `.nuxt/i18n.plural.mjs` — it must be self-contained (no imports / outer scope).
316
+ * A file path string is **not** supported.
317
+ * @default built-in pluralization (form index by count)
302
318
  */
303
- plural?: string | PluralFunc;
319
+ plural?: PluralFunc;
304
320
  /**
305
321
  * Disable per-page translation files.
306
322
  * When `true`, only global translations (`{locale}.json`) are loaded;
package/dist/index.d.ts CHANGED
@@ -162,10 +162,10 @@ export interface ModuleOptions {
162
162
  strategy?: Strategies;
163
163
  /**
164
164
  * Base URL for SEO meta tags (canonical, og:url, hreflang).
165
- * - `undefined` — dynamically resolved from the current request URL
165
+ * - A concrete URL string (e.g. `'https://example.com'`) — used as-is (highest priority).
166
+ * - `undefined` — falls back to `site.url` from `nuxt-site-config` when that module is
167
+ * present, otherwise the current request origin
166
168
  * (`useRequestURL().origin` on server, `window.location.origin` on client).
167
- * Best for multi-domain deployments.
168
- * - A concrete URL string (e.g. `'https://example.com'`) — used as-is.
169
169
  * @default undefined
170
170
  */
171
171
  metaBaseUrl?: string;
@@ -183,6 +183,13 @@ export interface ModuleOptions {
183
183
  * @default true
184
184
  */
185
185
  metaTrustForwardedProto?: boolean;
186
+ /**
187
+ * Also emit a bare-language `hreflang` derived from each locale's `iso`
188
+ * (e.g. `es-ES` → also `es`). The first regional locale in `locales` claims
189
+ * the bare tag for that language. Routing `code` is never used — only `iso || code`.
190
+ * @default false
191
+ */
192
+ hreflangBaseLanguage?: boolean;
186
193
  /**
187
194
  * Register the `defineI18nRoute()` macro plugin, enabling per-page `defineI18nRoute()` calls.
188
195
  * @default true
@@ -267,9 +274,14 @@ export interface ModuleOptions {
267
274
  */
268
275
  autoDetectLanguage?: boolean;
269
276
  /**
270
- * URL path on which automatic language detection and redirect occur.
271
- * - `'/'` — detect only on the root path.
272
- * - `'*'` — detect and redirect on every path (including locale-prefixed ones).
277
+ * Where cookie / Accept-Language preference redirects may run (when `redirects` is enabled).
278
+ * - `'/'` — only `/` (deep links in the default locale stay reachable; default)
279
+ * - `'no_prefix'` — only paths without a locale prefix
280
+ * - `'*'` — every path, including rewriting an explicit locale prefix
281
+ * (e.g. `/fr/about` → `/de/about` when the cookie prefers `de`)
282
+ * - any other string — exact path match (e.g. `'/welcome'`)
283
+ *
284
+ * Prefixed strategy cleanup (e.g. `/en` → `/` under `prefix_except_default`) is not gated.
273
285
  * @default '/'
274
286
  */
275
287
  autoDetectPath?: string;
@@ -294,13 +306,17 @@ export interface ModuleOptions {
294
306
  [key: string]: string;
295
307
  };
296
308
  /**
297
- * Custom pluralization function or a path to a file exporting one.
298
- * When a string path is provided, the file is imported at build time.
299
- * The function receives `(key, count, params, locale, getter)` and should return
300
- * the correct plural form as a string, or `null` to fall back to the built-in logic.
301
- * @default built-in pluralization (singular/plural by count)
309
+ * Custom pluralization function.
310
+ * Receives `(key, count, params, locale, getter)` and should return the selected
311
+ * plural form as a string, or `null`/`undefined` to fall back to the built-in
312
+ * `defaultPlural` logic (so you can override only some locales).
313
+ *
314
+ * For the Nuxt module the function is serialized with `.toString()` into
315
+ * `.nuxt/i18n.plural.mjs` — it must be self-contained (no imports / outer scope).
316
+ * A file path string is **not** supported.
317
+ * @default built-in pluralization (form index by count)
302
318
  */
303
- plural?: string | PluralFunc;
319
+ plural?: PluralFunc;
304
320
  /**
305
321
  * Disable per-page translation files.
306
322
  * When `true`, only global translations (`{locale}.json`) are loaded;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i18n-micro/types",
3
- "version": "1.2.8",
3
+ "version": "1.2.10",
4
4
  "description": "TypeScript definitions for the Nuxt I18n Micro ecosystem.",
5
5
  "keywords": [
6
6
  "i18n",