@intlayer/types 9.0.0-canary.9 → 9.0.1

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,232 +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
- * Enables the Intlayer locale-routing proxy (middleware).
268
- *
269
- * When enabled, the build-tool integration (e.g. the `intlayer()` Vite plugin)
270
- * automatically wires the locale-detection / redirect / rewrite middleware in
271
- * development, preview, and production SSR. Disable it when you want to handle
272
- * locale routing yourself, or when your routing mode does not require a proxy.
273
- *
274
- * Default: true
275
- */
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
+ */
276
275
  enableProxy: boolean;
277
276
  /**
278
- * Pre-computed storage attributes derived from the raw `storage` input.
279
- * Populated at config-build time by `getStorageAttributes(rawStorage)`.
280
- * Use this at runtime instead of re-processing the raw storage config.
281
- */
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
+ */
282
281
  storage: ProcessedStorageAttributes;
283
282
  /**
284
- * Base path for application URLs
285
- *
286
- * Default: ''
287
- *
288
- * Defines the base path where the application is accessible from.
289
- */
283
+ * Base path for application URLs
284
+ *
285
+ * Default: ''
286
+ *
287
+ * Defines the base path where the application is accessible from.
288
+ */
290
289
  basePath?: string;
291
290
  /**
292
- * Maps locales to specific domain hostnames for domain-based routing.
293
- * When a locale is mapped to a domain, URLs generated for that locale
294
- * will use that domain as the base URL (absolute URL), and no locale
295
- * prefix will be added to the path (the domain itself implies the locale).
296
- *
297
- * Default: undefined
298
- *
299
- * Example:
300
- * ```ts
301
- * domains: {
302
- * en: 'intlayer.org',
303
- * zh: 'intlayer.cn',
304
- * }
305
- * ```
306
- */
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
+ */
307
306
  domains?: Partial<Record<LocalesValues, string>>;
308
307
  };
309
308
  /**
310
- * Raw storage input accepted in the user-facing config (`intlayer.config.ts`).
311
- * Converted to {@link ProcessedStorageAttributes} during config build.
312
- *
313
- * Configuration for storing the locale in the client (localStorage or sessionStorage)
314
- *
315
- * If false, the locale will not be stored by the middleware.
316
- * If true, the locale storage will consider all default values.
317
- *
318
- * Default: ['cookie', 'header]
319
- *
320
- * Note: Check out GDPR compliance for cookies. See https://gdpr.eu/cookies/
321
- * Note: useLocale hook includes a prop to disable the cookie storage.
322
- * 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`).
323
- *
324
- * Recommendation:
325
- * - Config both localStorage and cookies for the storage of the locale if you want to support GDPR compliance.
326
- * - Disable the cookie storage by default on the useLocale hook by waiting for the user to consent to the cookie storage.
327
- */
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
+ */
328
327
  type RoutingStorageInput = false | "cookie" | "localStorage" | "sessionStorage" | "header" | CookiesAttributes | StorageAttributes | ("cookie" | "localStorage" | "sessionStorage" | "header" | CookiesAttributes | StorageAttributes)[];
329
328
  /**
330
- * User-facing routing configuration (accepted in `intlayer.config.ts`).
331
- */
329
+ * User-facing routing configuration (accepted in `intlayer.config.ts`).
330
+ */
332
331
  type CustomRoutingConfig = Omit<RoutingConfig, "storage"> & {
333
332
  storage?: RoutingStorageInput;
334
333
  };
