@i18n-micro/types 1.2.6 → 1.2.7

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
@@ -401,6 +401,47 @@ export interface ModuleOptions {
401
401
  * @default 0
402
402
  */
403
403
  cacheTtl?: number;
404
+ /**
405
+ * Named number formats per locale (Vue I18n-compatible).
406
+ * Enables `$tn(1000, 'currency')` style calls.
407
+ *
408
+ * @example
409
+ * numberFormats: {
410
+ * en: { currency: { style: 'currency', currency: 'USD' } },
411
+ * de: { currency: { style: 'currency', currency: 'EUR' } },
412
+ * }
413
+ */
414
+ numberFormats?: Record<string, Record<string, Intl.NumberFormatOptions>>;
415
+ /**
416
+ * Named datetime formats per locale (Vue I18n-compatible `datetimeFormats`).
417
+ * Enables `$td(date, 'short')` style calls.
418
+ *
419
+ * @example
420
+ * datetimeFormats: {
421
+ * en: { short: { year: 'numeric', month: 'short', day: 'numeric' } },
422
+ * de: { short: { year: 'numeric', month: 'short', day: 'numeric' } },
423
+ * }
424
+ */
425
+ datetimeFormats?: Record<string, Record<string, Intl.DateTimeFormatOptions>>;
426
+ /**
427
+ * HTTP `Cache-Control` max-age (seconds) for `/{apiBaseUrl}/:page/:locale/data.json`.
428
+ *
429
+ * Applies in full only while `dateBuild` busts the URL (`?v=...`), which is the default:
430
+ * the response is then `public, max-age=…, immutable` and safe for browsers and CDNs.
431
+ *
432
+ * - `dateBuild: 0`/`''` — the URL is stable, so this duration is *not* honoured; the
433
+ * response becomes `public, max-age=0, must-revalidate` instead. A long `max-age` on an
434
+ * unchanging URL pins the first payload a browser ever saw.
435
+ * - `0` — do not set `Cache-Control` at all (useful in local debugging)
436
+ * - Not applied in development (`import.meta.dev`) so HMR is not fought by the browser cache
437
+ * - Reaches only responses served through Nitro. Payloads copied into `public/` and served
438
+ * by the hosting platform take that platform's headers — see the Performance guide.
439
+ *
440
+ * Analogous to `@nuxtjs/i18n` experimental `httpCacheDuration` (v10.2.0), but as an
441
+ * explicit response header rather than Nitro `defineCachedEventHandler` maxAge.
442
+ * @default 31536000
443
+ */
444
+ httpCacheDuration?: number;
404
445
  /**
405
446
  * Value used for cache-busting translation requests (`?v=...`).
406
447
  *
@@ -444,14 +485,14 @@ export interface TranslationPayloadOptions {
444
485
  /**
445
486
  * Copy translation payload files into Nitro public assets during production builds.
446
487
  * In `source` mode this copies the compact source directory, not a pre-merged matrix.
447
- * @default true in `premerged` mode, `false` in `source` mode
488
+ * @default true in premerged mode, false in source mode
448
489
  */
449
490
  publicAssets?: boolean;
450
491
  /**
451
492
  * Add translation data routes to Nuxt/Nitro prerender output.
452
493
  * Disable this when `_locales` payloads are served from an external host/CDN or should not be
453
494
  * materialized into public output.
454
- * @default true in `premerged` mode, `false` in `source` mode
495
+ * @default true in premerged mode, false in source mode
455
496
  */
456
497
  prerenderRoutes?: boolean;
457
498
  /**
package/dist/index.d.ts CHANGED
@@ -401,6 +401,47 @@ export interface ModuleOptions {
401
401
  * @default 0
402
402
  */
403
403
  cacheTtl?: number;
404
+ /**
405
+ * Named number formats per locale (Vue I18n-compatible).
406
+ * Enables `$tn(1000, 'currency')` style calls.
407
+ *
408
+ * @example
409
+ * numberFormats: {
410
+ * en: { currency: { style: 'currency', currency: 'USD' } },
411
+ * de: { currency: { style: 'currency', currency: 'EUR' } },
412
+ * }
413
+ */
414
+ numberFormats?: Record<string, Record<string, Intl.NumberFormatOptions>>;
415
+ /**
416
+ * Named datetime formats per locale (Vue I18n-compatible `datetimeFormats`).
417
+ * Enables `$td(date, 'short')` style calls.
418
+ *
419
+ * @example
420
+ * datetimeFormats: {
421
+ * en: { short: { year: 'numeric', month: 'short', day: 'numeric' } },
422
+ * de: { short: { year: 'numeric', month: 'short', day: 'numeric' } },
423
+ * }
424
+ */
425
+ datetimeFormats?: Record<string, Record<string, Intl.DateTimeFormatOptions>>;
426
+ /**
427
+ * HTTP `Cache-Control` max-age (seconds) for `/{apiBaseUrl}/:page/:locale/data.json`.
428
+ *
429
+ * Applies in full only while `dateBuild` busts the URL (`?v=...`), which is the default:
430
+ * the response is then `public, max-age=…, immutable` and safe for browsers and CDNs.
431
+ *
432
+ * - `dateBuild: 0`/`''` — the URL is stable, so this duration is *not* honoured; the
433
+ * response becomes `public, max-age=0, must-revalidate` instead. A long `max-age` on an
434
+ * unchanging URL pins the first payload a browser ever saw.
435
+ * - `0` — do not set `Cache-Control` at all (useful in local debugging)
436
+ * - Not applied in development (`import.meta.dev`) so HMR is not fought by the browser cache
437
+ * - Reaches only responses served through Nitro. Payloads copied into `public/` and served
438
+ * by the hosting platform take that platform's headers — see the Performance guide.
439
+ *
440
+ * Analogous to `@nuxtjs/i18n` experimental `httpCacheDuration` (v10.2.0), but as an
441
+ * explicit response header rather than Nitro `defineCachedEventHandler` maxAge.
442
+ * @default 31536000
443
+ */
444
+ httpCacheDuration?: number;
404
445
  /**
405
446
  * Value used for cache-busting translation requests (`?v=...`).
406
447
  *
@@ -444,14 +485,14 @@ export interface TranslationPayloadOptions {
444
485
  /**
445
486
  * Copy translation payload files into Nitro public assets during production builds.
446
487
  * In `source` mode this copies the compact source directory, not a pre-merged matrix.
447
- * @default true in `premerged` mode, `false` in `source` mode
488
+ * @default true in premerged mode, false in source mode
448
489
  */
449
490
  publicAssets?: boolean;
450
491
  /**
451
492
  * Add translation data routes to Nuxt/Nitro prerender output.
452
493
  * Disable this when `_locales` payloads are served from an external host/CDN or should not be
453
494
  * materialized into public output.
454
- * @default true in `premerged` mode, `false` in `source` mode
495
+ * @default true in premerged mode, false in source mode
455
496
  */
456
497
  prerenderRoutes?: boolean;
457
498
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i18n-micro/types",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "description": "TypeScript definitions for the Nuxt I18n Micro ecosystem.",
5
5
  "keywords": [
6
6
  "i18n",
@@ -51,14 +51,16 @@
51
51
  },
52
52
  "devDependencies": {
53
53
  "publint": "^0.3.17",
54
- "vite": "^7.3.1",
55
- "vite-plugin-dts": "^4.5.4"
54
+ "vite": "^7.3.6",
55
+ "vite-plugin-dts": "^4.5.4",
56
+ "vitest": "^4.1.10"
56
57
  },
57
58
  "engines": {
58
59
  "node": ">=18"
59
60
  },
60
61
  "scripts": {
61
62
  "build": "vite build",
62
- "check:package": "publint"
63
+ "check:package": "publint",
64
+ "test": "vitest run --typecheck"
63
65
  }
64
66
  }