@intlayer/types 9.0.0-canary.2 → 9.0.0-canary.21

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.
@@ -2,12 +2,11 @@ import { Locale } from "./allLocales.js";
2
2
  import { LocalesValues, StrictModeLocaleMap } from "./module_augmentation.js";
3
3
  import { ContentAutoTransformation, DictionaryFormat, DictionaryLocation, Fill } from "./dictionary.js";
4
4
  import { Plugin } from "./plugin.js";
5
-
6
5
  //#region src/config.d.ts
7
6
  /**
8
- * Structural type for schema validation, compatible with Zod and other
9
- * schema libraries that implement safeParse. Avoids a hard dependency on Zod.
10
- */
7
+ * Structural type for schema validation, compatible with Zod and other
8
+ * schema libraries that implement safeParse. Avoids a hard dependency on Zod.
9
+ */
11
10
  type ConfigSchema = {
12
11
  safeParse(data: unknown): {
13
12
  success: boolean;
@@ -24,155 +23,155 @@ type IPUrl = `${Protocol}://${number}.${string}${OptionalURLPath}` | `${Protocol
24
23
  type DomainURL = `${Protocol}://${string}.${string}${OptionalURLPath}`;
25
24
  type URLType = LocalhostURL | IPUrl | DomainURL | (string & {});
26
25
  /**
27
- * Configuration for internationalization settings
28
- */
26
+ * Configuration for internationalization settings
27
+ */
29
28
  type InternationalizationConfig = {
30
29
  /**
31
- * Locales available in the application
32
- *
33
- * Default: [Locales.ENGLISH]
34
- *
35
- * You can define a list of available locales to support in the application.
36
- */
30
+ * Locales available in the application
31
+ *
32
+ * Default: [Locales.ENGLISH]
33
+ *
34
+ * You can define a list of available locales to support in the application.
35
+ */
37
36
  locales: Locale[];
38
37
  /**
39
- * Locales required by TypeScript to ensure strong implementations of internationalized content using typescript.
40
- *
41
- * Default: []
42
- *
43
- * If empty, all locales are required in `strict` mode.
44
- *
45
- * Ensure required locales are also defined in the `locales` field.
46
- */
38
+ * Locales required by TypeScript to ensure strong implementations of internationalized content using typescript.
39
+ *
40
+ * Default: []
41
+ *
42
+ * If empty, all locales are required in `strict` mode.
43
+ *
44
+ * Ensure required locales are also defined in the `locales` field.
45
+ */
47
46
  requiredLocales: Locale[];
48
47
  /**
49
- * Ensure strong implementations of internationalized content using typescript.
50
- * - If set to "strict", the translation `t` function will require each declared locales to be defined. If one locale is missing, or if a locale is not declared in your config, it will throw an error.
51
- * - If set to "inclusive", the translation `t` function will require each declared locales to be defined. If one locale is missing, it will throw a warning. But will accept if a locale is not declared in your config, but exist.
52
- * - If set to "loose", the translation `t` function will accept any existing locale.
53
- *
54
- * Default: "inclusive"
55
- */
48
+ * Ensure strong implementations of internationalized content using typescript.
49
+ * - If set to "strict", the translation `t` function will require each declared locales to be defined. If one locale is missing, or if a locale is not declared in your config, it will throw an error.
50
+ * - If set to "inclusive", the translation `t` function will require each declared locales to be defined. If one locale is missing, it will throw a warning. But will accept if a locale is not declared in your config, but exist.
51
+ * - If set to "loose", the translation `t` function will accept any existing locale.
52
+ *
53
+ * Default: "inclusive"
54
+ */
56
55
  strictMode: StrictMode;
57
56
  /**
58
- * Default locale of the application for fallback
59
- *
60
- * Default: Locales.ENGLISH
61
- *
62
- * Used to specify a fallback locale in case no other locale is set.
63
- */
57
+ * Default locale of the application for fallback
58
+ *
59
+ * Default: Locales.ENGLISH
60
+ *
61
+ * Used to specify a fallback locale in case no other locale is set.
62
+ */
64
63
  defaultLocale: Locale;
65
64
  };
66
65
  type CookiesAttributes = {
67
66
  /**
68
- * Type of the storage
69
- *
70
- * The type of the storage. It can be 'cookie'.
71
- */
67
+ * Type of the storage
68
+ *
69
+ * The type of the storage. It can be 'cookie'.
70
+ */
72
71
  type: "cookie";
73
72
  /**
74
- * Cookie name to store the locale information
75
- *
76
- * Default: 'INTLAYER_LOCALE'
77
- *
78
- * The cookie key where the locale information is stored.
79
- */
73
+ * Cookie name to store the locale information
74
+ *
75
+ * Default: 'INTLAYER_LOCALE'
76
+ *
77
+ * The cookie key where the locale information is stored.
78
+ */
80
79
  name?: string;
81
80
  /**
82
- * Cookie domain to store the locale information
83
- *
84
- * Default: undefined
85
- *
86
- * Define the domain where the cookie is available. Defaults to
87
- * the domain of the page where the cookie was created.
88
- */
81
+ * Cookie domain to store the locale information
82
+ *
83
+ * Default: undefined
84
+ *
85
+ * Define the domain where the cookie is available. Defaults to
86
+ * the domain of the page where the cookie was created.
87
+ */
89
88
  domain?: string;
90
89
  /**
91
- * Cookie path to store the locale information
92
- *
93
- * Default: undefined
94
- *
95
- * Define the path where the cookie is available. Defaults to '/'
96
- */
90
+ * Cookie path to store the locale information
91
+ *
92
+ * Default: undefined
93
+ *
94
+ * Define the path where the cookie is available. Defaults to '/'
95
+ */
97
96
  path?: string;
98
97
  /**
99
- * Cookie secure to store the locale information
100
- *
101
- * Default: undefined
102
- *
103
- * A Boolean indicating if the cookie transmission requires a
104
- * secure protocol (https). Defaults to false.
105
- */
98
+ * Cookie secure to store the locale information
99
+ *
100
+ * Default: undefined
101
+ *
102
+ * A Boolean indicating if the cookie transmission requires a
103
+ * secure protocol (https). Defaults to false.
104
+ */
106
105
  secure?: boolean;
107
106
  /**
108
- * Cookie httpOnly to store the locale information
109
- *
110
- * Default: undefined
111
- *
112
- * The cookie httpOnly where the locale information is stored.
113
- */
107
+ * Cookie httpOnly to store the locale information
108
+ *
109
+ * Default: undefined
110
+ *
111
+ * The cookie httpOnly where the locale information is stored.
112
+ */
114
113
  httpOnly?: boolean;
115
114
  /**
116
- * Cookie sameSite to store the locale information
117
- *
118
- * Default: undefined
119
- *
120
- * Asserts that a cookie must not be sent with cross-origin requests,
121
- * providing some protection against cross-site request forgery
122
- * attacks (CSRF)
123
- */
115
+ * Cookie sameSite to store the locale information
116
+ *
117
+ * Default: undefined
118
+ *
119
+ * Asserts that a cookie must not be sent with cross-origin requests,
120
+ * providing some protection against cross-site request forgery
121
+ * attacks (CSRF)
122
+ */
124
123
  sameSite?: "strict" | "lax" | "none";
125
124
  /**
126
- * Cookie expires to store the locale information
127
- *
128
- * Default: undefined
129
- *
130
- * Define when the cookie will be removed:
131
- * - a `number` is interpreted as **days from the time of creation**;
132
- * - a `Date` instance (or an ISO date string, e.g. produced when the
133
- * configuration is serialized) is interpreted as an **absolute moment**.
134
- *
135
- * If omitted, the cookie becomes a session cookie. When `maxAge` is set it
136
- * takes precedence over `expires`.
137
- */
125
+ * Cookie expires to store the locale information
126
+ *
127
+ * Default: undefined
128
+ *
129
+ * Define when the cookie will be removed:
130
+ * - a `number` is interpreted as **days from the time of creation**;
131
+ * - a `Date` instance (or an ISO date string, e.g. produced when the
132
+ * configuration is serialized) is interpreted as an **absolute moment**.
133
+ *
134
+ * If omitted, the cookie becomes a session cookie. When `maxAge` is set it
135
+ * takes precedence over `expires`.
136
+ */
138
137
  expires?: Date | number | string | undefined;
139
138
  /**
140
- * Cookie max-age to store the locale information
141
- *
142
- * Default: undefined
143
- *
144
- * Define the cookie lifetime in seconds from the time of creation
145
- * (e.g. `60 * 60 * 24 * 365` for one year). Takes precedence over
146
- * `expires` when both are set.
147
- */
139
+ * Cookie max-age to store the locale information
140
+ *
141
+ * Default: undefined
142
+ *
143
+ * Define the cookie lifetime in seconds from the time of creation
144
+ * (e.g. `60 * 60 * 24 * 365` for one year). Takes precedence over
145
+ * `expires` when both are set.
146
+ */
148
147
  maxAge?: number;
149
148
  };
150
149
  type StorageAttributes = {
151
150
  /**
152
- * Storage type where the locale is stored
153
- *
154
- * Determines whether the locale is persisted in `localStorage` (across sessions)
155
- * or `sessionStorage` (cleared when the browser session ends) or `header` (from the request header).
156
- */
151
+ * Storage type where the locale is stored
152
+ *
153
+ * Determines whether the locale is persisted in `localStorage` (across sessions)
154
+ * or `sessionStorage` (cleared when the browser session ends) or `header` (from the request header).
155
+ */
157
156
  type: "localStorage" | "sessionStorage" | "header";
158
157
  /**
159
- * Storage key to store the locale information
160
- *
161
- * Default: 'INTLAYER_LOCALE'
162
- *
163
- * The key name used in the client storage to save the locale.
164
- */
158
+ * Storage key to store the locale information
159
+ *
160
+ * Default: 'INTLAYER_LOCALE'
161
+ *
162
+ * The key name used in the client storage to save the locale.
163
+ */
165
164
  name?: string;
166
165
  };
167
166
  /**
168
- * Cookie attributes after the config-build normalization step.
169
- *
170
- * The user-facing `expires` (days / `Date` / ISO string) and `maxAge` (seconds)
171
- * are merged into a single, serialization-safe `expires` field so the client
172
- * runtime stays minimal:
173
- * - `number` → seconds from cookie creation (relative);
174
- * - `string` → an absolute expiry as an ISO date string.
175
- */
167
+ * Cookie attributes after the config-build normalization step.
168
+ *
169
+ * The user-facing `expires` (days / `Date` / ISO string) and `maxAge` (seconds)
170
+ * are merged into a single, serialization-safe `expires` field so the client
171
+ * runtime stays minimal:
172
+ * - `number` → seconds from cookie creation (relative);
173
+ * - `string` → an absolute expiry as an ISO date string.
174
+ */
176
175
  type ProcessedCookieAttributes = {
177
176
  domain?: string;
178
177
  path?: string;
@@ -182,9 +181,9 @@ type ProcessedCookieAttributes = {
182
181
  expires?: number | string;
183
182
  };
184
183
  /**
185
- * Pre-computed storage attributes derived from `RoutingConfig.storage`.
186
- * Computed at config-build time to avoid repeated processing at runtime.
187
- */
184
+ * Pre-computed storage attributes derived from `RoutingConfig.storage`.
185
+ * Computed at config-build time to avoid repeated processing at runtime.
186
+ */
188
187
  type ProcessedStorageAttributes = {
189
188
  cookies?: {
190
189
  name: string;
@@ -209,221 +208,273 @@ type RewriteRules = {
209
208
  };
210
209
  type RewriteObject = {
211
210
  /**
212
- * Used for client-side URL generation (e.g., getLocalizedUrl).
213
- * Patterns are usually stripped of locale prefixes as the core logic handles prefixing.
214
- */
211
+ * Used for client-side URL generation (e.g., getLocalizedUrl).
212
+ * Patterns are usually stripped of locale prefixes as the core logic handles prefixing.
213
+ */
215
214
  url: RewriteRules;
216
215
  /**
217
- * Used for Next.js middleware / proxy.
218
- * Patterns usually include [locale] or :locale to match incoming full URLs.
219
- */
216
+ * Used for Next.js middleware / proxy.
217
+ * Patterns usually include [locale] or :locale to match incoming full URLs.
218
+ */
220
219
  nextjs?: RewriteRules;
221
220
  /**
222
- * Used for Vite proxy middleware.
223
- */
221
+ * Used for Vite proxy middleware.
222
+ */
224
223
  vite?: RewriteRules;
225
224
  };
226
225
  /**
227
- * Configuration for routing behaviors
228
- */
226
+ * Configuration for routing behaviors
227
+ */
229
228
  type RoutingConfig = {
230
229
  /**
231
- * Rewrite the URLs to a localized path
232
- *
233
- * Example:
234
- * ```ts
235
- * // ...
236
- * routing: {
237
- * rewrite: nextjsRewrite({
238
- * '[locale]/about': {
239
- * fr: '[locale]/a-propos'
240
- * }
241
- * })
242
- * }
243
- * ```
244
- */
230
+ * Rewrite the URLs to a localized path
231
+ *
232
+ * Example:
233
+ * ```ts
234
+ * // ...
235
+ * routing: {
236
+ * rewrite: nextjsRewrite({
237
+ * '[locale]/about': {
238
+ * fr: '[locale]/a-propos'
239
+ * }
240
+ * })
241
+ * }
242
+ * ```
243
+ */
245
244
  rewrite?: Record<URLPath, StrictModeLocaleMap<URLPath>> | RewriteObject;
246
245
  /**
247
- * URL routing mode for locale handling
248
- *
249
- * Controls how locales are represented in application URLs:
250
- * - 'prefix-no-default': Prefix all locales except the default locale
251
- * - 'prefix-all': Prefix all locales including the default locale
252
- * - 'no-prefix': No locale prefixing in URLs
253
- * - 'search-params': Use search parameters for locale handling
254
- *
255
- * Examples with defaultLocale = 'en':
256
- * - 'prefix-no-default': /dashboard (en) or /fr/dashboard (fr)
257
- * - 'prefix-all': /en/dashboard (en) or /fr/dashboard (fr)
258
- * - 'no-prefix': /dashboard (locale handled via other means)
259
- * - 'search-params': /dashboard?locale=fr
260
- *
261
- * Note: This setting do not impact the cookie, or locale storage management.
262
- *
263
- * Default: 'prefix-no-default'
264
- */
246
+ * URL routing mode for locale handling
247
+ *
248
+ * Controls how locales are represented in application URLs:
249
+ * - 'prefix-no-default': Prefix all locales except the default locale
250
+ * - 'prefix-all': Prefix all locales including the default locale
251
+ * - 'no-prefix': No locale prefixing in URLs
252
+ * - 'search-params': Use search parameters for locale handling
253
+ *
254
+ * Examples with defaultLocale = 'en':
255
+ * - 'prefix-no-default': /dashboard (en) or /fr/dashboard (fr)
256
+ * - 'prefix-all': /en/dashboard (en) or /fr/dashboard (fr)
257
+ * - 'no-prefix': /dashboard (locale handled via other means)
258
+ * - 'search-params': /dashboard?locale=fr
259
+ *
260
+ * Note: This setting do not impact the cookie, or locale storage management.
261
+ *
262
+ * Default: 'prefix-no-default'
263
+ */
265
264
  mode: "prefix-no-default" | "prefix-all" | "no-prefix" | "search-params";
266
265
  /**
267
- * Pre-computed storage attributes derived from the raw `storage` input.
268
- * Populated at config-build time by `getStorageAttributes(rawStorage)`.
269
- * Use this at runtime instead of re-processing the raw storage config.
270
- */
266
+ * Enables the Intlayer locale-routing proxy (middleware).
267
+ *
268
+ * When enabled, the build-tool integration (e.g. the `intlayer()` Vite plugin)
269
+ * automatically wires the locale-detection / redirect / rewrite middleware in
270
+ * development, preview, and production SSR. Disable it when you want to handle
271
+ * locale routing yourself, or when your routing mode does not require a proxy.
272
+ *
273
+ * Default: true
274
+ */
275
+ enableProxy: boolean;
276
+ /**
277
+ * Pre-computed storage attributes derived from the raw `storage` input.
278
+ * Populated at config-build time by `getStorageAttributes(rawStorage)`.
279
+ * Use this at runtime instead of re-processing the raw storage config.
280
+ */
271
281
  storage: ProcessedStorageAttributes;
272
282
  /**
273
- * Base path for application URLs
274
- *
275
- * Default: ''
276
- *
277
- * Defines the base path where the application is accessible from.
278
- */
283
+ * Base path for application URLs
284
+ *
285
+ * Default: ''
286
+ *
287
+ * Defines the base path where the application is accessible from.
288
+ */
279
289
  basePath?: string;
280
290
  /**
281
- * Maps locales to specific domain hostnames for domain-based routing.
282
- * When a locale is mapped to a domain, URLs generated for that locale
283
- * will use that domain as the base URL (absolute URL), and no locale
284
- * prefix will be added to the path (the domain itself implies the locale).
285
- *
286
- * Default: undefined
287
- *
288
- * Example:
289
- * ```ts
290
- * domains: {
291
- * en: 'intlayer.org',
292
- * zh: 'intlayer.cn',
293
- * }
294
- * ```
295
- */
291
+ * Maps locales to specific domain hostnames for domain-based routing.
292
+ * When a locale is mapped to a domain, URLs generated for that locale
293
+ * will use that domain as the base URL (absolute URL), and no locale
294
+ * prefix will be added to the path (the domain itself implies the locale).
295
+ *
296
+ * Default: undefined
297
+ *
298
+ * Example:
299
+ * ```ts
300
+ * domains: {
301
+ * en: 'intlayer.org',
302
+ * zh: 'intlayer.cn',
303
+ * }
304
+ * ```
305
+ */
296
306
  domains?: Partial<Record<LocalesValues, string>>;
297
307
  };
298
308
  /**
299
- * Raw storage input accepted in the user-facing config (`intlayer.config.ts`).
300
- * Converted to {@link ProcessedStorageAttributes} during config build.
301
- *
302
- * Configuration for storing the locale in the client (localStorage or sessionStorage)
303
- *
304
- * If false, the locale will not be stored by the middleware.
305
- * If true, the locale storage will consider all default values.
306
- *
307
- * Default: ['cookie', 'header]
308
- *
309
- * Note: Check out GDPR compliance for cookies. See https://gdpr.eu/cookies/
310
- * Note: useLocale hook includes a prop to disable the cookie storage.
311
- * Note: Even if storage is disabled, the middleware will still detect the locale from the request header (1- check for `x-intlayer-locale`, 2- fallback to the `accept-language`).
312
- *
313
- * Recommendation:
314
- * - Config both localStorage and cookies for the storage of the locale if you want to support GDPR compliance.
315
- * - Disable the cookie storage by default on the useLocale hook by waiting for the user to consent to the cookie storage.
316
- */
309
+ * Raw storage input accepted in the user-facing config (`intlayer.config.ts`).
310
+ * Converted to {@link ProcessedStorageAttributes} during config build.
311
+ *
312
+ * Configuration for storing the locale in the client (localStorage or sessionStorage)
313
+ *
314
+ * If false, the locale will not be stored by the middleware.
315
+ * If true, the locale storage will consider all default values.
316
+ *
317
+ * Default: ['cookie', 'header]
318
+ *
319
+ * Note: Check out GDPR compliance for cookies. See https://gdpr.eu/cookies/
320
+ * Note: useLocale hook includes a prop to disable the cookie storage.
321
+ * Note: Even if storage is disabled, the middleware will still detect the locale from the request header (1- check for `x-intlayer-locale`, 2- fallback to the `accept-language`).
322
+ *
323
+ * Recommendation:
324
+ * - Config both localStorage and cookies for the storage of the locale if you want to support GDPR compliance.
325
+ * - Disable the cookie storage by default on the useLocale hook by waiting for the user to consent to the cookie storage.
326
+ */
317
327
  type RoutingStorageInput = false | "cookie" | "localStorage" | "sessionStorage" | "header" | CookiesAttributes | StorageAttributes | ("cookie" | "localStorage" | "sessionStorage" | "header" | CookiesAttributes | StorageAttributes)[];
318
328
  /**
319
- * User-facing routing configuration (accepted in `intlayer.config.ts`).
320
- */
329
+ * User-facing routing configuration (accepted in `intlayer.config.ts`).
330
+ */
321
331
  type CustomRoutingConfig = Omit<RoutingConfig, "storage"> & {
322
332
  storage?: RoutingStorageInput;
323
333
  };
324
334
  /**
325
- * Configuration for intlayer editor
326
- */
335
+ * Configuration for intlayer editor
336
+ */
327
337
  type EditorConfig = {
328
338
  /**
329
- * URL of the application. Used to restrict the origin of the editor for security reasons.
330
- *
331
- * Default: ''
332
- */
339
+ * URL of the application. Used to restrict the origin of the editor for security reasons.
340
+ *
341
+ * Default: ''
342
+ */
333
343
  applicationURL?: URLType;
334
344
  /**
335
- * Public URL for the editor.
336
- * Default: "http://localhost:8000"
337
- */
345
+ * Public URL for the editor.
346
+ * Default: "http://localhost:8000"
347
+ */
338
348
  editorURL?: URLType;
339
349
  /**
340
- * Intlayer CMS URL.
341
- * Default: "https://app.intlayer.org"
342
- */
350
+ * Intlayer CMS URL.
351
+ * Default: "https://app.intlayer.org"
352
+ */
343
353
  cmsURL?: URLType;
344
354
  /**
345
- * Backend API URL.
346
- * Default: "https://back.intlayer.org"
347
- */
355
+ * Backend API URL.
356
+ * Default: "https://back.intlayer.org"
357
+ */
348
358
  backendURL?: URLType;
349
359
  /**
350
- * Indicates if the application interact with the visual editor
351
- *
352
- * Default: false;
353
- *
354
- * If true, the editor will be able to interact with the application.
355
- * If false, the editor will not be able to interact with the application.
356
- * In any case, the editor can only be enabled by the visual editor.
357
- * Disabling the editor for specific environments is a way to enforce the security.
358
- *
359
- * Usage:
360
- * ```js
361
- * {
362
- * // Other configurations
363
- * editor: {
364
- * enabled: process.env.NODE_ENV !== 'production',
365
- * }
366
- * };
367
- * ```
368
- *
369
- */
360
+ * Indicates if the application interact with the visual editor
361
+ *
362
+ * Default: false;
363
+ *
364
+ * If true, the editor will be able to interact with the application.
365
+ * If false, the editor will not be able to interact with the application.
366
+ * In any case, the editor can only be enabled by the visual editor.
367
+ * Disabling the editor for specific environments is a way to enforce the security.
368
+ *
369
+ * Usage:
370
+ * ```js
371
+ * {
372
+ * // Other configurations
373
+ * editor: {
374
+ * enabled: process.env.NODE_ENV !== 'production',
375
+ * }
376
+ * };
377
+ * ```
378
+ *
379
+ */
370
380
  enabled: boolean;
371
381
  /** Port of the editor server
372
- *
373
- * Default: 8000
374
- */
382
+ *
383
+ * Default: 8000
384
+ */
375
385
  port: number;
376
386
  /**
377
- * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.
378
- * An access token is use to authenticate the user related to the project.
379
- * To get an access token, go to https://app.intlayer.org/project and create an account.
380
- *
381
- * Default: undefined
382
- *
383
- * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.
384
- */
387
+ * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.
388
+ * An access token is use to authenticate the user related to the project.
389
+ * To get an access token, go to https://app.intlayer.org/project and create an account.
390
+ *
391
+ * Default: undefined
392
+ *
393
+ * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.
394
+ */
385
395
  clientId?: string;
386
396
  /**
387
- * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.
388
- * An access token is use to authenticate the user related to the project.
389
- * To get an access token, go to https://app.intlayer.org/project and create an account.
390
- *
391
- * Default: undefined
392
- *
393
- * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.
394
- */
397
+ * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.
398
+ * An access token is use to authenticate the user related to the project.
399
+ * To get an access token, go to https://app.intlayer.org/project and create an account.
400
+ *
401
+ * Default: undefined
402
+ *
403
+ * > Important: The clientId and clientSecret should be kept secret and not shared publicly. Please ensure to keep them in a secure location, such as environment variables.
404
+ */
395
405
  clientSecret?: string;
396
406
  /**
397
- * Strategy for prioritizing dictionaries. If a dictionary is both present online and locally, the content will be merge.
398
- * However, is a field is defined in both dictionary, this setting determines which fields takes the priority over the other.
399
- *
400
- * Default: 'local_first'
401
- *
402
- * The strategy for prioritizing dictionaries. It can be either 'local_first' or 'distant_first'.
403
- * - 'local_first': The first dictionary found in the locale is used.
404
- * - 'distant_first': The first dictionary found in the distant locales is used.
405
- */
407
+ * Strategy for prioritizing dictionaries. If a dictionary is both present online and locally, the content will be merge.
408
+ * However, is a field is defined in both dictionary, this setting determines which fields takes the priority over the other.
409
+ *
410
+ * Default: 'local_first'
411
+ *
412
+ * The strategy for prioritizing dictionaries. It can be either 'local_first' or 'distant_first'.
413
+ * - 'local_first': The first dictionary found in the locale is used.
414
+ * - 'distant_first': The first dictionary found in the distant locales is used.
415
+ */
406
416
  dictionaryPriorityStrategy: "local_first" | "distant_first";
407
417
  /**
408
- * Indicates if the application should hot reload the locale configurations when a change is detected.
409
- * For example, when a new dictionary is added or updated, the application will update the content tu display in the page.
410
- *
411
- * Default: true
412
- */
418
+ * Indicates if the application should hot reload the locale configurations when a change is detected.
419
+ * For example, when a new dictionary is added or updated, the application will update the content tu display in the page.
420
+ *
421
+ * Default: true
422
+ */
413
423
  liveSync: boolean;
414
424
  /**
415
- * Port of the live sync server
416
- *
417
- * Default: 4000
418
- */
425
+ * Port of the live sync server
426
+ *
427
+ * Default: 4000
428
+ */
419
429
  liveSyncPort: number;
420
430
  /**
421
- * URL of the live sync server in case of remote live sync server
422
- *
423
- * Default: `http://localhost:${liveSyncPort}`
424
- */
431
+ * URL of the live sync server in case of remote live sync server
432
+ *
433
+ * Default: `http://localhost:${liveSyncPort}`
434
+ */
425
435
  liveSyncURL: URLType;
426
436
  };
437
+ /**
438
+ * Configuration for Intlayer analytics (`@intlayer/analytics`).
439
+ *
440
+ * Analytics is strictly **opt-in**: nothing is collected unless `enabled` is
441
+ * explicitly set to `true` AND a project key (`editor.clientId`) is configured
442
+ * for attribution.
443
+ */
444
+ type AnalyticsConfig = {
445
+ /**
446
+ * Enables analytics collection (page views, content exposures, A/B events).
447
+ *
448
+ * Default: false
449
+ *
450
+ * When `false` (the default), the whole `@intlayer/analytics` integration is
451
+ * dead-code-eliminated from the application bundle.
452
+ *
453
+ * Usage:
454
+ * ```js
455
+ * {
456
+ * // Other configurations
457
+ * analytics: {
458
+ * enabled: process.env.NODE_ENV === 'production',
459
+ * }
460
+ * };
461
+ * ```
462
+ */
463
+ enabled: boolean;
464
+ /**
465
+ * Milliseconds between automatic batched flushes to the backend.
466
+ *
467
+ * Default: 20000
468
+ */
469
+ flushInterval: number;
470
+ /**
471
+ * Fraction of sessions to record, from 0 (none) to 1 (all). Sampling is
472
+ * deterministic per session so recorded sessions report all of their events.
473
+ *
474
+ * Default: 1
475
+ */
476
+ sampleRate: number;
477
+ };
427
478
  declare enum AiProviders {
428
479
  OPENAI = "openai",
429
480
  ANTHROPIC = "anthropic",
@@ -444,810 +495,818 @@ declare enum AiProviders {
444
495
  }
445
496
  type CommonAiConfig = {
446
497
  /**
447
- * API model
448
- *
449
- * The model to use for the AI features of Intlayer.
450
- *
451
- * Example: 'gpt-4o-2024-11-20'
452
- *
453
- */
498
+ * API model
499
+ *
500
+ * The model to use for the AI features of Intlayer.
501
+ *
502
+ * Example: 'gpt-4o-2024-11-20'
503
+ *
504
+ */
454
505
  model?: string;
455
506
  /**
456
- * temperature
457
- *
458
- * The temperature to use for the AI features of Intlayer.
459
- * The temperature controls the randomness of the AI's responses.
460
- * A higher temperature will make the AI more creative and less predictable.
461
- *
462
- * Example: 0.1
463
- */
507
+ * temperature
508
+ *
509
+ * The temperature to use for the AI features of Intlayer.
510
+ * The temperature controls the randomness of the AI's responses.
511
+ * A higher temperature will make the AI more creative and less predictable.
512
+ *
513
+ * Example: 0.1
514
+ */
464
515
  temperature?: number;
465
516
  /**
466
- * API key
467
- *
468
- * Use your own OpenAI API key to use the AI features of Intlayer.
469
- * If you don't have an OpenAI API key, you can get one for free at https://openai.com/api/.
470
- *
471
- */
517
+ * API key
518
+ *
519
+ * Use your own OpenAI API key to use the AI features of Intlayer.
520
+ * If you don't have an OpenAI API key, you can get one for free at https://openai.com/api/.
521
+ *
522
+ */
472
523
  apiKey?: string;
473
524
  /**
474
- * Application context
475
- *
476
- * The context of the application to use for the AI features of Intlayer.
477
- *
478
- * Example: 'This is a website for a company that sells products online.'
479
- */
525
+ * Application context
526
+ *
527
+ * The context of the application to use for the AI features of Intlayer.
528
+ *
529
+ * Example: 'This is a website for a company that sells products online.'
530
+ */
480
531
  applicationContext?: string;
481
532
  /**
482
- * Base URL
483
- *
484
- * The base URL to use for the AI features of Intlayer.
485
- *
486
- * Example: 'https://api.openai.com/v1'
487
- */
533
+ * Base URL
534
+ *
535
+ * The base URL to use for the AI features of Intlayer.
536
+ *
537
+ * Example: 'https://api.openai.com/v1'
538
+ */
488
539
  baseURL?: string;
489
540
  /**
490
- * Data serialization
491
- *
492
- * The data serialization format to use for the AI features of Intlayer.
493
- *
494
- * Default: 'json'
495
- */
541
+ * Data serialization
542
+ *
543
+ * The data serialization format to use for the AI features of Intlayer.
544
+ *
545
+ * Default: 'json'
546
+ */
496
547
  dataSerialization?: "json" | "toon";
497
548
  };
498
549
  type AiProviderConfigMap = {};
499
550
  type AiConfigUnion = { [P in keyof AiProviderConfigMap]: {
500
551
  provider: P | `${P}`;
501
- } & AiProviderConfigMap[P] }[keyof AiProviderConfigMap];
552
+ } & AiProviderConfigMap[P]; }[keyof AiProviderConfigMap];
502
553
  type AiConfig = CommonAiConfig & (AiConfigUnion | {
503
554
  provider?: AiProviders | `${AiProviders}`;
504
555
  });
505
556
  type BuildConfig = {
506
557
  /**
507
- * Indicates the mode of the build
508
- *
509
- * Default: 'auto'
510
- *
511
- * If 'auto', the build will be enabled automatically when the application is built.
512
- * If 'manual', the build will be set only when the build command is executed.
513
- *
514
- * Can be used to disable dictionaries build, for instance when execution on Node.js environment should be avoided.
515
- */
558
+ * Indicates the mode of the build
559
+ *
560
+ * Default: 'auto'
561
+ *
562
+ * If 'auto', the build will be enabled automatically when the application is built.
563
+ * If 'manual', the build will be set only when the build command is executed.
564
+ *
565
+ * Can be used to disable dictionaries build, for instance when execution on Node.js environment should be avoided.
566
+ */
516
567
  mode: "auto" | "manual";
517
568
  /**
518
- * Indicates if the build should be optimized
519
- *
520
- * Default: undefined
521
- *
522
- * If true, the build will be optimized.
523
- * If false, the build will not be optimized.
524
- *
525
- * Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used.
526
- * All imports will stay as static import to avoid async processing when loading the dictionaries.
527
- *
528
- * Note:
529
- * - Intlayer will replace all call of `useIntlayer` with the defined mode by the `importMode` option.
530
- * - Intlayer will replace all call of `getIntlayer` with `getDictionary`.
531
- * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.
532
- * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
533
- */
569
+ * Indicates if the build should be optimized
570
+ *
571
+ * Default: undefined
572
+ *
573
+ * If true, the build will be optimized.
574
+ * If false, the build will not be optimized.
575
+ *
576
+ * Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used.
577
+ * All imports will stay as static import to avoid async processing when loading the dictionaries.
578
+ *
579
+ * Note:
580
+ * - Intlayer will replace all call of `useIntlayer` with the defined mode by the `importMode` option.
581
+ * - Intlayer will replace all call of `getIntlayer` with `getDictionary`.
582
+ * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.
583
+ * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
584
+ */
534
585
  optimize?: boolean;
535
586
  /**
536
- * Indicates the mode of import to use for the dictionaries.
537
- *
538
- * Available modes:
539
- * - "static": The dictionaries are imported statically.
540
- * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.
541
- * - "dynamic": The dictionaries are imported dynamically in a synchronous component using the suspense API.
542
- * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
543
- * - "fetch": The dictionaries are imported dynamically using the live sync API.
544
- * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
545
- * Fetch mode will use the live sync API to fetch the dictionaries. If the API call fails, the dictionaries will be imported dynamically as "dynamic" mode.
546
- *
547
- * Default: "static"
548
- *
549
- * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.
550
- *
551
- * Note:
552
- * - Dynamic imports rely on Suspense and may slightly impact rendering performance.
553
- * - If desabled all locales will be loaded at once, even if they are not used.
554
- * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.
555
- * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
556
- * - This option will be ignored if `optimize` is disabled.
557
- * - This option will not impact the `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` and `useDictionaryDynamic` functions. You can still use them to refine you code on manual optimization.
558
- * - The "fetch" allows to sync the dictionaries to the live sync server.
559
- * - Require static key to work. Example of invalid code: `const navbarKey = "my-key"; useIntlayer(navbarKey)`.
560
- *
561
- * @deprecated Use `dictionary.importMode` instead.
562
- */
587
+ * Indicates the mode of import to use for the dictionaries.
588
+ *
589
+ * Available modes:
590
+ * - "static": The dictionaries are imported statically.
591
+ * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.
592
+ * - "dynamic": The dictionaries are imported dynamically in a synchronous component using the suspense API.
593
+ * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
594
+ * - "fetch": The dictionaries are imported dynamically using the live sync API.
595
+ * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
596
+ * Fetch mode will use the live sync API to fetch the dictionaries. If the API call fails, the dictionaries will be imported dynamically as "dynamic" mode.
597
+ *
598
+ * Default: "static"
599
+ *
600
+ * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.
601
+ *
602
+ * Note:
603
+ * - Dynamic imports rely on Suspense and may slightly impact rendering performance.
604
+ * - If desabled all locales will be loaded at once, even if they are not used.
605
+ * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.
606
+ * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
607
+ * - This option will be ignored if `optimize` is disabled.
608
+ * - This option will not impact the `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` and `useDictionaryDynamic` functions. You can still use them to refine you code on manual optimization.
609
+ * - The "fetch" allows to sync the dictionaries to the live sync server.
610
+ * - Require static key to work. Example of invalid code: `const navbarKey = "my-key"; useIntlayer(navbarKey)`.
611
+ *
612
+ * @deprecated Use `dictionary.importMode` instead.
613
+ */
563
614
  importMode?: "static" | "dynamic" | "fetch";
564
615
  /**
565
- * Minify the dictionaries to reduce the bundle size.
566
- *
567
- * Default: false
568
- *
569
- * Note:
570
- * - This option will be ignored if `optimize` is disabled.
571
- * - This option will be ignore if `editor.enabled` is true.
572
- * - If there is edge cases where the minification is not working properly, the dictionary will be not minified.
573
- */
616
+ * Minify the dictionaries to reduce the bundle size.
617
+ *
618
+ * Default: false
619
+ *
620
+ * Note:
621
+ * - This option will be ignored if `optimize` is disabled.
622
+ * - This option will be ignore if `editor.enabled` is true.
623
+ * - If there is edge cases where the minification is not working properly, the dictionary will be not minified.
624
+ */
574
625
  minify: boolean;
575
626
  /**
576
- * Purge the unused keys in a dictionaries
577
- *
578
- * Default: false
579
- *
580
- * Note:
581
- * - This option will be ignored if `optimize` is disabled.
582
- */
627
+ * Purge the unused keys in a dictionaries
628
+ *
629
+ * Default: false
630
+ *
631
+ * Note:
632
+ * - This option will be ignored if `optimize` is disabled.
633
+ */
583
634
  purge: boolean;
584
635
  /**
585
- * Pattern to traverse the code to optimize.
586
- *
587
- * Allows to avoid to traverse the code that is not relevant to the optimization.
588
- * Improve build performance.
589
- *
590
- * Default: ['**\/*.{js,ts,mjs,cjs,jsx,tsx}', '!**\/node_modules/**']
591
- *
592
- * Example: `['src/**\/*.{ts,tsx}', '../ui-library/**\/*.{ts,tsx}', '!**\/node_modules/**']`
593
- *
594
- * Note:
595
- * - This option will be ignored if `optimize` is disabled.
596
- * - Use glob pattern.
597
- */
636
+ * Pattern to traverse the code to optimize.
637
+ *
638
+ * Allows to avoid to traverse the code that is not relevant to the optimization.
639
+ * Improve build performance.
640
+ *
641
+ * Default: ['**\/*.{js,ts,mjs,cjs,jsx,tsx}', '!**\/node_modules/**']
642
+ *
643
+ * Example: `['src/**\/*.{ts,tsx}', '../ui-library/**\/*.{ts,tsx}', '!**\/node_modules/**']`
644
+ *
645
+ * Note:
646
+ * - This option will be ignored if `optimize` is disabled.
647
+ * - Use glob pattern.
648
+ */
598
649
  traversePattern: string[];
599
650
  /**
600
- * Output format of the dictionaries
601
- *
602
- * Default: ['cjs', 'esm']
603
- *
604
- * The output format of the dictionaries. It can be either 'cjs' or 'esm'. Even if dictionaries are written in JSON, entry point to access the dictionaries are generated.
605
- * This function will use the output format defined using this option.
606
- * The default format is 'cjs' as it allows better interoperability with other libraries, scripts, and applications. But some build tools, such as Vite, require ES modules.
607
- */
651
+ * Output format of the dictionaries
652
+ *
653
+ * Default: ['cjs', 'esm']
654
+ *
655
+ * The output format of the dictionaries. It can be either 'cjs' or 'esm'. Even if dictionaries are written in JSON, entry point to access the dictionaries are generated.
656
+ * This function will use the output format defined using this option.
657
+ * The default format is 'cjs' as it allows better interoperability with other libraries, scripts, and applications. But some build tools, such as Vite, require ES modules.
658
+ */
608
659
  outputFormat: ("cjs" | "esm")[];
609
660
  /**
610
- * Indicates if the cache should be enabled
611
- *
612
- * Default: true
613
- *
614
- * If true, the cache will be enabled.
615
- * If false, the cache will not be enabled.
616
- */
661
+ * Indicates if the cache should be enabled
662
+ *
663
+ * Default: true
664
+ *
665
+ * If true, the cache will be enabled.
666
+ * If false, the cache will not be enabled.
667
+ */
617
668
  cache: boolean;
618
669
  /**
619
- * Require function
620
- *
621
- * In some environments, as VSCode extension, the require function should be set relatively to the project root to work properly.
622
- *
623
- * Default: undefined
624
- *
625
- * If undefined, the require function will be set to the default require function.
626
- * If defined, the require function will be set to the defined require function.
627
- *
628
- * Example:
629
- * ```js
630
- * {
631
- * require: require
632
- * }
633
- * ```
634
- */
670
+ * Require function
671
+ *
672
+ * In some environments, as VSCode extension, the require function should be set relatively to the project root to work properly.
673
+ *
674
+ * Default: undefined
675
+ *
676
+ * If undefined, the require function will be set to the default require function.
677
+ * If defined, the require function will be set to the defined require function.
678
+ *
679
+ * Example:
680
+ * ```js
681
+ * {
682
+ * require: require
683
+ * }
684
+ * ```
685
+ */
635
686
  require?: NodeJS.Require;
636
687
  /**
637
- * Indicates if the build should check TypeScript types
638
- *
639
- * Default: false
640
- *
641
- * If true, the build will check TypeScript types and log errors.
642
- * Note: This can slow down the build.
643
- */
688
+ * Indicates if the build should check TypeScript types
689
+ *
690
+ * Default: false
691
+ *
692
+ * If true, the build will check TypeScript types and log errors.
693
+ * Note: This can slow down the build.
694
+ */
644
695
  checkTypes: boolean;
645
696
  };
646
697
  type CompilerConfig = {
647
698
  /**
648
- * Indicates if the compiler should be enabled.
649
- * If 'build-only', the compiler will be skipped during development mode to speed up start times.
650
- */
699
+ * Indicates if the compiler should be enabled.
700
+ * If 'build-only', the compiler will be skipped during development mode to speed up start times.
701
+ */
651
702
  enabled: boolean | "build-only";
652
703
  /**
653
- * Prefix for the extracted dictionary keys.
654
- * Default: ''
655
- */
704
+ * Prefix for the extracted dictionary keys.
705
+ * Default: ''
706
+ */
656
707
  dictionaryKeyPrefix?: string;
657
708
  /**
658
- * Pattern to traverse the code to optimize.
659
- *
660
- * Allows to avoid to traverse the code that is not relevant to the optimization.
661
- * Improve build performance.
662
- *
663
- * Default: ['**\/*.{ts,tsx,jsx,js,cjs,mjs,svelte,vue}', '!**\/node_modules/**']
664
- *
665
- * Example: `['src/**\/*.{ts,tsx}', '../ui-library/**\/*.{ts,tsx}', '!**\/node_modules/**']`
666
- *
667
- * Note:
668
- * - This option will be ignored if `optimize` is disabled.
669
- * - Use glob pattern.
670
- *
671
- * @deprecated use build.traversePattern instead
672
- */
709
+ * Pattern to traverse the code to optimize.
710
+ *
711
+ * Allows to avoid to traverse the code that is not relevant to the optimization.
712
+ * Improve build performance.
713
+ *
714
+ * Default: ['**\/*.{ts,tsx,jsx,js,cjs,mjs,svelte,vue}', '!**\/node_modules/**']
715
+ *
716
+ * Example: `['src/**\/*.{ts,tsx}', '../ui-library/**\/*.{ts,tsx}', '!**\/node_modules/**']`
717
+ *
718
+ * Note:
719
+ * - This option will be ignored if `optimize` is disabled.
720
+ * - Use glob pattern.
721
+ *
722
+ * @deprecated use build.traversePattern instead
723
+ */
673
724
  transformPattern?: string | string[];
674
725
  /**
675
- * Pattern to exclude from the optimization.
676
- *
677
- * Allows to exclude files from the optimization.
678
- *
679
- * Default: ['**\/node_modules/**']
680
- *
681
- * Example: `['**\/node_modules/**', '!**\/node_modules/react/**']`
682
- *
683
- * @deprecated use build.traversePattern instead
684
- */
726
+ * Pattern to exclude from the optimization.
727
+ *
728
+ * Allows to exclude files from the optimization.
729
+ *
730
+ * Default: ['**\/node_modules/**']
731
+ *
732
+ * Example: `['**\/node_modules/**', '!**\/node_modules/react/**']`
733
+ *
734
+ * @deprecated use build.traversePattern instead
735
+ */
685
736
  excludePattern?: string | string[];
686
737
  /**
687
- * Defines the output files path. Replaces `outputDir`.
688
- *
689
- * - `./` paths are resolved relative to the component directory.
690
- * - `/` paths are resolved relative to the project root (`baseDir`).
691
- *
692
- * - Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale.
693
- *
694
- * Example:
695
- * ```ts
696
- * {
697
- * // Create Multilingual .content.ts files close to the component
698
- * output: ({ fileName, extension }) => `./${fileName}${extension}`,
699
- *
700
- * // output: './{{fileName}}{{extension}}', // Equivalent using template string
701
- * }
702
- * ```
703
- *
704
- * ```ts
705
- * {
706
- * // Create centralize per-locale JSON at the root of the project
707
- * output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
708
- *
709
- * // output: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string
710
- * }
711
- * ```
712
- *
713
- * ```ts
714
- * {
715
- * // Create per-locale JSON files with locale-specific output paths
716
- * output: {
717
- * en: ({ fileName, locale }) => `${fileName}.${locale}.content.json`,
718
- * fr: '{{fileName}}.{{locale}}.content.json',
719
- * es: false, // skip this locale
720
- * },
721
- * }
722
- * ```
723
- *
724
- * Variable list:
725
- * - `fileName`: The name of the file.
726
- * - `key`: The key of the content.
727
- * - `locale`: The locale of the content.
728
- * - `extension`: The extension of the file.
729
- * - `componentFileName`: The name of the component file.
730
- * - `componentExtension`: The extension of the component file.
731
- * - `format`: The format of the dictionary.
732
- * - `componentFormat`: The format of the component dictionary.
733
- * - `componentDirPath`: The directory path of the component.
734
- */
738
+ * Defines the output files path. Replaces `outputDir`.
739
+ *
740
+ * - `./` paths are resolved relative to the component directory.
741
+ * - `/` paths are resolved relative to the project root (`baseDir`).
742
+ *
743
+ * - Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale.
744
+ *
745
+ * Example:
746
+ * ```ts
747
+ * {
748
+ * // Create Multilingual .content.ts files close to the component
749
+ * output: ({ fileName, extension }) => `./${fileName}${extension}`,
750
+ *
751
+ * // output: './{{fileName}}{{extension}}', // Equivalent using template string
752
+ * }
753
+ * ```
754
+ *
755
+ * ```ts
756
+ * {
757
+ * // Create centralize per-locale JSON at the root of the project
758
+ * output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
759
+ *
760
+ * // output: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string
761
+ * }
762
+ * ```
763
+ *
764
+ * ```ts
765
+ * {
766
+ * // Create per-locale JSON files with locale-specific output paths
767
+ * output: {
768
+ * en: ({ fileName, locale }) => `${fileName}.${locale}.content.json`,
769
+ * fr: '{{fileName}}.{{locale}}.content.json',
770
+ * es: false, // skip this locale
771
+ * },
772
+ * }
773
+ * ```
774
+ *
775
+ * Variable list:
776
+ * - `fileName`: The name of the file.
777
+ * - `key`: The key of the content.
778
+ * - `locale`: The locale of the content.
779
+ * - `extension`: The extension of the file.
780
+ * - `componentFileName`: The name of the component file.
781
+ * - `componentExtension`: The extension of the component file.
782
+ * - `format`: The format of the dictionary.
783
+ * - `componentFormat`: The format of the component dictionary.
784
+ * - `componentDirPath`: The directory path of the component.
785
+ */
735
786
  output?: Fill;
736
787
  /**
737
- * Indicates if the metadata should be saved in the file.
738
- *
739
- * If true, the compiler will not save the metadata of the dictionaries.
740
- *
741
- * If true:
742
- *
743
- * ```json
744
- * {
745
- * "key": "value"
746
- * }
747
- * ```
748
- *
749
- * If false:
750
- *
751
- * ```json
752
- * {
753
- * "key": "value",
754
- * "content": {
755
- * "key": "value"
756
- * }
757
- * }
758
- * ```
759
- *
760
- * Default: false
761
- *
762
- * Note: Useful if used with loadJSON plugin
763
- *
764
- */
788
+ * Indicates if the metadata should be saved in the file.
789
+ *
790
+ * If true, the compiler will not save the metadata of the dictionaries.
791
+ *
792
+ * If true:
793
+ *
794
+ * ```json
795
+ * {
796
+ * "key": "value"
797
+ * }
798
+ * ```
799
+ *
800
+ * If false:
801
+ *
802
+ * ```json
803
+ * {
804
+ * "key": "value",
805
+ * "content": {
806
+ * "key": "value"
807
+ * }
808
+ * }
809
+ * ```
810
+ *
811
+ * Default: false
812
+ *
813
+ * Note: Useful if used with loadJSON plugin
814
+ *
815
+ */
765
816
  noMetadata?: boolean;
766
817
  /**
767
- * Indicates if the components should be saved after being transformed.
768
- *
769
- * If true, the compiler will replace the original files with the transformed files.
770
- * That way, the compiler can be run only once to transform the app, and then it can be removed.
771
- *
772
- * Default: false
773
- */
818
+ * Indicates if the components should be saved after being transformed.
819
+ *
820
+ * If true, the compiler will replace the original files with the transformed files.
821
+ * That way, the compiler can be run only once to transform the app, and then it can be removed.
822
+ *
823
+ * Default: false
824
+ */
774
825
  saveComponents: boolean;
775
826
  };
776
827
  /**
777
- * Custom configuration that can be provided to override default settings
778
- */
828
+ * Custom configuration that can be provided to override default settings
829
+ */
779
830
  type CustomIntlayerConfig = {
780
831
  /**
781
- * Custom internationalization configuration
782
- */
832
+ * Custom internationalization configuration
833
+ */
783
834
  internationalization?: Partial<InternationalizationConfig>;
784
835
  /**
785
- * Custom dictionary configuration
786
- */
836
+ * Custom dictionary configuration
837
+ */
787
838
  dictionary?: Partial<DictionaryConfig>;
788
839
  /**
789
- * Custom routing configuration
790
- */
840
+ * Custom routing configuration
841
+ */
791
842
  routing?: Partial<CustomRoutingConfig>;
792
843
  /**
793
- * Custom content configuration
794
- */
844
+ * Custom content configuration
845
+ */
795
846
  content?: Partial<ContentConfig>;
796
847
  /**
797
- * Custom editor configuration
798
- */
848
+ * Custom editor configuration
849
+ */
799
850
  editor?: Partial<EditorConfig>;
800
851
  /**
801
- * Custom log configuration
802
- */
852
+ * Custom analytics configuration
853
+ */
854
+ analytics?: Partial<AnalyticsConfig>;
855
+ /**
856
+ * Custom log configuration
857
+ */
803
858
  log?: Partial<LogConfig>;
804
859
  /**
805
- * Custom AI configuration
806
- */
860
+ * Custom AI configuration
861
+ */
807
862
  ai?: Partial<AiConfig>;
808
863
  /**
809
- * Custom build configuration
810
- */
864
+ * Custom build configuration
865
+ */
811
866
  build?: Partial<BuildConfig>;
812
867
  /**
813
- * Custom compiler configuration
814
- */
868
+ * Custom compiler configuration
869
+ */
815
870
  compiler?: Partial<CompilerConfig>;
816
871
  /**
817
- * Custom system configuration
818
- */
872
+ * Custom system configuration
873
+ */
819
874
  system?: Partial<SystemConfig>;
820
875
  /**
821
- * Custom schemas to validate the dictionaries content.
822
- *
823
- * Example:
824
- * ```ts
825
- * {
826
- * schemas: {
827
- * 'my-schema': z.object({
828
- * title: z.string(),
829
- * description: z.string(),
830
- * }),
831
- * }
832
- * }
833
- * ```
834
- */
876
+ * Custom schemas to validate the dictionaries content.
877
+ *
878
+ * Example:
879
+ * ```ts
880
+ * {
881
+ * schemas: {
882
+ * 'my-schema': z.object({
883
+ * title: z.string(),
884
+ * description: z.string(),
885
+ * }),
886
+ * }
887
+ * }
888
+ * ```
889
+ */
835
890
  schemas?: Record<string, ConfigSchema>;
836
891
  /**
837
- * Custom plugins configuration
838
- */
892
+ * Custom plugins configuration
893
+ */
839
894
  plugins?: (Plugin | Promise<Plugin>)[];
840
895
  };
841
896
  type DictionaryConfig = {
842
897
  /**
843
- * Indicate how the dictionary should be filled using AI.
844
- *
845
- * Default: `true`
846
- *
847
- * - If `true`, will consider the `compiler.output` field.
848
- * - If `false`, will skip the fill process.
849
- *
850
- * - `./` paths are resolved relative to the component directory.
851
- * - `/` paths are resolved relative to the project root (`baseDir`).
852
- *
853
- * - If includes `{{locale}}` variable in the path, will trigger the generation of separate dictionaries per locale.
854
- *
855
- * Example:
856
- * ```ts
857
- * {
858
- * // Create Multilingual .content.ts files close to the component
859
- * fill: ({ fileName, extension }) => `./${fileName}${extension}`,
860
- *
861
- * // fill: './{{fileName}}{{extension}}', // Equivalent using template string
862
- * }
863
- * ```
864
- *
865
- * ```ts
866
- * {
867
- * // Create centralize per-locale JSON at the root of the project
868
- * fill: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
869
- *
870
- * // fill: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string
871
- * }
872
- * ```
873
- *
874
- * ```ts
875
- * {
876
- * // Create custom output based on the locale
877
- * fill: {
878
- * en: ({ key }) => `/locales/en/${key}.content.json`,
879
- * fr: '/locales/fr/{{key}}.content.json',
880
- * es: false,
881
- * de: true,
882
- * },
883
- * }
884
- * ```
885
- *
886
- *
887
- * Variable list:
888
- * - `fileName`: The name of the file.
889
- * - `key`: The key of the content.
890
- * - `locale`: The locale of the content.
891
- * - `extension`: The extension of the file.
892
- * - `componentFileName`: The name of the component file.
893
- * - `componentExtension`: The extension of the component file.
894
- * - `format`: The format of the dictionary.
895
- * - `componentFormat`: The format of the component dictionary.
896
- * - `componentDirPath`: The directory path of the component.
897
- */
898
+ * Indicate how the dictionary should be filled using AI.
899
+ *
900
+ * Default: `true`
901
+ *
902
+ * - If `true`, will consider the `compiler.output` field.
903
+ * - If `false`, will skip the fill process.
904
+ *
905
+ * - `./` paths are resolved relative to the component directory.
906
+ * - `/` paths are resolved relative to the project root (`baseDir`).
907
+ *
908
+ * - If includes `{{locale}}` variable in the path, will trigger the generation of separate dictionaries per locale.
909
+ *
910
+ * Example:
911
+ * ```ts
912
+ * {
913
+ * // Create Multilingual .content.ts files close to the component
914
+ * fill: ({ fileName, extension }) => `./${fileName}${extension}`,
915
+ *
916
+ * // fill: './{{fileName}}{{extension}}', // Equivalent using template string
917
+ * }
918
+ * ```
919
+ *
920
+ * ```ts
921
+ * {
922
+ * // Create centralize per-locale JSON at the root of the project
923
+ * fill: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
924
+ *
925
+ * // fill: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string
926
+ * }
927
+ * ```
928
+ *
929
+ * ```ts
930
+ * {
931
+ * // Create custom output based on the locale
932
+ * fill: {
933
+ * en: ({ key }) => `/locales/en/${key}.content.json`,
934
+ * fr: '/locales/fr/{{key}}.content.json',
935
+ * es: false,
936
+ * de: true,
937
+ * },
938
+ * }
939
+ * ```
940
+ *
941
+ *
942
+ * Variable list:
943
+ * - `fileName`: The name of the file.
944
+ * - `key`: The key of the content.
945
+ * - `locale`: The locale of the content.
946
+ * - `extension`: The extension of the file.
947
+ * - `componentFileName`: The name of the component file.
948
+ * - `componentExtension`: The extension of the component file.
949
+ * - `format`: The format of the dictionary.
950
+ * - `componentFormat`: The format of the component dictionary.
951
+ * - `componentDirPath`: The directory path of the component.
952
+ */
898
953
  fill?: Fill;
899
954
  /**
900
- * The description of the dictionary. Helps to understand the purpose of the dictionary in the editor, and the CMS.
901
- * The description is also used as context for translations generation.
902
- *
903
- * Example:
904
- * ```ts
905
- * {
906
- * "key": "about-page-meta",
907
- * "description":[
908
- * "This dictionary is manage the metadata of the About Page",
909
- * "Consider good practices for SEO:",
910
- * "- The title should be between 50 and 60 characters",
911
- * "- The description should be between 150 and 160 characters",
912
- * ].join('\n'),
913
- * "content": { ... }
914
- * }
915
- * ```
916
- */
955
+ * The description of the dictionary. Helps to understand the purpose of the dictionary in the editor, and the CMS.
956
+ * The description is also used as context for translations generation.
957
+ *
958
+ * Example:
959
+ * ```ts
960
+ * {
961
+ * "key": "about-page-meta",
962
+ * "description":[
963
+ * "This dictionary is manage the metadata of the About Page",
964
+ * "Consider good practices for SEO:",
965
+ * "- The title should be between 50 and 60 characters",
966
+ * "- The description should be between 150 and 160 characters",
967
+ * ].join('\n'),
968
+ * "content": { ... }
969
+ * }
970
+ * ```
971
+ */
917
972
  description?: string;
918
973
  /**
919
- * Transform the dictionary in a per-locale dictionary.
920
- * Each field declared in a per-locale dictionary will be transformed in a translation node.
921
- * If missing, the dictionary will be treated as a multilingual dictionary.
922
- * If declared, do not use translation nodes in the content.
923
- *
924
- * Example:
925
- * ```json
926
- * {
927
- * "key": "about-page",
928
- * "locale": "en",
929
- * "content": {
930
- * "multilingualContent": "English content"
931
- * }
932
- * }
933
- * ```
934
- */
974
+ * Transform the dictionary in a per-locale dictionary.
975
+ * Each field declared in a per-locale dictionary will be transformed in a translation node.
976
+ * If missing, the dictionary will be treated as a multilingual dictionary.
977
+ * If declared, do not use translation nodes in the content.
978
+ *
979
+ * Example:
980
+ * ```json
981
+ * {
982
+ * "key": "about-page",
983
+ * "locale": "en",
984
+ * "content": {
985
+ * "multilingualContent": "English content"
986
+ * }
987
+ * }
988
+ * ```
989
+ */
935
990
  locale?: LocalesValues;
936
991
  /**
937
- * Indicators if the content of the dictionary should be automatically transformed.
938
- * If true, the content will be transformed to the corresponding node type.
939
- * - Markdown: `### Title` -> `md('### Title')`
940
- * - HTML: `<div>Title</div>` -> `html('<div>Title</div>')`
941
- * - Insertion: `Hello {{name}}` -> `insert('Hello {{name}}')`
942
- *
943
- * If an object is provided, you can specify which transformations should be enabled.
944
- *
945
- * Default: false
946
- */
992
+ * Indicators if the content of the dictionary should be automatically transformed.
993
+ * If true, the content will be transformed to the corresponding node type.
994
+ * - Markdown: `### Title` -> `md('### Title')`
995
+ * - HTML: `<div>Title</div>` -> `html('<div>Title</div>')`
996
+ * - Insertion: `Hello {{name}}` -> `insert('Hello {{name}}')`
997
+ *
998
+ * If an object is provided, you can specify which transformations should be enabled.
999
+ *
1000
+ * Default: false
1001
+ */
947
1002
  contentAutoTransformation?: ContentAutoTransformation;
948
1003
  /**
949
- * Indicates the priority of the dictionary.
950
- * In the case of conflicts, the dictionary with the highest priority will override the other dictionaries.
951
- */
1004
+ * Indicates the priority of the dictionary.
1005
+ * In the case of conflicts, the dictionary with the highest priority will override the other dictionaries.
1006
+ */
952
1007
  priority?: number;
953
1008
  /**
954
- * Indicates the mode of import to use for the dictionaries.
955
- *
956
- * Available modes:
957
- * - "static": The dictionaries are imported statically.
958
- * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.
959
- * - "dynamic": The dictionaries are imported dynamically in a synchronous component using the suspense API.
960
- * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
961
- * - "fetch": The dictionaries are imported dynamically using the live sync API.
962
- * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
963
- * Fetch mode will use the live sync API to fetch the dictionaries. If the API call fails, the dictionaries will be imported dynamically as "dynamic" mode.
964
- *
965
- * Default: "static"
966
- *
967
- * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.
968
- *
969
- * Note:
970
- * - Dynamic imports rely on Suspense and may slightly impact rendering performance.
971
- * - If disabled all locales will be loaded at once, even if they are not used.
972
- * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.
973
- * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
974
- * - This option will be ignored if `optimize` is disabled.
975
- * - This option will not impact the `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` and `useDictionaryDynamic` functions. You can still use them to refine you code on manual optimization.
976
- * - The "fetch" allows to sync the dictionaries to the live sync server.
977
- * - Require static key to work. Example of invalid code: `const navbarKey = "my-key"; useIntlayer(navbarKey)`.
978
- */
1009
+ * Indicates the mode of import to use for the dictionaries.
1010
+ *
1011
+ * Available modes:
1012
+ * - "static": The dictionaries are imported statically.
1013
+ * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.
1014
+ * - "dynamic": The dictionaries are imported dynamically in a synchronous component using the suspense API.
1015
+ * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
1016
+ * - "fetch": The dictionaries are imported dynamically using the live sync API.
1017
+ * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
1018
+ * Fetch mode will use the live sync API to fetch the dictionaries. If the API call fails, the dictionaries will be imported dynamically as "dynamic" mode.
1019
+ *
1020
+ * Default: "static"
1021
+ *
1022
+ * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.
1023
+ *
1024
+ * Note:
1025
+ * - Dynamic imports rely on Suspense and may slightly impact rendering performance.
1026
+ * - If disabled all locales will be loaded at once, even if they are not used.
1027
+ * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.
1028
+ * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
1029
+ * - This option will be ignored if `optimize` is disabled.
1030
+ * - This option will not impact the `getIntlayer`, `getDictionary`, `useDictionary`, `useDictionaryAsync` and `useDictionaryDynamic` functions. You can still use them to refine you code on manual optimization.
1031
+ * - The "fetch" allows to sync the dictionaries to the live sync server.
1032
+ * - Require static key to work. Example of invalid code: `const navbarKey = "my-key"; useIntlayer(navbarKey)`.
1033
+ */
979
1034
  importMode?: "static" | "dynamic" | "fetch";
980
1035
  /**
981
- * The title of the dictionary. Helps to identify the dictionary in the editor, and the CMS.
982
- *
983
- * Example:
984
- * ```json
985
- * {
986
- * "key": "about-page-meta",
987
- * "title": "About Page",
988
- * "content": { ... }
989
- * }
990
- * ```
991
- */
1036
+ * The title of the dictionary. Helps to identify the dictionary in the editor, and the CMS.
1037
+ *
1038
+ * Example:
1039
+ * ```json
1040
+ * {
1041
+ * "key": "about-page-meta",
1042
+ * "title": "About Page",
1043
+ * "content": { ... }
1044
+ * }
1045
+ * ```
1046
+ */
992
1047
  title?: string;
993
1048
  /**
994
- * Helps to categorize the dictionaries. The tags can provide more context and instructions for the dictionary.
995
- *
996
- * Example:
997
- * ```json
998
- * {
999
- * "key": "about-page-meta",
1000
- * "tags": ["metadata","about-page"]
1001
- * }
1002
- * ```
1003
- */
1049
+ * Helps to categorize the dictionaries. The tags can provide more context and instructions for the dictionary.
1050
+ *
1051
+ * Example:
1052
+ * ```json
1053
+ * {
1054
+ * "key": "about-page-meta",
1055
+ * "tags": ["metadata","about-page"]
1056
+ * }
1057
+ * ```
1058
+ */
1004
1059
  tags?: string[];
1005
1060
  /**
1006
- * Indicates the location of the dictionary and controls how it synchronizes with the CMS.
1007
- *
1008
- * - 'hybrid': The dictionary is managed locally and remotely. Once pushed on the CMS, it will be synchronized from the local one. The local dictionary will be pulled from the CMS.
1009
- * - 'remote': The dictionary is managed remotely only. Once pushed on the CMS, it will be detached from the local one. At content load time, the remote dictionary will be pulled from the CMS. A '.content' file with remote location will be ignored.
1010
- * - 'local': The dictionary is managed locally. It will not be pushed to the remote CMS.
1011
- * - 'plugin' (or any custom string): The dictionary is managed by a plugin, or a custom source. When you will try to push it, the system will ask an action to the user.
1012
- */
1061
+ * Indicates the location of the dictionary and controls how it synchronizes with the CMS.
1062
+ *
1063
+ * - 'hybrid': The dictionary is managed locally and remotely. Once pushed on the CMS, it will be synchronized from the local one. The local dictionary will be pulled from the CMS.
1064
+ * - 'remote': The dictionary is managed remotely only. Once pushed on the CMS, it will be detached from the local one. At content load time, the remote dictionary will be pulled from the CMS. A '.content' file with remote location will be ignored.
1065
+ * - 'local': The dictionary is managed locally. It will not be pushed to the remote CMS.
1066
+ * - 'plugin' (or any custom string): The dictionary is managed by a plugin, or a custom source. When you will try to push it, the system will ask an action to the user.
1067
+ */
1013
1068
  location?: DictionaryLocation;
1014
1069
  /**
1015
- * The default message format for all dictionaries in the project.
1016
- *
1017
- * Controls how dictionary content strings are interpreted at runtime.
1018
- *
1019
- * - 'intlayer': Native intlayer format (default).
1020
- * - 'icu': ICU message format (used by next-intl, react-intl, etc.).
1021
- * - 'i18next': i18next interpolation format (used by i18next, react-i18next, next-i18next).
1022
- * - 'vue-i18n': Vue I18n format (used by vue-i18n).
1023
- * - 'po': GNU Gettext PO format.
1024
- *
1025
- * Default: 'intlayer'
1026
- */
1070
+ * The default message format for all dictionaries in the project.
1071
+ *
1072
+ * Controls how dictionary content strings are interpreted at runtime.
1073
+ *
1074
+ * - 'intlayer': Native intlayer format (default).
1075
+ * - 'icu': ICU message format (used by next-intl, react-intl, etc.).
1076
+ * - 'i18next': i18next interpolation format (used by i18next, react-i18next, next-i18next).
1077
+ * - 'vue-i18n': Vue I18n format (used by vue-i18n).
1078
+ * - 'po': GNU Gettext PO format.
1079
+ *
1080
+ * Default: 'intlayer'
1081
+ */
1027
1082
  format?: DictionaryFormat;
1028
1083
  };
1029
1084
  /**
1030
- * Combined configuration for internationalization, middleware, and content
1031
- */
1085
+ * Combined configuration for internationalization, middleware, and content
1086
+ */
1032
1087
  type IntlayerConfig = {
1033
1088
  /**
1034
- * Internationalization configuration
1035
- */
1089
+ * Internationalization configuration
1090
+ */
1036
1091
  internationalization: InternationalizationConfig;
1037
1092
  /**
1038
- * Default dictionary configuration
1039
- */
1093
+ * Default dictionary configuration
1094
+ */
1040
1095
  dictionary?: Partial<DictionaryConfig>;
1041
1096
  /**
1042
- * Routing configuration
1043
- */
1097
+ * Routing configuration
1098
+ */
1044
1099
  routing: RoutingConfig;
1045
1100
  /**
1046
- * Content configuration
1047
- */
1101
+ * Content configuration
1102
+ */
1048
1103
  content: ContentConfig;
1049
1104
  /**
1050
- * System configuration
1051
- */
1105
+ * System configuration
1106
+ */
1052
1107
  system: SystemConfig;
1053
1108
  /**
1054
- * Intlayer editor configuration
1055
- */
1109
+ * Intlayer editor configuration
1110
+ */
1056
1111
  editor: EditorConfig;
1057
1112
  /**
1058
- * Logger configuration
1059
- */
1113
+ * Intlayer analytics configuration
1114
+ */
1115
+ analytics?: AnalyticsConfig;
1116
+ /**
1117
+ * Logger configuration
1118
+ */
1060
1119
  log: LogConfig;
1061
1120
  /**
1062
- * AI configuration
1063
- */
1121
+ * AI configuration
1122
+ */
1064
1123
  ai?: Partial<AiConfig>;
1065
1124
  /**
1066
- * Build configuration
1067
- */
1125
+ * Build configuration
1126
+ */
1068
1127
  build: BuildConfig;
1069
1128
  /**
1070
- * Compiler configuration
1071
- */
1129
+ * Compiler configuration
1130
+ */
1072
1131
  compiler: CompilerConfig;
1073
1132
  /**
1074
- * Custom schemas to validate the dictionaries content.
1075
- */
1133
+ * Custom schemas to validate the dictionaries content.
1134
+ */
1076
1135
  schemas?: Record<string, ConfigSchema>;
1077
1136
  /**
1078
- * Plugins configuration
1079
- */
1137
+ * Plugins configuration
1138
+ */
1080
1139
  plugins?: Plugin[];
1081
1140
  };
1082
1141
  /**
1083
- * Configuration for content handling
1084
- */
1142
+ * Configuration for content handling
1143
+ */
1085
1144
  type ContentConfig = {
1086
1145
  /**
1087
- * File extensions of content to look for
1088
- *
1089
- * Default: ['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']
1090
- *
1091
- * List of file extensions to scan for content.
1092
- */
1146
+ * File extensions of content to look for
1147
+ *
1148
+ * Default: ['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']
1149
+ *
1150
+ * List of file extensions to scan for content.
1151
+ */
1093
1152
  fileExtensions: string[];
1094
1153
  /**
1095
- * Directory where the content is stored, relative to the base directory
1096
- *
1097
- * Default: ['.']
1098
- *
1099
- * Derived content directory based on the base configuration.
1100
- *
1101
- * Note: This is used to watch for content files.
1102
- */
1154
+ * Directory where the content is stored, relative to the base directory
1155
+ *
1156
+ * Default: ['.']
1157
+ *
1158
+ * Derived content directory based on the base configuration.
1159
+ *
1160
+ * Note: This is used to watch for content files.
1161
+ */
1103
1162
  contentDir: string[];
1104
1163
  /**
1105
- * Directory where the code is stored, relative to the base directory
1106
- *
1107
- * Default: ['.']
1108
- *
1109
- * Derived code directory based on the base configuration.
1110
- *
1111
- * Note: This is used to watch for code files to transform.
1112
- */
1164
+ * Directory where the code is stored, relative to the base directory
1165
+ *
1166
+ * Default: ['.']
1167
+ *
1168
+ * Derived code directory based on the base configuration.
1169
+ *
1170
+ * Note: This is used to watch for code files to transform.
1171
+ */
1113
1172
  codeDir: string[];
1114
1173
  /**
1115
- * Directories to be excluded from content processing
1116
- *
1117
- * Default: ['node_modules', '.intlayer']
1118
- *
1119
- * A list of directories to exclude from content processing.
1120
- */
1174
+ * Directories to be excluded from content processing
1175
+ *
1176
+ * Default: ['node_modules', '.intlayer']
1177
+ *
1178
+ * A list of directories to exclude from content processing.
1179
+ */
1121
1180
  excludedPath: string[];
1122
1181
  /**
1123
- * Indicates if Intlayer should watch for changes in the content declaration files in the app to rebuild the related dictionaries.
1124
- *
1125
- * Default: process.env.NODE_ENV === 'development'
1126
- */
1182
+ * Indicates if Intlayer should watch for changes in the content declaration files in the app to rebuild the related dictionaries.
1183
+ *
1184
+ * Default: process.env.NODE_ENV === 'development'
1185
+ */
1127
1186
  watch: boolean;
1128
1187
  /**
1129
- * Command to format the content. When intlayer write your .content files locally, this command will be used to format the content.
1130
- *
1131
- * Example:
1132
- *
1133
- * ```bash
1134
- * npx prettier --write {{file}}
1135
- * ```
1136
- *
1137
- * ```bash
1138
- * bunx biome format {{file}}
1139
- * ```
1140
- *
1141
- * ```bash
1142
- * bun format {{file}}
1143
- * ```
1144
- *
1145
- * ```bash
1146
- * npx eslint --fix {{file}}
1147
- * ```
1148
- *
1149
- * Intlayer will replace the {{file}} with the path of the file to format.
1150
- *
1151
- * Default: undefined
1152
- */
1188
+ * Command to format the content. When intlayer write your .content files locally, this command will be used to format the content.
1189
+ *
1190
+ * Example:
1191
+ *
1192
+ * ```bash
1193
+ * npx prettier --write {{file}}
1194
+ * ```
1195
+ *
1196
+ * ```bash
1197
+ * bunx biome format {{file}}
1198
+ * ```
1199
+ *
1200
+ * ```bash
1201
+ * bun format {{file}}
1202
+ * ```
1203
+ *
1204
+ * ```bash
1205
+ * npx eslint --fix {{file}}
1206
+ * ```
1207
+ *
1208
+ * Intlayer will replace the {{file}} with the path of the file to format.
1209
+ *
1210
+ * Default: undefined
1211
+ */
1153
1212
  formatCommand: string | undefined;
1154
1213
  };
1155
1214
  type SystemConfig = {
1156
1215
  /**
1157
- * Absolute path of the project's base directory
1158
- *
1159
- * Default: process.cwd()
1160
- *
1161
- * The root directory of the project, typically used for resolving other paths.
1162
- */
1216
+ * Absolute path of the project's base directory
1217
+ *
1218
+ * Default: process.cwd()
1219
+ *
1220
+ * The root directory of the project, typically used for resolving other paths.
1221
+ */
1163
1222
  baseDir: string;
1164
1223
  /**
1165
- * Directory for module augmentation, relative to the base directory
1166
- *
1167
- * Default: .intlayer/types
1168
- *
1169
- * Defines the derived path for module augmentation.
1170
- */
1224
+ * Directory for module augmentation, relative to the base directory
1225
+ *
1226
+ * Default: .intlayer/types
1227
+ *
1228
+ * Defines the derived path for module augmentation.
1229
+ */
1171
1230
  moduleAugmentationDir: string;
1172
1231
  /**
1173
- * Directory where unmerged dictionaries are stored, relative to the result directory
1174
- *
1175
- * Default: .intlayer/unmerged_dictionary
1176
- *
1177
- * Specifies the derived path for unmerged dictionaries relative to the result directory.
1178
- */
1232
+ * Directory where unmerged dictionaries are stored, relative to the result directory
1233
+ *
1234
+ * Default: .intlayer/unmerged_dictionary
1235
+ *
1236
+ * Specifies the derived path for unmerged dictionaries relative to the result directory.
1237
+ */
1179
1238
  unmergedDictionariesDir: string;
1180
1239
  /**
1181
- * Directory where remote dictionaries are stored, relative to the result directory
1182
- *
1183
- * Default: .intlayer/remote_dictionary
1184
- *
1185
- * Specifies the derived path for remote dictionaries relative to the result directory.
1186
- */
1240
+ * Directory where remote dictionaries are stored, relative to the result directory
1241
+ *
1242
+ * Default: .intlayer/remote_dictionary
1243
+ *
1244
+ * Specifies the derived path for remote dictionaries relative to the result directory.
1245
+ */
1187
1246
  remoteDictionariesDir: string;
1188
1247
  /**
1189
- * Directory where final dictionaries are stored, relative to the result directory
1190
- *
1191
- * Default: .intlayer/dictionary
1192
- *
1193
- * Specifies the derived path for dictionaries relative to the result directory.
1194
- */
1248
+ * Directory where final dictionaries are stored, relative to the result directory
1249
+ *
1250
+ * Default: .intlayer/dictionary
1251
+ *
1252
+ * Specifies the derived path for dictionaries relative to the result directory.
1253
+ */
1195
1254
  dictionariesDir: string;
1196
1255
  /**
1197
- * Directory where dynamic dictionaries are stored, relative to the result directory
1198
- *
1199
- * Default: .intlayer/dynamic_dictionary
1200
- *
1201
- * Specifies the derived path for dynamic dictionaries relative to the result directory.
1202
- */
1256
+ * Directory where dynamic dictionaries are stored, relative to the result directory
1257
+ *
1258
+ * Default: .intlayer/dynamic_dictionary
1259
+ *
1260
+ * Specifies the derived path for dynamic dictionaries relative to the result directory.
1261
+ */
1203
1262
  dynamicDictionariesDir: string;
1204
1263
  /**
1205
- * Directory where fetch dictionaries are stored, relative to the result directory
1206
- *
1207
- * Default: .intlayer/fetch_dictionary
1208
- *
1209
- * Specifies the derived path for fetch dictionaries relative to the result directory.
1210
- */
1264
+ * Directory where fetch dictionaries are stored, relative to the result directory
1265
+ *
1266
+ * Default: .intlayer/fetch_dictionary
1267
+ *
1268
+ * Specifies the derived path for fetch dictionaries relative to the result directory.
1269
+ */
1211
1270
  fetchDictionariesDir: string;
1212
1271
  /**
1213
- * Directory where dictionary types are stored, relative to the result directory
1214
- *
1215
- * Default: .intlayer/types
1216
- *
1217
- * Specifies the derived path for dictionary types relative to the result directory.
1218
- */
1272
+ * Directory where dictionary types are stored, relative to the result directory
1273
+ *
1274
+ * Default: .intlayer/types
1275
+ *
1276
+ * Specifies the derived path for dictionary types relative to the result directory.
1277
+ */
1219
1278
  typesDir: string;
1220
1279
  /**
1221
- * Directory where the main files are stored, relative to the result directory
1222
- *
1223
- * Default: .intlayer/main
1224
- *
1225
- * Specifies the derived path for the main files relative to the result directory.
1226
- */
1280
+ * Directory where the main files are stored, relative to the result directory
1281
+ *
1282
+ * Default: .intlayer/main
1283
+ *
1284
+ * Specifies the derived path for the main files relative to the result directory.
1285
+ */
1227
1286
  mainDir: string;
1228
1287
  /**
1229
- * Directory where the configuration files are stored, relative to the result directory
1230
- *
1231
- * Default: .intlayer/config
1232
- *
1233
- * Specifies the derived path for the configuration files relative to the result directory.
1234
- */
1288
+ * Directory where the configuration files are stored, relative to the result directory
1289
+ *
1290
+ * Default: .intlayer/config
1291
+ *
1292
+ * Specifies the derived path for the configuration files relative to the result directory.
1293
+ */
1235
1294
  configDir: string;
1236
1295
  /**
1237
- * Directory where the cache files are stored, relative to the result directory
1238
- *
1239
- * Default: .intlayer/cache
1240
- *
1241
- * Specifies the derived path for the cache files relative to the result directory.
1242
- */
1296
+ * Directory where the cache files are stored, relative to the result directory
1297
+ *
1298
+ * Default: .intlayer/cache
1299
+ *
1300
+ * Specifies the derived path for the cache files relative to the result directory.
1301
+ */
1243
1302
  cacheDir: string;
1244
1303
  /**
1245
- * Directory where the temp files are stored, relative to the result directory
1246
- *
1247
- * Default: .intlayer/tmp
1248
- *
1249
- * Specifies the derived path for the tmp files relative to the result directory.
1250
- */
1304
+ * Directory where the temp files are stored, relative to the result directory
1305
+ *
1306
+ * Default: .intlayer/tmp
1307
+ *
1308
+ * Specifies the derived path for the tmp files relative to the result directory.
1309
+ */
1251
1310
  tempDir: string;
1252
1311
  };
1253
1312
  type LogFunctions = {
@@ -1258,26 +1317,26 @@ type LogFunctions = {
1258
1317
  };
1259
1318
  type LogConfig = {
1260
1319
  /**
1261
- * Indicates if the logger is enabled
1262
- *
1263
- * Default: true
1264
- *
1265
- * If 'default', the logger is enabled and can be used.
1266
- * If 'verbose', the logger will be enabled and can be used, but will log more information.
1267
- * If 'disabled', the logger is disabled and cannot be used.
1268
- */
1320
+ * Indicates if the logger is enabled
1321
+ *
1322
+ * Default: true
1323
+ *
1324
+ * If 'default', the logger is enabled and can be used.
1325
+ * If 'verbose', the logger will be enabled and can be used, but will log more information.
1326
+ * If 'disabled', the logger is disabled and cannot be used.
1327
+ */
1269
1328
  mode: "default" | "verbose" | "disabled";
1270
1329
  /**
1271
- * Prefix of the logger
1272
- *
1273
- * Default: '[intlayer]'
1274
- *
1275
- * The prefix of the logger.
1276
- */
1330
+ * Prefix of the logger
1331
+ *
1332
+ * Default: '[intlayer]'
1333
+ *
1334
+ * The prefix of the logger.
1335
+ */
1277
1336
  prefix: string;
1278
1337
  /**
1279
- * Functions to log
1280
- */
1338
+ * Functions to log
1339
+ */
1281
1340
  error?: typeof console.error;
1282
1341
  log?: typeof console.log;
1283
1342
  info?: typeof console.info;
@@ -1285,5 +1344,5 @@ type LogConfig = {
1285
1344
  debug?: typeof console.debug;
1286
1345
  };
1287
1346
  //#endregion
1288
- export { AiConfig, AiProviderConfigMap, AiProviders, BuildConfig, CommonAiConfig, CompilerConfig, ConfigSchema, ContentConfig, CookiesAttributes, CustomIntlayerConfig, CustomRoutingConfig, DictionaryConfig, EditorConfig, InternationalizationConfig, IntlayerConfig, LogConfig, LogFunctions, ProcessedCookieAttributes, ProcessedStorageAttributes, RewriteObject, RewriteRule, RewriteRules, RoutingConfig, RoutingStorageInput, StorageAttributes, StrictMode, SystemConfig, URLType };
1347
+ export { AiConfig, AiProviderConfigMap, AiProviders, AnalyticsConfig, BuildConfig, CommonAiConfig, CompilerConfig, ConfigSchema, ContentConfig, CookiesAttributes, CustomIntlayerConfig, CustomRoutingConfig, DictionaryConfig, EditorConfig, InternationalizationConfig, IntlayerConfig, LogConfig, LogFunctions, ProcessedCookieAttributes, ProcessedStorageAttributes, RewriteObject, RewriteRule, RewriteRules, RoutingConfig, RoutingStorageInput, StorageAttributes, StrictMode, SystemConfig, URLType };
1289
1348
  //# sourceMappingURL=config.d.ts.map