335
334
  /**
336
- * Configuration for intlayer editor
337
- */
335
+ * Configuration for intlayer editor
336
+ */
338
337
  type EditorConfig = {
339
338
  /**
340
- * URL of the application. Used to restrict the origin of the editor for security reasons.
341
- *
342
- * Default: ''
343
- */
339
+ * URL of the application. Used to restrict the origin of the editor for security reasons.
340
+ *
341
+ * Default: ''
342
+ */
344
343
  applicationURL?: URLType;
345
344
  /**
346
- * Public URL for the editor.
347
- * Default: "http://localhost:8000"
348
- */
345
+ * Public URL for the editor.
346
+ * Default: "http://localhost:8000"
347
+ */
349
348
  editorURL?: URLType;
350
349
  /**
351
- * Intlayer CMS URL.
352
- * Default: "https://app.intlayer.org"
353
- */
350
+ * Intlayer CMS URL.
351
+ * Default: "https://app.intlayer.org"
352
+ */
354
353
  cmsURL?: URLType;
355
354
  /**
356
- * Backend API URL.
357
- * Default: "https://back.intlayer.org"
358
- */
355
+ * Backend API URL.
356
+ * Default: "https://back.intlayer.org"
357
+ */
359
358
  backendURL?: URLType;
360
359
  /**
361
- * Indicates if the application interact with the visual editor
362
- *
363
- * Default: false;
364
- *
365
- * If true, the editor will be able to interact with the application.
366
- * If false, the editor will not be able to interact with the application.
367
- * In any case, the editor can only be enabled by the visual editor.
368
- * Disabling the editor for specific environments is a way to enforce the security.
369
- *
370
- * Usage:
371
- * ```js
372
- * {
373
- * // Other configurations
374
- * editor: {
375
- * enabled: process.env.NODE_ENV !== 'production',
376
- * }
377
- * };
378
- * ```
379
- *
380
- */
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
+ */
381
380
  enabled: boolean;
382
381
  /** Port of the editor server
383
- *
384
- * Default: 8000
385
- */
382
+ *
383
+ * Default: 8000
384
+ */
386
385
  port: number;
387
386
  /**
388
- * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.
389
- * An access token is use to authenticate the user related to the project.
390
- * To get an access token, go to https://app.intlayer.org/project and create an account.
391
- *
392
- * Default: undefined
393
- *
394
- * > 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.
395
- */
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
+ */
396
395
  clientId?: string;
397
396
  /**
398
- * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.
399
- * An access token is use to authenticate the user related to the project.
400
- * To get an access token, go to https://app.intlayer.org/project and create an account.
401
- *
402
- * Default: undefined
403
- *
404
- * > 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.
405
- */
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
+ */
406
405
  clientSecret?: string;
407
406
  /**
408
- * Strategy for prioritizing dictionaries. If a dictionary is both present online and locally, the content will be merge.
409
- * However, is a field is defined in both dictionary, this setting determines which fields takes the priority over the other.
410
- *
411
- * Default: 'local_first'
412
- *
413
- * The strategy for prioritizing dictionaries. It can be either 'local_first' or 'distant_first'.
414
- * - 'local_first': The first dictionary found in the locale is used.
415
- * - 'distant_first': The first dictionary found in the distant locales is used.
416
- */
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
+ */
417
416
  dictionaryPriorityStrategy: "local_first" | "distant_first";
418
417
  /**
419
- * Indicates if the application should hot reload the locale configurations when a change is detected.
420
- * For example, when a new dictionary is added or updated, the application will update the content tu display in the page.
421
- *
422
- * Default: true
423
- */
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
+ */
424
423
  liveSync: boolean;
425
424
  /**
426
- * Port of the live sync server
427
- *
428
- * Default: 4000
429
- */
425
+ * Port of the live sync server
426
+ *
427
+ * Default: 4000
428
+ */
430
429
  liveSyncPort: number;
431
430
  /**
432
- * URL of the live sync server in case of remote live sync server
433
- *
434
- * Default: `http://localhost:${liveSyncPort}`
435
- */
431
+ * URL of the live sync server in case of remote live sync server
432
+ *
433
+ * Default: `http://localhost:${liveSyncPort}`
434
+ */
436
435
  liveSyncURL: URLType;
437
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
+ };
438
478
  declare enum AiProviders {
439
479
  OPENAI = "openai",
440
480
  ANTHROPIC = "anthropic",
@@ -455,810 +495,818 @@ declare enum AiProviders {
455
495
  }
456
496
  type CommonAiConfig = {
457
497
  /**
458
- * API model
459
- *
460
- * The model to use for the AI features of Intlayer.
461
- *
462
- * Example: 'gpt-4o-2024-11-20'
463
- *
464
- */
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
+ */
465
505
  model?: string;
466
506
  /**
467
- * temperature
468
- *
469
- * The temperature to use for the AI features of Intlayer.
470
- * The temperature controls the randomness of the AI's responses.
471
- * A higher temperature will make the AI more creative and less predictable.
472
- *
473
- * Example: 0.1
474
- */
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
+ */
475
515
  temperature?: number;
476
516
  /**
477
- * API key
478
- *
479
- * Use your own OpenAI API key to use the AI features of Intlayer.
480
- * If you don't have an OpenAI API key, you can get one for free at https://openai.com/api/.
481
- *
482
- */
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
+ */
483
523
  apiKey?: string;
484
524
  /**
485
- * Application context
486
- *
487
- * The context of the application to use for the AI features of Intlayer.
488
- *
489
- * Example: 'This is a website for a company that sells products online.'
490
- */
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
+ */
491
531
  applicationContext?: string;
492
532
  /**
493
- * Base URL
494
- *
495
- * The base URL to use for the AI features of Intlayer.
496
- *
497
- * Example: 'https://api.openai.com/v1'
498
- */
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
+ */
499
539
  baseURL?: string;
500
540
  /**
501
- * Data serialization
502
- *
503
- * The data serialization format to use for the AI features of Intlayer.
504
- *
505
- * Default: 'json'
506
- */
541
+ * Data serialization
542
+ *
543
+ * The data serialization format to use for the AI features of Intlayer.
544
+ *
545
+ * Default: 'json'
546
+ */
507
547
  dataSerialization?: "json" | "toon";
508
548
  };
509
549
  type AiProviderConfigMap = {};
510
550
  type AiConfigUnion = { [P in keyof AiProviderConfigMap]: {
511
551
  provider: P | `${P}`;
512
- } & AiProviderConfigMap[P] }[keyof AiProviderConfigMap];
552
+ } & AiProviderConfigMap[P]; }[keyof AiProviderConfigMap];
513
553
  type AiConfig = CommonAiConfig & (AiConfigUnion | {
514
554
  provider?: AiProviders | `${AiProviders}`;
515
555
  });
