@i18n-micro/types 1.2.2 → 1.2.3

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
@@ -244,6 +244,14 @@ export interface ModuleOptions {
244
244
  * @default 'locales'
245
245
  */
246
246
  translationDir?: string;
247
+ /**
248
+ * Controls how pre-merged translation payload files are emitted during build.
249
+ *
250
+ * Keep the defaults for the existing all-in-one behavior. For serverless or CDN-backed
251
+ * deployments, disable individual outputs to avoid duplicating large locale payloads in
252
+ * both Nitro server assets and public assets.
253
+ */
254
+ translationPayloads?: TranslationPayloadOptions;
247
255
  /**
248
256
  * Automatically detect the user's preferred language from the `Accept-Language` HTTP header.
249
257
  * Used in combination with `autoDetectPath` to decide when detection occurs.
@@ -404,6 +412,58 @@ export interface ModuleOptions {
404
412
  */
405
413
  experimental?: Record<string, unknown>;
406
414
  }
415
+ export interface TranslationPayloadOptions {
416
+ /**
417
+ * Translation payload strategy.
418
+ * - `premerged`: build-time page/locale matrix (default)
419
+ * - `source`: compact source files merged at runtime (recommended for large serverless apps)
420
+ * @default 'premerged'
421
+ */
422
+ mode?: 'premerged' | 'source';
423
+ /**
424
+ * Register translation payload files as Nitro server assets.
425
+ * In `premerged` mode this is the fully merged page/locale matrix.
426
+ * In `source` mode this is the compact layer-merged source directory.
427
+ * Required for the built-in local `_locales` server route unless translations are fetched
428
+ * from `apiBaseServerHost`.
429
+ * @default true
430
+ */
431
+ serverAssets?: boolean;
432
+ /**
433
+ * Register the built-in server route at `/{apiBaseUrl}/:page/:locale/data.json`.
434
+ * Disable this when translation payloads are served from an external host/CDN.
435
+ * @default true
436
+ */
437
+ serverHandler?: boolean;
438
+ /**
439
+ * Copy translation payload files into Nitro public assets during production builds.
440
+ * In `source` mode this copies the compact source directory, not a pre-merged matrix.
441
+ * @default true in `premerged` mode, `false` in `source` mode
442
+ */
443
+ publicAssets?: boolean;
444
+ /**
445
+ * Add translation data routes to Nuxt/Nitro prerender output.
446
+ * Disable this when `_locales` payloads are served from an external host/CDN or should not be
447
+ * materialized into public output.
448
+ * @default true in `premerged` mode, `false` in `source` mode
449
+ */
450
+ prerenderRoutes?: boolean;
451
+ /**
452
+ * Public output directory for copied translation payloads, relative to Nitro's public directory.
453
+ * Defaults to `translationDir`.
454
+ */
455
+ publicDir?: string;
456
+ /**
457
+ * Warn during build when generated payload file count exceeds this threshold.
458
+ * @default 500
459
+ */
460
+ warnFileCount?: number;
461
+ /**
462
+ * Warn during build when generated payload total size exceeds this threshold in bytes.
463
+ * @default 10485760 (10 MB)
464
+ */
465
+ warnSizeBytes?: number;
466
+ }
407
467
  /**
408
468
  * Extended module options injected into the Nuxt runtime config.
409
469
  * Includes resolved values and build-time metadata.
@@ -421,6 +481,8 @@ export interface ModuleOptionsExtend extends ModuleOptions {
421
481
  disablePageLocales: boolean;
422
482
  /** Resolved flag: whether locale-based redirects are enabled. */
423
483
  redirects?: boolean;
484
+ /** Resolved translation payload loading strategy. */
485
+ translationPayloadMode?: 'premerged' | 'source';
424
486
  }
425
487
  /**
426
488
  * Private (server-only) module options passed to Nitro plugins and server middleware.
package/dist/index.d.ts CHANGED
@@ -244,6 +244,14 @@ export interface ModuleOptions {
244
244
  * @default 'locales'
245
245
  */
