@i18n-micro/types 1.2.7 → 1.2.8

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
@@ -251,11 +251,13 @@ export interface ModuleOptions {
251
251
  */
252
252
  translationDir?: string;
253
253
  /**
254
- * Controls how pre-merged translation payload files are emitted during build.
254
+ * Controls how translation payloads are emitted (Node: `public/<apiBaseUrl>`; Edge: Nitro `serverAssets`).
255
255
  *
256
- * Keep the defaults for the existing all-in-one behavior. For serverless or CDN-backed
257
- * deployments, disable individual outputs to avoid duplicating large locale payloads in
258
- * both Nitro server assets and public assets.
256
+ * - **Node**: `serverAssets` means local SSR via `readFile` under `public/` (no Rollup `raw:`).
257
+ * - **Edge**: `serverAssets` registers Nitro `serverAssets` (`assets:i18n`); it does not force a public copy.
258
+ *
259
+ * Keep the defaults for the usual all-in-one setup. For large Edge catalogs prefer `mode: 'source'`.
260
+ * For CDN-backed deployments, disable local outputs and set `apiBaseClientHost` / `apiBaseServerHost`.
259
261
  */
260
262
  translationPayloads?: TranslationPayloadOptions;
261
263
  /**
@@ -462,17 +464,19 @@ export interface ModuleOptions {
462
464
  export interface TranslationPayloadOptions {
463
465
  /**
464
466
  * Translation payload strategy.
465
- * - `premerged`: build-time page/locale matrix (default)
466
- * - `source`: compact source files merged at runtime (recommended for large serverless apps)
467
+ * - `premerged`: build-time `{page}/{locale}/data.json` matrix (default)
468
+ * - `source`: compact source files merged at runtime (prefer on Edge / large catalogs)
467
469
  * @default 'premerged'
468
470
  */
469
471
  mode?: 'premerged' | 'source';
470
472
  /**
471
- * Register translation payload files as Nitro server assets.
472
- * In `premerged` mode this is the fully merged page/locale matrix.
473
- * In `source` mode this is the compact layer-merged source directory.
474
- * Required for the built-in local `_locales` server route unless translations are fetched
475
- * from `apiBaseServerHost`.
473
+ * Local SSR payloads: Node reads `public/<apiBaseUrl>` (forces public copy); Edge embeds via Nitro `serverAssets`.
474
+ *
475
+ * - **Node**: no Nitro `serverAssets` (avoids Rollup `raw:`). SSR reads
476
+ * `public/<apiBaseUrl|publicDir>` as `{page}/{locale}/data.json`; when this is `true`,
477
+ * a public copy is forced even if `publicAssets` is false.
478
+ * - **Edge** (`nitro.node === false`): Nitro `serverAssets` (`assets:i18n`) with the same
479
+ * layout as `mode`. Does **not** force a public copy — set `publicAssets: true` for CDN.
476
480
  * @default true
477
481
  */
478
482
  serverAssets?: boolean;
@@ -483,21 +487,21 @@ export interface TranslationPayloadOptions {
483
487
  */
484
488
  serverHandler?: boolean;
485
489
  /**
486
- * Copy translation payload files into Nitro public assets during production builds.
487
- * In `source` mode this copies the compact source directory, not a pre-merged matrix.
490
+ * Copy payloads into Nitro public output. Premerged → `{page}/{locale}/data.json` under `apiBaseUrl`; source → compact tree.
491
+ *
492
+ * On Node this tree is also the SSR source when `serverAssets` forces a public copy.
488
493
  * @default true in premerged mode, false in source mode
489
494
  */
490
495
  publicAssets?: boolean;
491
496
  /**
492
- * Add translation data routes to Nuxt/Nitro prerender output.
493
- * Disable this when `_locales` payloads are served from an external host/CDN or should not be
494
- * materialized into public output.
495
- * @default true in premerged mode, false in source mode
497
+ * Opt in to Nitro-prerender `/{apiBaseUrl}/.../data.json`. Usually redundant when premerged `publicAssets` already wrote those files.
498
+ * @default false
496
499
  */
497
500
  prerenderRoutes?: boolean;
498
501
  /**
499
- * Public output directory for copied translation payloads, relative to Nitro's public directory.
500
- * Defaults to `translationDir`.
502
+ * Public output folder relative to Nitro public root. Defaults to `apiBaseUrl` (`_locales`).
503
+ *
504
+ * So static files match client fetch URLs (`/{apiBaseUrl}/{page}/{locale}/data.json`).
501
505
  */
502
506
  publicDir?: string;
503
507
  /**
@@ -558,6 +562,15 @@ export interface ModulePrivateOptionsExtend extends ModuleOptions {
558
562
  };
559
563
  /** Preload index translations in Nitro global middleware. */
560
564
  serverTranslationPreload?: boolean;
565
+ /**
566
+ * Absolute buildDir path to payload files (`.nuxt/i18n-merged` or `.nuxt/i18n-source`).
567
+ * Used by the Node fs reader in `import.meta.dev` / `import.meta.prerender`.
568
+ */
569
+ payloadFsDir: string;
570
+ /**
571
+ * Directory under Nitro `public/` for prod payload files (defaults to `translationDir`).
572
+ */
573
+ payloadPublicRel: string;
561
574
  }
562
575
  /** Object shape for a translation value that contains singular/plural forms. */
563
576
  export interface PluralTranslations {
package/dist/index.d.ts CHANGED
@@ -251,11 +251,13 @@ export interface ModuleOptions {
251
251
  */
252
252
  translationDir?: string;
253
253
  /**
254
- * Controls how pre-merged translation payload files are emitted during build.
254
+ * Controls how translation payloads are emitted (Node: `public/<apiBaseUrl>`; Edge: Nitro `serverAssets`).
255
255
  *
256
- * Keep the defaults for the existing all-in-one behavior. For serverless or CDN-backed
257
- * deployments, disable individual outputs to avoid duplicating large locale payloads in
258
- * both Nitro server assets and public assets.
256
+ * - **Node**: `serverAssets` means local SSR via `readFile` under `public/` (no Rollup `raw:`).
257
+ * - **Edge**: `serverAssets` registers Nitro `serverAssets` (`assets:i18n`); it does not force a public copy.
258
+ *
259
+ * Keep the defaults for the usual all-in-one setup. For large Edge catalogs prefer `mode: 'source'`.
260
+ * For CDN-backed deployments, disable local outputs and set `apiBaseClientHost` / `apiBaseServerHost`.
259
261
  */
260
262
  translationPayloads?: TranslationPayloadOptions;
261
263
  /**
@@ -462,17 +464,19 @@ export interface ModuleOptions {
462
464
  export interface TranslationPayloadOptions {
463
465
  /**
464
466
  * Translation payload strategy.
465
- * - `premerged`: build-time page/locale matrix (default)
466
- * - `source`: compact source files merged at runtime (recommended for large serverless apps)
467
+ * - `premerged`: build-time `{page}/{locale}/data.json` matrix (default)
468
+ * - `source`: compact source files merged at runtime (prefer on Edge / large catalogs)
467
469
  * @default 'premerged'
468
470
  */
469
471
  mode?: 'premerged' | 'source';
470
472
  /**
471
- * Register translation payload files as Nitro server assets.
472
- * In `premerged` mode this is the fully merged page/locale matrix.
473
- * In `source` mode this is the compact layer-merged source directory.
474
- * Required for the built-in local `_locales` server route unless translations are fetched
475
- * from `apiBaseServerHost`.
473
+ * Local SSR payloads: Node reads `public/<apiBaseUrl>` (forces public copy); Edge embeds via Nitro `serverAssets`.
474
+ *
475
+ * - **Node**: no Nitro `serverAssets` (avoids Rollup `raw:`). SSR reads
476
+ * `public/<apiBaseUrl|publicDir>` as `{page}/{locale}/data.json`; when this is `true`,
477
+ * a public copy is forced even if `publicAssets` is false.
478
+ * - **Edge** (`nitro.node === false`): Nitro `serverAssets` (`assets:i18n`) with the same
479
+ * layout as `mode`. Does **not** force a public copy — set `publicAssets: true` for CDN.
476
480
  * @default true
477
481
  */
478
482
  serverAssets?: boolean;
@@ -483,21 +487,21 @@ export interface TranslationPayloadOptions {
483
487
  */
484
488
  serverHandler?: boolean;
485
489
  /**
486
- * Copy translation payload files into Nitro public assets during production builds.
487
- * In `source` mode this copies the compact source directory, not a pre-merged matrix.
490
+ * Copy payloads into Nitro public output. Premerged → `{page}/{locale}/data.json` under `apiBaseUrl`; source → compact tree.
491
+ *
492
+ * On Node this tree is also the SSR source when `serverAssets` forces a public copy.
488
493
  * @default true in premerged mode, false in source mode
489
494
  */
490
495
  publicAssets?: boolean;
491
496
  /**
492
- * Add translation data routes to Nuxt/Nitro prerender output.
493
- * Disable this when `_locales` payloads are served from an external host/CDN or should not be
494
- * materialized into public output.
495
- * @default true in premerged mode, false in source mode
497
+ * Opt in to Nitro-prerender `/{apiBaseUrl}/.../data.json`. Usually redundant when premerged `publicAssets` already wrote those files.
498
+ * @default false
496
499
  */
497
500
  prerenderRoutes?: boolean;
498
501
  /**
499
- * Public output directory for copied translation payloads, relative to Nitro's public directory.
500
- * Defaults to `translationDir`.
502
+ * Public output folder relative to Nitro public root. Defaults to `apiBaseUrl` (`_locales`).
503
+ *
504
+ * So static files match client fetch URLs (`/{apiBaseUrl}/{page}/{locale}/data.json`).
501
505
  */
502
506
  publicDir?: string;
503
507
  /**
@@ -558,6 +562,15 @@ export interface ModulePrivateOptionsExtend extends ModuleOptions {
558
562
  };
559
563
  /** Preload index translations in Nitro global middleware. */
560
564
  serverTranslationPreload?: boolean;
565
+ /**
566
+ * Absolute buildDir path to payload files (`.nuxt/i18n-merged` or `.nuxt/i18n-source`).
567
+ * Used by the Node fs reader in `import.meta.dev` / `import.meta.prerender`.
568
+ */
569
+ payloadFsDir: string;
570
+ /**
571
+ * Directory under Nitro `public/` for prod payload files (defaults to `translationDir`).
572
+ */
573
+ payloadPublicRel: string;
561
574
  }
562
575
  /** Object shape for a translation value that contains singular/plural forms. */
563
576
  export interface PluralTranslations {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i18n-micro/types",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "description": "TypeScript definitions for the Nuxt I18n Micro ecosystem.",
5
5
  "keywords": [
6
6
  "i18n",