516
556
  type BuildConfig = {
517
557
  /**
518
- * Indicates the mode of the build
519
- *
520
- * Default: 'auto'
521
- *
522
- * If 'auto', the build will be enabled automatically when the application is built.
523
- * If 'manual', the build will be set only when the build command is executed.
524
- *
525
- * Can be used to disable dictionaries build, for instance when execution on Node.js environment should be avoided.
526
- */
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
+ */
527
567
  mode: "auto" | "manual";
528
568
  /**
529
- * Indicates if the build should be optimized
530
- *
531
- * Default: undefined
532
- *
533
- * If true, the build will be optimized.
534
- * If false, the build will not be optimized.
535
- *
536
- * Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used.
537
- * All imports will stay as static import to avoid async processing when loading the dictionaries.
538
- *
539
- * Note:
540
- * - Intlayer will replace all call of `useIntlayer` with the defined mode by the `importMode` option.
541
- * - Intlayer will replace all call of `getIntlayer` with `getDictionary`.
542
- * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.
543
- * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
544
- */
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
+ */
545
585
  optimize?: boolean;
546
586
  /**
547
- * Indicates the mode of import to use for the dictionaries.
548
- *
549
- * Available modes:
550
- * - "static": The dictionaries are imported statically.
551
- * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.
552
- * - "dynamic": The dictionaries are imported dynamically in a synchronous component using the suspense API.
553
- * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
554
- * - "fetch": The dictionaries are imported dynamically using the live sync API.
555
- * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
556
- * 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.
557
- *
558
- * Default: "static"
559
- *
560
- * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.
561
- *
562
- * Note:
563
- * - Dynamic imports rely on Suspense and may slightly impact rendering performance.
564
- * - If desabled all locales will be loaded at once, even if they are not used.
565
- * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.
566
- * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
567
- * - This option will be ignored if `optimize` is disabled.
568
- * - 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.
569
- * - The "fetch" allows to sync the dictionaries to the live sync server.
570
- * - Require static key to work. Example of invalid code: `const navbarKey = "my-key"; useIntlayer(navbarKey)`.
571
- *
572
- * @deprecated Use `dictionary.importMode` instead.
573
- */
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
+ */
574
614
  importMode?: "static" | "dynamic" | "fetch";
575
615
  /**
576
- * Minify the dictionaries to reduce the bundle size.
577
- *
578
- * Default: false
579
- *
580
- * Note:
581
- * - This option will be ignored if `optimize` is disabled.
582
- * - This option will be ignore if `editor.enabled` is true.
583
- * - If there is edge cases where the minification is not working properly, the dictionary will be not minified.
584
- */
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
+ */
585
625
  minify: boolean;
586
626
  /**
587
- * Purge the unused keys in a dictionaries
588
- *
589
- * Default: false
590
- *
591
- * Note:
592
- * - This option will be ignored if `optimize` is disabled.
593
- */
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
+ */
594
634
  purge: boolean;
595
635
  /**
596
- * Pattern to traverse the code to optimize.
597
- *
598
- * Allows to avoid to traverse the code that is not relevant to the optimization.
599
- * Improve build performance.
600
- *
601
- * Default: ['**\/*.{js,ts,mjs,cjs,jsx,tsx}', '!**\/node_modules/**']
602
- *
603
- * Example: `['src/**\/*.{ts,tsx}', '../ui-library/**\/*.{ts,tsx}', '!**\/node_modules/**']`
604
- *
605
- * Note:
606
- * - This option will be ignored if `optimize` is disabled.
607
- * - Use glob pattern.
608
- */
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
+ */
609
649
  traversePattern: string[];
610
650
  /**
611
- * Output format of the dictionaries
612
- *
613
- * Default: ['cjs', 'esm']
614
- *
615
- * 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.
616
- * This function will use the output format defined using this option.
617
- * 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.
618
- */
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
+ */
619
659
  outputFormat: ("cjs" | "esm")[];
620
660
  /**
621
- * Indicates if the cache should be enabled
622
- *
623
- * Default: true
624
- *
625
- * If true, the cache will be enabled.
626
- * If false, the cache will not be enabled.
627
- */
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
+ */
628
668
  cache: boolean;
629
669
  /**
630
- * Require function
631
- *
632
- * In some environments, as VSCode extension, the require function should be set relatively to the project root to work properly.
633
- *
634
- * Default: undefined
635
- *
636
- * If undefined, the require function will be set to the default require function.
637
- * If defined, the require function will be set to the defined require function.
638
- *
639
- * Example:
640
- * ```js
641
- * {
642
- * require: require
643
- * }
644
- * ```
645
- */
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
+ */
646
686
  require?: NodeJS.Require;
647
687
  /**
648
- * Indicates if the build should check TypeScript types
649
- *
650
- * Default: false
651
- *
652
- * If true, the build will check TypeScript types and log errors.
653
- * Note: This can slow down the build.
654
- */
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
+ */
655
695
  checkTypes: boolean;
656
696
  };
