@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 +32 -19
- package/dist/index.d.ts +32 -19
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -251,11 +251,13 @@ export interface ModuleOptions {
|
|
|
251
251
|
*/
|
|
252
252
|
translationDir?: string;
|
|
253
253
|
/**
|
|
254
|
-
* Controls how
|
|
254
|
+
* Controls how translation payloads are emitted (Node: `public/<apiBaseUrl>`; Edge: Nitro `serverAssets`).
|
|
255
255
|
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
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 (
|
|
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
|
-
*
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
*
|
|
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
|
|
487
|
-
*
|
|
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
|
-
*
|
|
493
|
-
*
|
|
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
|
|
500
|
-
*
|
|
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
|
|
254
|
+
* Controls how translation payloads are emitted (Node: `public/<apiBaseUrl>`; Edge: Nitro `serverAssets`).
|
|
255
255
|
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
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 (
|
|
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
|
-
*
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
*
|
|
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
|
|
487
|
-
*
|
|
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
|
-
*
|
|
493
|
-
*
|
|
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
|
|
500
|
-
*
|
|
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 {
|