246
246
  translationDir?: string;
247
+ /**
248
+ * Controls how pre-merged translation payload files are emitted during build.
249
+ *
250
+ * Keep the defaults for the existing all-in-one behavior. For serverless or CDN-backed
251
+ * deployments, disable individual outputs to avoid duplicating large locale payloads in
252
+ * both Nitro server assets and public assets.
253
+ */
254
+ translationPayloads?: TranslationPayloadOptions;
247
255
  /**
248
256
  * Automatically detect the user's preferred language from the `Accept-Language` HTTP header.
249
257
  * Used in combination with `autoDetectPath` to decide when detection occurs.
@@ -404,6 +412,58 @@ export interface ModuleOptions {
404
412
  */
405
413
  experimental?: Record<string, unknown>;
406
414
  }
415
+ export interface TranslationPayloadOptions {
416
+ /**
417
+ * Translation payload strategy.
418
+ * - `premerged`: build-time page/locale matrix (default)
419
+ * - `source`: compact source files merged at runtime (recommended for large serverless apps)
420
+ * @default 'premerged'
421
+ */
422
+ mode?: 'premerged' | 'source';
423
+ /**
424
+ * Register translation payload files as Nitro server assets.
425
+ * In `premerged` mode this is the fully merged page/locale matrix.
426
+ * In `source` mode this is the compact layer-merged source directory.
427
+ * Required for the built-in local `_locales` server route unless translations are fetched
428
+ * from `apiBaseServerHost`.
429
+ * @default true
430
+ */
431
+ serverAssets?: boolean;
432
+ /**
433
+ * Register the built-in server route at `/{apiBaseUrl}/:page/:locale/data.json`.
434
+ * Disable this when translation payloads are served from an external host/CDN.
435
+ * @default true
436
+ */
437
+ serverHandler?: boolean;
438
+ /**
439
+ * Copy translation payload files into Nitro public assets during production builds.
440
+ * In `source` mode this copies the compact source directory, not a pre-merged matrix.
441
+ * @default true in `premerged` mode, `false` in `source` mode
442
+ */
443
+ publicAssets?: boolean;
444
+ /**
445
+ * Add translation data routes to Nuxt/Nitro prerender output.
446
+ * Disable this when `_locales` payloads are served from an external host/CDN or should not be
447
+ * materialized into public output.
448
+ * @default true in `premerged` mode, `false` in `source` mode
449
+ */
450
+ prerenderRoutes?: boolean;
451
+ /**
452
+ * Public output directory for copied translation payloads, relative to Nitro's public directory.
453
+ * Defaults to `translationDir`.
454
+ */
455
+ publicDir?: string;
456
+ /**
457
+ * Warn during build when generated payload file count exceeds this threshold.
458
+ * @default 500
459
+ */
460
+ warnFileCount?: number;
461
+ /**
462
+ * Warn during build when generated payload total size exceeds this threshold in bytes.
463
+ * @default 10485760 (10 MB)
464
+ */
465
+ warnSizeBytes?: number;
466
+ }
407
467
  /**
408
468
  * Extended module options injected into the Nuxt runtime config.
409
469
  * Includes resolved values and build-time metadata.
@@ -421,6 +481,8 @@ export interface ModuleOptionsExtend extends ModuleOptions {
421
481
  disablePageLocales: boolean;
422
482
  /** Resolved flag: whether locale-based redirects are enabled. */
423
483
  redirects?: boolean;
484
+ /** Resolved translation payload loading strategy. */
485
+ translationPayloadMode?: 'premerged' | 'source';
424
486
  }
425
487
  /**
426
488
  * Private (server-only) module options passed to Nitro plugins and server middleware.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i18n-micro/types",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "TypeScript definitions for the Nuxt I18n Micro ecosystem.",
5
5
  "repository": {
6
6
  "type": "git",