657
697
  type CompilerConfig = {
658
698
  /**
659
- * Indicates if the compiler should be enabled.
660
- * If 'build-only', the compiler will be skipped during development mode to speed up start times.
661
- */
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
+ */
662
702
  enabled: boolean | "build-only";
663
703
  /**
664
- * Prefix for the extracted dictionary keys.
665
- * Default: ''
666
- */
704
+ * Prefix for the extracted dictionary keys.
705
+ * Default: ''
706
+ */
667
707
  dictionaryKeyPrefix?: string;
668
708
  /**
669
- * Pattern to traverse the code to optimize.
670
- *
671
- * Allows to avoid to traverse the code that is not relevant to the optimization.
672
- * Improve build performance.
673
- *
674
- * Default: ['**\/*.{ts,tsx,jsx,js,cjs,mjs,svelte,vue}', '!**\/node_modules/**']
675
- *
676
- * Example: `['src/**\/*.{ts,tsx}', '../ui-library/**\/*.{ts,tsx}', '!**\/node_modules/**']`
677
- *
678
- * Note:
679
- * - This option will be ignored if `optimize` is disabled.
680
- * - Use glob pattern.
681
- *
682
- * @deprecated use build.traversePattern instead
683
- */
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
+ */
684
724
  transformPattern?: string | string[];
685
725
  /**
686
- * Pattern to exclude from the optimization.
687
- *
688
- * Allows to exclude files from the optimization.
689
- *
690
- * Default: ['**\/node_modules/**']
691
- *
692
- * Example: `['**\/node_modules/**', '!**\/node_modules/react/**']`
693
- *
694
- * @deprecated use build.traversePattern instead
695
- */
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
+ */
696
736
  excludePattern?: string | string[];
697
737
  /**
698
- * Defines the output files path. Replaces `outputDir`.
699
- *
700
- * - `./` paths are resolved relative to the component directory.
701
- * - `/` paths are resolved relative to the project root (`baseDir`).
702
- *
703
- * - Including the `{{locale}}` variable in the path will trigger the generation of separate dictionaries per locale.
704
- *
705
- * Example:
706
- * ```ts
707
- * {
708
- * // Create Multilingual .content.ts files close to the component
709
- * output: ({ fileName, extension }) => `./${fileName}${extension}`,
710
- *
711
- * // output: './{{fileName}}{{extension}}', // Equivalent using template string
712
- * }
713
- * ```
714
- *
715
- * ```ts
716
- * {
717
- * // Create centralize per-locale JSON at the root of the project
718
- * output: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
719
- *
720
- * // output: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string
721
- * }
722
- * ```
723
- *
724
- * ```ts
725
- * {
726
- * // Create per-locale JSON files with locale-specific output paths
727
- * output: {
728
- * en: ({ fileName, locale }) => `${fileName}.${locale}.content.json`,
729
- * fr: '{{fileName}}.{{locale}}.content.json',
730
- * es: false, // skip this locale
731
- * },
732
- * }
733
- * ```
734
- *
735
- * Variable list:
736
- * - `fileName`: The name of the file.
737
- * - `key`: The key of the content.
738
- * - `locale`: The locale of the content.
739
- * - `extension`: The extension of the file.
740
- * - `componentFileName`: The name of the component file.
741
- * - `componentExtension`: The extension of the component file.
742
- * - `format`: The format of the dictionary.
743
- * - `componentFormat`: The format of the component dictionary.
744
- * - `componentDirPath`: The directory path of the component.
745
- */
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
+ */
746
786
  output?: Fill;
747
787
  /**
748
- * Indicates if the metadata should be saved in the file.
749
- *
750
- * If true, the compiler will not save the metadata of the dictionaries.
751
- *
752
- * If true:
753
- *
754
- * ```json
755
- * {
756
- * "key": "value"
757
- * }
758
- * ```
759
- *
760
- * If false:
761
- *
762
- * ```json
763
- * {
764
- * "key": "value",
765
- * "content": {
766
- * "key": "value"
767
- * }
768
- * }
769
- * ```
770
- *
771
- * Default: false
772
- *
773
- * Note: Useful if used with loadJSON plugin
774
- *
775
- */
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
+ */
776
816
  noMetadata?: boolean;
777
817
  /**
778
- * Indicates if the components should be saved after being transformed.
779
- *
780
- * If true, the compiler will replace the original files with the transformed files.
781
- * That way, the compiler can be run only once to transform the app, and then it can be removed.
782
- *
783
- * Default: false
784
- */
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
+ */
785
825
  saveComponents: boolean;
786
826
  };
