@i18n-micro/types 1.1.0 → 1.1.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/README.md CHANGED
@@ -53,7 +53,7 @@ const options: ModuleOptions = {
53
53
  locales,
54
54
  strategy,
55
55
  defaultLocale: 'en',
56
- includeDefaultLocaleRoute: true,
56
+ strategy: 'prefix',
57
57
  }
58
58
 
59
59
  // Define route parameters
package/dist/index.d.ts CHANGED
@@ -4,12 +4,12 @@ export interface DefineLocaleMessage {
4
4
  }
5
5
  export type TranslationKey = keyof DefineLocaleMessage extends never ? string : keyof DefineLocaleMessage | string;
6
6
  /**
7
- * Хелпер для создания типизированных префиксов.
8
- * Позволяет безопасно использовать динамические ключи.
7
+ * Helper for creating typed prefixes.
8
+ * Allows safe usage of dynamic keys.
9
9
  *
10
10
  * @example
11
11
  * ```typescript
12
- * // Допустим, есть ключи: 'errors.404', 'errors.500', 'btn.save'
12
+ * // Assuming keys: 'errors.404', 'errors.500', 'btn.save'
13
13
  * function getErrorText(code: string) {
14
14
  * return t(`errors.${code}` as ScopedKey<'errors'>)
15
15
  * }
@@ -57,7 +57,6 @@ export interface ModuleOptions {
57
57
  autoDetectPath?: string;
58
58
  disableWatcher?: boolean;
59
59
  types?: boolean;
60
- includeDefaultLocaleRoute?: boolean;
61
60
  routesLocaleLinks?: {
62
61
  [key: string]: string;
63
62
  };
@@ -77,6 +76,8 @@ export interface ModuleOptions {
77
76
  missingWarn?: boolean;
78
77
  previousPageFallback?: boolean;
79
78
  hmr?: boolean;
79
+ cacheMaxSize?: number;
80
+ cacheTtl?: number;
80
81
  experimental?: Record<string, unknown>;
81
82
  }
82
83
  export interface ModuleOptionsExtend extends ModuleOptions {
@@ -85,6 +86,7 @@ export interface ModuleOptionsExtend extends ModuleOptions {
85
86
  isSSG: boolean;
86
87
  apiBaseUrl: string;
87
88
  disablePageLocales: boolean;
89
+ redirects?: boolean;
88
90
  }
89
91
  export interface ModulePrivateOptionsExtend extends ModuleOptions {
90
92
  rootDir: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i18n-micro/types",
3
- "version": "1.1.0",
3
+ "version": "1.1.3",
4
4
  "description": "",
5
5
  "repository": "s00d/nuxt-i18n-micro",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -1,26 +1,24 @@
1
1
  export type LocaleCode = string
2
2
 
3
- // Реестр ключей. Пользователь (через генератор) будет делать module augmentation этого интерфейса.
3
+ // Key registry. Users (via generator) will do module augmentation of this interface.
4
4
  export interface DefineLocaleMessage {
5
5
  // Module augmentation point - will be extended by @i18n-micro/types-generator
6
6
  readonly __augmentation?: never
7
7
  }
8
8
 
9
- // Логика определения типа ключа.
10
- // Если интерфейс пустой (генератор не подключен), тип ключа — string.
11
- // Если в интерфейсе есть ключи, тип ключа — объединение этих ключей и string (Union Type).
12
- // Это позволяет использовать как строгие типы (автокомплит), так и обычные строки (динамические ключи).
13
- export type TranslationKey = keyof DefineLocaleMessage extends never
14
- ? string
15
- : keyof DefineLocaleMessage | string
9
+ // Key type resolution logic.
10
+ // If the interface is empty (generator not connected), key type is string.
11
+ // If the interface has keys, key type is a union of those keys and string.
12
+ // This allows both strict types (autocomplete) and regular strings (dynamic keys).
13
+ export type TranslationKey = keyof DefineLocaleMessage extends never ? string : keyof DefineLocaleMessage | string
16
14
 
17
15
  /**
18
- * Хелпер для создания типизированных префиксов.
19
- * Позволяет безопасно использовать динамические ключи.
16
+ * Helper for creating typed prefixes.
17
+ * Allows safe usage of dynamic keys.
20
18
  *
21
19
  * @example
22
20
  * ```typescript
23
- * // Допустим, есть ключи: 'errors.404', 'errors.500', 'btn.save'
21
+ * // Assuming keys: 'errors.404', 'errors.500', 'btn.save'
24
22
  * function getErrorText(code: string) {
25
23
  * return t(`errors.${code}` as ScopedKey<'errors'>)
26
24
  * }
@@ -56,13 +54,7 @@ export type GlobalLocaleRoutes = Record<string, Record<LocaleCode, string> | fal
56
54
 
57
55
  export type Strategies = 'no_prefix' | 'prefix_except_default' | 'prefix' | 'prefix_and_default'
58
56
 
59
- export type MissingHandler = (
60
- locale: string,
61
- key: TranslationKey,
62
- routeName: string,
63
- instance?: unknown,
64
- type?: string
65
- ) => void
57
+ export type MissingHandler = (locale: string, key: TranslationKey, routeName: string, instance?: unknown, type?: string) => void
66
58
 
67
59
  export interface ModuleOptions {
68
60
  locales?: Locale[]
@@ -82,7 +74,7 @@ export interface ModuleOptions {
82
74
  autoDetectPath?: string
83
75
  disableWatcher?: boolean
84
76
  types?: boolean
85
- includeDefaultLocaleRoute?: boolean
77
+
86
78
  routesLocaleLinks?: { [key: string]: string }
87
79
  plural?: string | PluralFunc
88
80
  disablePageLocales?: boolean
@@ -100,6 +92,8 @@ export interface ModuleOptions {
100
92
  missingWarn?: boolean
101
93
  previousPageFallback?: boolean
102
94
  hmr?: boolean
95
+ cacheMaxSize?: number
96
+ cacheTtl?: number
103
97
  experimental?: Record<string, unknown>
104
98
  }
105
99
 
@@ -109,6 +103,7 @@ export interface ModuleOptionsExtend extends ModuleOptions {
109
103
  isSSG: boolean
110
104
  apiBaseUrl: string
111
105
  disablePageLocales: boolean
106
+ redirects?: boolean
112
107
  }
113
108
 
114
109
  export interface ModulePrivateOptionsExtend extends ModuleOptions {
package/vite.config.mts CHANGED
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2
1
  // @ts-nocheck
3
2
  import { resolve } from 'node:path'
4
3
  import { defineConfig } from 'vite'
@@ -10,7 +9,7 @@ export default defineConfig({
10
9
  entry: resolve(__dirname, 'src/index.ts'),
11
10
  name: '@i18n-micro/core',
12
11
  formats: ['cjs', 'es'],
13
- fileName: format => `index.${format === 'cjs' ? 'cjs' : 'mjs'}`,
12
+ fileName: (format) => `index.${format === 'cjs' ? 'cjs' : 'mjs'}`,
14
13
  },
15
14
  rollupOptions: {
16
15
  external: ['vue'],
@@ -19,7 +18,5 @@ export default defineConfig({
19
18
  },
20
19
  },
21
20
  },
22
- plugins: [
23
- dts(),
24
- ],
21
+ plugins: [dts()],
25
22
  })