787
827
  /**
788
- * Custom configuration that can be provided to override default settings
789
- */
828
+ * Custom configuration that can be provided to override default settings
829
+ */
790
830
  type CustomIntlayerConfig = {
791
831
  /**
792
- * Custom internationalization configuration
793
- */
832
+ * Custom internationalization configuration
833
+ */
794
834
  internationalization?: Partial<InternationalizationConfig>;
795
835
  /**
796
- * Custom dictionary configuration
797
- */
836
+ * Custom dictionary configuration
837
+ */
798
838
  dictionary?: Partial<DictionaryConfig>;
799
839
  /**
800
- * Custom routing configuration
801
- */
840
+ * Custom routing configuration
841
+ */
802
842
  routing?: Partial<CustomRoutingConfig>;
803
843
  /**
804
- * Custom content configuration
805
- */
844
+ * Custom content configuration
845
+ */
806
846
  content?: Partial<ContentConfig>;
807
847
  /**
808
- * Custom editor configuration
809
- */
848
+ * Custom editor configuration
849
+ */
810
850
  editor?: Partial<EditorConfig>;
811
851
  /**
812
- * Custom log configuration
813
- */
852
+ * Custom analytics configuration
853
+ */
854
+ analytics?: Partial<AnalyticsConfig>;
855
+ /**
856
+ * Custom log configuration
857
+ */
814
858
  log?: Partial<LogConfig>;
815
859
  /**
816
- * Custom AI configuration
817
- */
860
+ * Custom AI configuration
861
+ */
818
862
  ai?: Partial<AiConfig>;
819
863
  /**
820
- * Custom build configuration
821
- */
864
+ * Custom build configuration
865
+ */
822
866
  build?: Partial<BuildConfig>;
823
867
  /**
824
- * Custom compiler configuration
825
- */
868
+ * Custom compiler configuration
869
+ */
826
870
  compiler?: Partial<CompilerConfig>;
827
871
  /**
828
- * Custom system configuration
829
- */
872
+ * Custom system configuration
873
+ */
830
874
  system?: Partial<SystemConfig>;
831
875
  /**
832
- * Custom schemas to validate the dictionaries content.
833
- *
834
- * Example:
835
- * ```ts
836
- * {
837
- * schemas: {
838
- * 'my-schema': z.object({
839
- * title: z.string(),
840
- * description: z.string(),
841
- * }),
842
- * }
843
- * }
844
- * ```
845
- */
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
+ */
846
890
  schemas?: Record<string, ConfigSchema>;
847
891
  /**
848
- * Custom plugins configuration
849
- */
892
+ * Custom plugins configuration
893
+ */
850
894
  plugins?: (Plugin | Promise<Plugin>)[];
851
895
  };
852
896
  type DictionaryConfig = {
853
897
  /**
854
- * Indicate how the dictionary should be filled using AI.
855
- *
856
- * Default: `true`
857
- *
858
- * - If `true`, will consider the `compiler.output` field.
859
- * - If `false`, will skip the fill process.
860
- *
861
- * - `./` paths are resolved relative to the component directory.
862
- * - `/` paths are resolved relative to the project root (`baseDir`).
863
- *
864
- * - If includes `{{locale}}` variable in the path, will trigger the generation of separate dictionaries per locale.
865
- *
866
- * Example:
867
- * ```ts
868
- * {
869
- * // Create Multilingual .content.ts files close to the component
870
- * fill: ({ fileName, extension }) => `./${fileName}${extension}`,
871
- *
872
- * // fill: './{{fileName}}{{extension}}', // Equivalent using template string
873
- * }
874
- * ```
875
- *
876
- * ```ts
877
- * {
878
- * // Create centralize per-locale JSON at the root of the project
879
- * fill: ({ key, locale }) => `/locales/${locale}/${key}.content.json`,
880
- *
881
- * // fill: '/locales/{{locale}}/{{key}}.content.json', // Equivalent using template string
882
- * }
883
- * ```
884
- *
885
- * ```ts
886
- * {
887
- * // Create custom output based on the locale
888
- * fill: {
889
- * en: ({ key }) => `/locales/en/${key}.content.json`,
890
- * fr: '/locales/fr/{{key}}.content.json',
891
- * es: false,
892
- * de: true,
893
- * },
894
- * }
895
- * ```
896
- *
897
- *
898
- * Variable list:
899
- * - `fileName`: The name of the file.
900
- * - `key`: The key of the content.
901
- * - `locale`: The locale of the content.
902
- * - `extension`: The extension of the file.
903
- * - `componentFileName`: The name of the component file.
904
- * - `componentExtension`: The extension of the component file.
905
- * - `format`: The format of the dictionary.
906
- * - `componentFormat`: The format of the component dictionary.
907
- * - `componentDirPath`: The directory path of the component.
908
- */
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
+ */
909
953
  fill?: Fill;
910
954
  /**
911
- * The description of the dictionary. Helps to understand the purpose of the dictionary in the editor, and the CMS.
912
- * The description is also used as context for translations generation.
913
- *
914
- * Example:
915
- * ```ts
916
- * {
917
- * "key": "about-page-meta",
918
- * "description":[
919
- * "This dictionary is manage the metadata of the About Page",
920
- * "Consider good practices for SEO:",
921
- * "- The title should be between 50 and 60 characters",
922
- * "- The description should be between 150 and 160 characters",
923
- * ].join('\n'),
924
- * "content": { ... }
925
- * }
926
- * ```
927
- */
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
+ */
928
972
  description?: string;
929
973
  /**
930
- * Transform the dictionary in a per-locale dictionary.
931
- * Each field declared in a per-locale dictionary will be transformed in a translation node.
932
- * If missing, the dictionary will be treated as a multilingual dictionary.
933
- * If declared, do not use translation nodes in the content.
934
- *
935
- * Example:
936
- * ```json
937
- * {
938
- * "key": "about-page",
939
- * "locale": "en",
940
- * "content": {
941
- * "multilingualContent": "English content"
942
- * }
943
- * }
944
- * ```
945
- */
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
+ */
946
990
  locale?: LocalesValues;
947
991
  /**
948
- * Indicators if the content of the dictionary should be automatically transformed.
949
- * If true, the content will be transformed to the corresponding node type.
950
- * - Markdown: `### Title` -> `md('### Title')`
951
- * - HTML: `<div>Title</div>` -> `html('<div>Title</div>')`
952
- * - Insertion: `Hello {{name}}` -> `insert('Hello {{name}}')`
953
- *
954
- * If an object is provided, you can specify which transformations should be enabled.
955
- *
956
- * Default: false
957
- */
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
+ */
958
1002
  contentAutoTransformation?: ContentAutoTransformation;
959
1003
  /**
960
- * Indicates the priority of the dictionary.
961
- * In the case of conflicts, the dictionary with the highest priority will override the other dictionaries.
962
- */
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
+ */
963
1007
  priority?: number;
964
1008
  /**
965
- * Indicates the mode of import to use for the dictionaries.
966
- *
967
- * Available modes:
968
- * - "static": The dictionaries are imported statically.
969
- * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.
970
- * - "dynamic": The dictionaries are imported dynamically in a synchronous component using the suspense API.
971
- * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
972
- * - "fetch": The dictionaries are imported dynamically using the live sync API.
973
- * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
974
- * 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.
975
- *
976
- * Default: "static"
977
- *
978
- * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.
979
- *
980
- * Note:
981
- * - Dynamic imports rely on Suspense and may slightly impact rendering performance.
982
- * - If disabled all locales will be loaded at once, even if they are not used.
983
- * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.
984
- * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
985
- * - This option will be ignored if `optimize` is disabled.
986
- * - 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.
987
- * - The "fetch" allows to sync the dictionaries to the live sync server.
988
- * - Require static key to work. Example of invalid code: `const navbarKey = "my-key"; useIntlayer(navbarKey)`.
989
- */
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
+ */
990
1034
  importMode?: "static" | "dynamic" | "fetch";
991
1035
  /**
992
- * The title of the dictionary. Helps to identify the dictionary in the editor, and the CMS.
993
- *
994
- * Example:
995
- * ```json
996
- * {
997
- * "key": "about-page-meta",
998
- * "title": "About Page",
999
- * "content": { ... }
1000
- * }
1001
- * ```
1002
- */
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
+ */
1003
1047
  title?: string;
1004
1048
  /**
1005
- * Helps to categorize the dictionaries. The tags can provide more context and instructions for the dictionary.
1006
- *
1007
- * Example:
1008
- * ```json
1009
- * {
1010
- * "key": "about-page-meta",
1011
- * "tags": ["metadata","about-page"]
1012
- * }
1013
- * ```
1014
- */
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
+ */
1015
1059
  tags?: string[];
1016
1060
  /**
1017
- * Indicates the location of the dictionary and controls how it synchronizes with the CMS.
1018
- *
1019
- * - '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.
1020
- * - '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.
1021
- * - 'local': The dictionary is managed locally. It will not be pushed to the remote CMS.
1022
- * - '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.
1023
- */
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
+ */
1024
1068
  location?: DictionaryLocation;
1025
1069
  /**
1026
- * The default message format for all dictionaries in the project.
1027
- *
1028
- * Controls how dictionary content strings are interpreted at runtime.
1029
- *
1030
- * - 'intlayer': Native intlayer format (default).
1031
- * - 'icu': ICU message format (used by next-intl, react-intl, etc.).
1032
- * - 'i18next': i18next interpolation format (used by i18next, react-i18next, next-i18next).
1033
- * - 'vue-i18n': Vue I18n format (used by vue-i18n).
1034
- * - 'po': GNU Gettext PO format.
1035
- *
1036
- * Default: 'intlayer'
1037
- */
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
+ */
1038
1082
  format?: DictionaryFormat;
1039
1083
  };
1040
1084
  /**
1041
- * Combined configuration for internationalization, middleware, and content
1042
- */
1085
+ * Combined configuration for internationalization, middleware, and content
1086
+ */
1043
1087
  type IntlayerConfig = {
1044
1088
  /**
1045
- * Internationalization configuration
1046
- */
1089
+ * Internationalization configuration
1090
+ */
1047
1091
  internationalization: InternationalizationConfig;
1048
1092
  /**
1049
- * Default dictionary configuration
1050
- */
1093
+ * Default dictionary configuration
1094
+ */
1051
1095
  dictionary?: Partial<DictionaryConfig>;
1052
1096
  /**
1053
- * Routing configuration
1054
- */
1097
+ * Routing configuration
1098
+ */
1055
1099
  routing: RoutingConfig;
1056
1100
  /**
1057
- * Content configuration
1058
- */
1101
+ * Content configuration
1102
+ */
1059
1103
  content: ContentConfig;
1060
1104
  /**
1061
- * System configuration
1062
- */
1105
+ * System configuration
1106
+ */
1063
1107
  system: SystemConfig;
1064
1108
  /**
1065
- * Intlayer editor configuration
1066
- */
1109
+ * Intlayer editor configuration
1110
+ */
1067
1111
  editor: EditorConfig;
1068
1112
  /**
1069
- * Logger configuration
1070
- */
1113
+ * Intlayer analytics configuration
1114
+ */
1115
+ analytics?: AnalyticsConfig;
1116
+ /**
1117
+ * Logger configuration
1118
+ */
1071
1119
  log: LogConfig;
1072
1120
  /**
1073
- * AI configuration
1074
- */
1121
+ * AI configuration
1122
+ */
1075
1123
  ai?: Partial<AiConfig>;
1076
1124
  /**
1077
- * Build configuration
1078
- */
1125
+ * Build configuration
1126
+ */
1079
1127
  build: BuildConfig;
1080
1128
  /**
1081
- * Compiler configuration
1082
- */
1129
+ * Compiler configuration
1130
+ */
1083
1131
  compiler: CompilerConfig;
1084
1132
  /**
1085
- * Custom schemas to validate the dictionaries content.
1086
- */
1133
+ * Custom schemas to validate the dictionaries content.
1134
+ */
1087
1135
  schemas?: Record<string, ConfigSchema>;
1088
1136
  /**
1089
- * Plugins configuration
1090
- */
1137
+ * Plugins configuration
1138
+ */
1091
1139
  plugins?: Plugin[];
1092
1140
  };
1093
1141
  /**
1094
- * Configuration for content handling
1095
- */
1142
+ * Configuration for content handling
1143
+ */
1096
1144
  type ContentConfig = {
1097
1145
  /**
1098
- * File extensions of content to look for
1099
- *
1100
- * Default: ['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']
1101
- *
1102
- * List of file extensions to scan for content.
1103
- */
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
+ */
1104
1152
  fileExtensions: string[];
1105
1153
  /**
1106
- * Directory where the content is stored, relative to the base directory
1107
- *
1108
- * Default: ['.']
1109
- *
1110
- * Derived content directory based on the base configuration.
1111
- *
1112
- * Note: This is used to watch for content files.
1113
- */
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
+ */
1114
1162
  contentDir: string[];
1115
1163
  /**
1116
- * Directory where the code is stored, relative to the base directory
1117
- *
1118
- * Default: ['.']
1119
- *
1120
- * Derived code directory based on the base configuration.
1121
- *
1122
- * Note: This is used to watch for code files to transform.
1123
- */
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
+ */
1124
1172
  codeDir: string[];
1125
1173
  /**
1126
- * Directories to be excluded from content processing
1127
- *
1128
- * Default: ['node_modules', '.intlayer']
1129
- *
1130
- * A list of directories to exclude from content processing.
1131
- */
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
+ */
1132
1180
  excludedPath: string[];
1133
1181
  /**
1134
- * Indicates if Intlayer should watch for changes in the content declaration files in the app to rebuild the related dictionaries.
1135
- *
1136
- * Default: process.env.NODE_ENV === 'development'
1137
- */
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
+ */
1138
1186
  watch: boolean;
1139
1187
  /**
1140
- * Command to format the content. When intlayer write your .content files locally, this command will be used to format the content.
1141
- *
1142
- * Example:
1143
- *
1144
- * ```bash
1145
- * npx prettier --write {{file}}
1146
- * ```
1147
- *
1148
- * ```bash
1149
- * bunx biome format {{file}}
1150
- * ```
1151
- *
1152
- * ```bash
1153
- * bun format {{file}}
1154
- * ```
1155
- *
1156
- * ```bash
1157
- * npx eslint --fix {{file}}
1158
- * ```
1159
- *
1160
- * Intlayer will replace the {{file}} with the path of the file to format.
1161
- *
1162
- * Default: undefined
1163
- */
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
+ */
1164
1212
  formatCommand: string | undefined;
1165
1213
  };
1166
1214
  type SystemConfig = {
1167
1215
  /**
1168
- * Absolute path of the project's base directory
1169
- *
1170
- * Default: process.cwd()
1171
- *
1172
- * The root directory of the project, typically used for resolving other paths.
1173
- */
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
+ */
1174
1222
  baseDir: string;
1175
1223
  /**
1176
- * Directory for module augmentation, relative to the base directory
1177
- *
1178
- * Default: .intlayer/types
1179
- *
1180
- * Defines the derived path for module augmentation.
1181
- */
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
+ */
1182
1230
  moduleAugmentationDir: string;
1183
1231
  /**
1184
- * Directory where unmerged dictionaries are stored, relative to the result directory
1185
- *
1186
- * Default: .intlayer/unmerged_dictionary
1187
- *
1188
- * Specifies the derived path for unmerged dictionaries relative to the result directory.
1189
- */
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
+ */
1190
1238
  unmergedDictionariesDir: string;
1191
1239
  /**
1192
- * Directory where remote dictionaries are stored, relative to the result directory
1193
- *
1194
- * Default: .intlayer/remote_dictionary
1195
- *
1196
- * Specifies the derived path for remote dictionaries relative to the result directory.
1197
- */
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
+ */
1198
1246
  remoteDictionariesDir: string;
1199
1247
  /**
1200
- * Directory where final dictionaries are stored, relative to the result directory
1201
- *
1202
- * Default: .intlayer/dictionary
1203
- *
1204
- * Specifies the derived path for dictionaries relative to the result directory.
1205
- */
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
+ */
1206
1254
  dictionariesDir: string;
1207
1255
  /**
1208
- * Directory where dynamic dictionaries are stored, relative to the result directory
1209
- *
1210
- * Default: .intlayer/dynamic_dictionary
1211
- *
1212
- * Specifies the derived path for dynamic dictionaries relative to the result directory.
1213
- */
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
+ */
1214
1262
  dynamicDictionariesDir: string;
1215
1263
  /**
1216
- * Directory where fetch dictionaries are stored, relative to the result directory
1217
- *
1218
- * Default: .intlayer/fetch_dictionary
1219
- *
1220
- * Specifies the derived path for fetch dictionaries relative to the result directory.
1221
- */
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
+ */
1222
1270
  fetchDictionariesDir: string;
1223
1271
  /**
1224
- * Directory where dictionary types are stored, relative to the result directory
1225
- *
1226
- * Default: .intlayer/types
1227
- *
1228
- * Specifies the derived path for dictionary types relative to the result directory.
1229
- */
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
+ */
1230
1278
  typesDir: string;
1231
1279
  /**
1232
- * Directory where the main files are stored, relative to the result directory
1233
- *
1234
- * Default: .intlayer/main
1235
- *
1236
- * Specifies the derived path for the main files relative to the result directory.
1237
- */
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
+ */
1238
1286
  mainDir: string;
1239
1287
  /**
1240
- * Directory where the configuration files are stored, relative to the result directory
1241
- *
1242
- * Default: .intlayer/config
1243
- *
1244
- * Specifies the derived path for the configuration files relative to the result directory.
1245
- */
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
+ */
1246
1294
  configDir: string;
1247
1295
  /**
1248
- * Directory where the cache files are stored, relative to the result directory
1249
- *
1250
- * Default: .intlayer/cache
1251
- *
1252
- * Specifies the derived path for the cache files relative to the result directory.
1253
- */
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
+ */
1254
1302
  cacheDir: string;
1255
1303
  /**
1256
- * Directory where the temp files are stored, relative to the result directory
1257
- *
1258
- * Default: .intlayer/tmp
1259
- *
1260
- * Specifies the derived path for the tmp files relative to the result directory.
1261
- */
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
+ */
1262
1310
  tempDir: string;
1263
1311
  };
1264
1312
  type LogFunctions = {
@@ -1269,26 +1317,26 @@ type LogFunctions = {
1269
1317
  };
1270
1318
  type LogConfig = {
1271
1319
  /**
1272
- * Indicates if the logger is enabled
1273
- *
1274
- * Default: true
1275
- *
1276
- * If 'default', the logger is enabled and can be used.
1277
- * If 'verbose', the logger will be enabled and can be used, but will log more information.
1278
- * If 'disabled', the logger is disabled and cannot be used.
1279
- */
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
+ */
1280
1328
  mode: "default" | "verbose" | "disabled";
1281
1329
  /**
1282
- * Prefix of the logger
1283
- *
1284
- * Default: '[intlayer]'
1285
- *
1286
- * The prefix of the logger.
1287
- */
1330
+ * Prefix of the logger
1331
+ *
1332
+ * Default: '[intlayer]'
1333
+ *
1334
+ * The prefix of the logger.
1335
+ */
1288
1336
  prefix: string;
1289
1337
  /**
1290
- * Functions to log
1291
- */
1338
+ * Functions to log
1339
+ */
1292
1340
  error?: typeof console.error;
1293
1341
  log?: typeof console.log;
1294
1342
  info?: typeof console.info;
@@ -1296,5 +1344,5 @@ type LogConfig = {
1296
1344
  debug?: typeof console.debug;
1297
1345
  };
1298
1346
  //#endregion
1299
- 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 };
1300
1348
  //# sourceMappingURL=config.d.ts.map