@intlayer/types 7.0.0-canary.0

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.
Files changed (67) hide show
  1. package/README.md +276 -0
  2. package/dist/cjs/_virtual/rolldown_runtime.cjs +14 -0
  3. package/dist/cjs/backend_models.cjs +0 -0
  4. package/dist/cjs/config.cjs +0 -0
  5. package/dist/cjs/dictionary.cjs +0 -0
  6. package/dist/cjs/index.cjs +11 -0
  7. package/dist/cjs/index.cjs.map +1 -0
  8. package/dist/cjs/intlayer.d.cjs +1 -0
  9. package/dist/cjs/keyPath.cjs +0 -0
  10. package/dist/cjs/locales copy.cjs +569 -0
  11. package/dist/cjs/locales copy.cjs.map +1 -0
  12. package/dist/cjs/locales.cjs +1413 -0
  13. package/dist/cjs/locales.cjs.map +1 -0
  14. package/dist/cjs/module_augmentation.cjs +0 -0
  15. package/dist/cjs/module_augmentation.cjs.map +1 -0
  16. package/dist/cjs/nodeType.cjs +31 -0
  17. package/dist/cjs/nodeType.cjs.map +1 -0
  18. package/dist/cjs/plugin.cjs +0 -0
  19. package/dist/cjs/test.cjs +0 -0
  20. package/dist/cjs/test.cjs.map +1 -0
  21. package/dist/cjs/translation.cjs +0 -0
  22. package/dist/esm/_virtual/rolldown_runtime.mjs +13 -0
  23. package/dist/esm/backend_models.mjs +0 -0
  24. package/dist/esm/config.mjs +0 -0
  25. package/dist/esm/dictionary.mjs +0 -0
  26. package/dist/esm/index.mjs +4 -0
  27. package/dist/esm/index.mjs.map +1 -0
  28. package/dist/esm/intlayer.d.mjs +3 -0
  29. package/dist/esm/keyPath.mjs +0 -0
  30. package/dist/esm/locales copy.mjs +568 -0
  31. package/dist/esm/locales copy.mjs.map +1 -0
  32. package/dist/esm/locales.mjs +1128 -0
  33. package/dist/esm/locales.mjs.map +1 -0
  34. package/dist/esm/module_augmentation.mjs +0 -0
  35. package/dist/esm/module_augmentation.mjs.map +1 -0
  36. package/dist/esm/nodeType.mjs +29 -0
  37. package/dist/esm/nodeType.mjs.map +1 -0
  38. package/dist/esm/plugin.mjs +0 -0
  39. package/dist/esm/test.mjs +0 -0
  40. package/dist/esm/test.mjs.map +1 -0
  41. package/dist/esm/translation.mjs +1 -0
  42. package/dist/types/backend_models.d.ts +1 -0
  43. package/dist/types/config.d.ts +793 -0
  44. package/dist/types/config.d.ts.map +1 -0
  45. package/dist/types/dictionary.d.ts +294 -0
  46. package/dist/types/dictionary.d.ts.map +1 -0
  47. package/dist/types/index.d.ts +8 -0
  48. package/dist/types/index.d.ts.map +1 -0
  49. package/dist/types/intlayer.d.ts +11 -0
  50. package/dist/types/intlayer.d.ts.map +1 -0
  51. package/dist/types/keyPath.d.ts +51 -0
  52. package/dist/types/keyPath.d.ts.map +1 -0
  53. package/dist/types/locales copy.d.ts +566 -0
  54. package/dist/types/locales copy.d.ts.map +1 -0
  55. package/dist/types/locales.d.ts +847 -0
  56. package/dist/types/locales.d.ts.map +1 -0
  57. package/dist/types/module_augmentation.d.ts +30 -0
  58. package/dist/types/module_augmentation.d.ts.map +1 -0
  59. package/dist/types/nodeType.d.ts +31 -0
  60. package/dist/types/nodeType.d.ts.map +1 -0
  61. package/dist/types/plugin.d.ts +71 -0
  62. package/dist/types/plugin.d.ts.map +1 -0
  63. package/dist/types/test.d.ts +20 -0
  64. package/dist/types/test.d.ts.map +1 -0
  65. package/dist/types/translation.d.ts +13 -0
  66. package/dist/types/translation.d.ts.map +1 -0
  67. package/package.json +93 -0
@@ -0,0 +1,793 @@
1
+ import { Locale } from "./locales.js";
2
+ import { Fill } from "./dictionary.js";
3
+ import { Plugin } from "./plugin.js";
4
+
5
+ //#region src/config.d.ts
6
+ type StrictMode = 'strict' | 'inclusive' | 'loose';
7
+ /**
8
+ * Configuration for internationalization settings
9
+ */
10
+ type InternationalizationConfig = {
11
+ /**
12
+ * Locales available in the application
13
+ *
14
+ * Default: [Locales.ENGLISH]
15
+ *
16
+ * You can define a list of available locales to support in the application.
17
+ */
18
+ locales: Locale[];
19
+ /**
20
+ * Locales required by TypeScript to ensure strong implementations of internationalized content using typescript.
21
+ *
22
+ * Default: []
23
+ *
24
+ * If empty, all locales are required in `strict` mode.
25
+ *
26
+ * Ensure required locales are also defined in the `locales` field.
27
+ */
28
+ requiredLocales: Locale[];
29
+ /**
30
+ * Ensure strong implementations of internationalized content using typescript.
31
+ * - 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.
32
+ * - 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.
33
+ * - If set to "loose", the translation `t` function will accept any existing locale.
34
+ *
35
+ * Default: "inclusive"
36
+ */
37
+ strictMode: StrictMode;
38
+ /**
39
+ * Default locale of the application for fallback
40
+ *
41
+ * Default: Locales.ENGLISH
42
+ *
43
+ * Used to specify a fallback locale in case no other locale is set.
44
+ */
45
+ defaultLocale: Locale;
46
+ };
47
+ type CookiesAttributes = {
48
+ /**
49
+ * Type of the storage
50
+ *
51
+ * The type of the storage. It can be 'cookie'.
52
+ */
53
+ type: 'cookie';
54
+ /**
55
+ * Cookie name to store the locale information
56
+ *
57
+ * Default: 'INTLAYER_LOCALE'
58
+ *
59
+ * The cookie key where the locale information is stored.
60
+ */
61
+ name?: string;
62
+ /**
63
+ * Cookie domain to store the locale information
64
+ *
65
+ * Default: undefined
66
+ *
67
+ * Define the domain where the cookie is available. Defaults to
68
+ * the domain of the page where the cookie was created.
69
+ */
70
+ domain?: string;
71
+ /**
72
+ * Cookie path to store the locale information
73
+ *
74
+ * Default: undefined
75
+ *
76
+ * Define the path where the cookie is available. Defaults to '/'
77
+ */
78
+ path?: string;
79
+ /**
80
+ * Cookie secure to store the locale information
81
+ *
82
+ * Default: undefined
83
+ *
84
+ * A Boolean indicating if the cookie transmission requires a
85
+ * secure protocol (https). Defaults to false.
86
+ */
87
+ secure?: boolean;
88
+ /**
89
+ * Cookie httpOnly to store the locale information
90
+ *
91
+ * Default: undefined
92
+ *
93
+ * The cookie httpOnly where the locale information is stored.
94
+ */
95
+ httpOnly?: boolean;
96
+ /**
97
+ * Cookie sameSite to store the locale information
98
+ *
99
+ * Default: undefined
100
+ *
101
+ * Asserts that a cookie must not be sent with cross-origin requests,
102
+ * providing some protection against cross-site request forgery
103
+ * attacks (CSRF)
104
+ */
105
+ sameSite?: 'strict' | 'lax' | 'none';
106
+ /**
107
+ * Cookie expires to store the locale information
108
+ *
109
+ * Default: undefined
110
+ *
111
+ * Define when the cookie will be removed. Value can be a Number
112
+ * which will be interpreted as days from time of creation or a
113
+ * Date instance. If omitted, the cookie becomes a session cookie.
114
+ */
115
+ expires?: Date | number | undefined;
116
+ };
117
+ type LocaleStorageAttributes = {
118
+ /**
119
+ * Storage type where the locale is stored
120
+ *
121
+ * Default: 'localStorage'
122
+ *
123
+ * Determines whether the locale is persisted in `localStorage` (across sessions)
124
+ * or `sessionStorage` (cleared when the browser session ends).
125
+ */
126
+ type: 'localStorage' | 'sessionStorage';
127
+ /**
128
+ * Storage key to store the locale information
129
+ *
130
+ * Default: 'INTLAYER_LOCALE'
131
+ *
132
+ * The key name used in the client storage to save the locale.
133
+ */
134
+ name?: string;
135
+ };
136
+ /**
137
+ * Configuration for routing behaviors
138
+ */
139
+ type RoutingConfig = {
140
+ /**
141
+ * URL routing mode for locale handling
142
+ *
143
+ * Controls how locales are represented in application URLs:
144
+ * - 'prefix-no-default': Prefix all locales except the default locale
145
+ * - 'prefix-all': Prefix all locales including the default locale
146
+ * - 'no-prefix': No locale prefixing in URLs
147
+ * - 'search-params': Use search parameters for locale handling
148
+ *
149
+ * Examples with defaultLocale = 'en':
150
+ * - 'prefix-no-default': /dashboard (en) or /fr/dashboard (fr)
151
+ * - 'prefix-all': /en/dashboard (en) or /fr/dashboard (fr)
152
+ * - 'no-prefix': /dashboard (locale handled via other means)
153
+ * - 'search-params': /dashboard?locale=fr
154
+ *
155
+ * Note: This setting do not impact the cookie, or locale storage management.
156
+ *
157
+ * Default: 'prefix-no-default'
158
+ */
159
+ mode: 'prefix-no-default' | 'prefix-all' | 'no-prefix' | 'search-params';
160
+ /**
161
+ * Configuration for storing the locale in the client (localStorage or sessionStorage)
162
+ *
163
+ * If false, the locale will not be stored by the middleware.
164
+ * If true, the locale storage will consider all default values.
165
+ *
166
+ * Default: 'cookie'
167
+ *
168
+ * Note: Check out GDPR compliance for cookies. See https://gdpr.eu/cookies/
169
+ * Note: useLocale hook includes a prop to disable the cookie storage.
170
+ * 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`).
171
+ *
172
+ * Recommendation:
173
+ * - Config both localStorage and cookies for the storage of the locale if you want to support GDPR compliance.
174
+ * - Disable the cookie storage by default on the useLocale hook by waiting for the user to consent to the cookie storage.
175
+ */
176
+ storage: false | 'cookie' | 'localStorage' | 'sessionStorage' | CookiesAttributes | LocaleStorageAttributes | ('cookie' | 'localStorage' | 'sessionStorage' | CookiesAttributes | LocaleStorageAttributes)[];
177
+ /**
178
+ * Header name to get the locale from the request
179
+ *
180
+ * Default: 'x-intlayer-locale'
181
+ *
182
+ * The HTTP header key used to determine the current locale.
183
+ */
184
+ headerName: string;
185
+ /**
186
+ * Base path for application URLs
187
+ *
188
+ * Default: ''
189
+ *
190
+ * Defines the base path where the application is accessible from.
191
+ */
192
+ basePath: string;
193
+ /**
194
+ * Controls whether locale detection occurs during Next.js prefetch requests
195
+ * - true: Detect and apply locale during prefetch
196
+ * - false: Use default locale during prefetch (recommended)
197
+ *
198
+ * This setting affects how Next.js handles locale prefetching:
199
+ *
200
+ * Example scenario:
201
+ * - User's browser language is 'fr'
202
+ * - Current page is /fr/about
203
+ * - Link prefetches /about
204
+ *
205
+ * With `detectLocaleOnPrefetchNoPrefix:true`
206
+ * - Prefetch detects 'fr' locale from browser
207
+ * - Redirects prefetch to /fr/about
208
+ *
209
+ * With `detectLocaleOnPrefetchNoPrefix:false` (default)
210
+ * - Prefetch uses default locale
211
+ * - Redirects prefetch to /en/about (assuming 'en' is default)
212
+ *
213
+ * When to use true:
214
+ * - Your app uses non-localized internal links (e.g. <a href="/about">)
215
+ * - You want consistent locale detection behavior between regular and prefetch requests
216
+ *
217
+ * When to use false (default):
218
+ * - Your app uses locale-prefixed links (e.g. <a href="/fr/about">)
219
+ * - You want to optimize prefetching performance
220
+ * - You want to avoid potential redirect loops
221
+ *
222
+ * Default: false
223
+ */
224
+ detectLocaleOnPrefetchNoPrefix: boolean;
225
+ };
226
+ /**
227
+ * Configuration for intlayer editor
228
+ */
229
+ type EditorConfig = {
230
+ /**
231
+ * URL of the application. Used to restrict the origin of the editor for security reasons.
232
+ *
233
+ * > '*' means that the editor is accessible from any origin
234
+ *
235
+ * Default: '*'
236
+ */
237
+ applicationURL: string;
238
+ /**
239
+ * URL of the editor server. Used to restrict the origin of the editor for security reasons.
240
+ *
241
+ * > '*' means that the editor is accessible from any origin
242
+ *
243
+ * Default: 'http://localhost:8000'
244
+ */
245
+ editorURL: string;
246
+ /**
247
+ * URL of the CMS server. Used to restrict the origin of the editor for security reasons.
248
+ *
249
+ * Default: 'https://intlayer.org'
250
+ */
251
+ cmsURL: string;
252
+ /**
253
+ * URL of the backend
254
+ *
255
+ * Default: 'https://back.intlayer.org'
256
+ *
257
+ * The URL of the backend server.
258
+ */
259
+ backendURL: string;
260
+ /**
261
+ * Indicates if the application interact with the visual editor
262
+ *
263
+ * Default: true;
264
+ *
265
+ * If true, the editor will be able to interact with the application.
266
+ * If false, the editor will not be able to interact with the application.
267
+ * In any case, the editor can only be enabled by the visual editor.
268
+ * Disabling the editor for specific environments is a way to enforce the security.
269
+ *
270
+ * Usage:
271
+ * ```js
272
+ * {
273
+ * // Other configurations
274
+ * editor: {
275
+ * enabled: process.env.NODE_ENV !== 'production',
276
+ * }
277
+ * };
278
+ * ```
279
+ *
280
+ */
281
+ enabled: boolean;
282
+ /** Port of the editor server
283
+ *
284
+ * Default: 8000
285
+ */
286
+ port: number;
287
+ /**
288
+ * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.
289
+ * An access token is use to authenticate the user related to the project.
290
+ * To get an access token, go to https://intlayer.org/dashboard/project and create an account.
291
+ *
292
+ * Default: undefined
293
+ *
294
+ * > 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.
295
+ */
296
+ clientId?: string;
297
+ /**
298
+ * clientId and clientSecret allow the intlayer packages to authenticate with the backend using oAuth2 authentication.
299
+ * An access token is use to authenticate the user related to the project.
300
+ * To get an access token, go to https://intlayer.org/dashboard/project and create an account.
301
+ *
302
+ * Default: undefined
303
+ *
304
+ * > 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.
305
+ */
306
+ clientSecret?: string;
307
+ /**
308
+ * Strategy for prioritizing dictionaries. If a dictionary is both present online and locally, the content will be merge.
309
+ * However, is a field is defined in both dictionary, this setting determines which fields takes the priority over the other.
310
+ *
311
+ * Default: 'local_first'
312
+ *
313
+ * The strategy for prioritizing dictionaries. It can be either 'local_first' or 'distant_first'.
314
+ * - 'local_first': The first dictionary found in the locale is used.
315
+ * - 'distant_first': The first dictionary found in the distant locales is used.
316
+ */
317
+ dictionaryPriorityStrategy: 'local_first' | 'distant_first';
318
+ /**
319
+ * Indicates if the application should hot reload the locale configurations when a change is detected.
320
+ * For example, when a new dictionary is added or updated, the application will update the content tu display in the page.
321
+ *
322
+ * Default: true
323
+ */
324
+ liveSync: boolean;
325
+ /**
326
+ * Port of the live sync server
327
+ *
328
+ * Default: 4000
329
+ */
330
+ liveSyncPort: number;
331
+ /**
332
+ * URL of the live sync server in case of remote live sync server
333
+ *
334
+ * Default: `http://localhost:${liveSyncPort}`
335
+ */
336
+ liveSyncURL: string;
337
+ /**
338
+ * Command to format the content. When intlayer write your .content files locally, this command will be used to format the content.
339
+ *
340
+ * Example:
341
+ *
342
+ * ```bash
343
+ * npx prettier --write {{file}}
344
+ * ```
345
+ *
346
+ * ```bash
347
+ * bunx biome format {{file}}
348
+ * ```
349
+ *
350
+ * ```bash
351
+ * bun format {{file}}
352
+ * ```
353
+ *
354
+ * ```bash
355
+ * npx eslint --fix {{file}}
356
+ * ```
357
+ *
358
+ * Intlayer will replace the {{file}} with the path of the file to format.
359
+ *
360
+ * Default: undefined
361
+ */
362
+ formatCommand: string | undefined;
363
+ };
364
+ type AiConfig = {
365
+ /**
366
+ * Provider
367
+ *
368
+ * The provider to use for the AI features of Intlayer.
369
+ *
370
+ * Available providers:
371
+ * - 'openai'
372
+ * - 'anthropic'
373
+ * - 'mistral'
374
+ * - 'deepseek'
375
+ * - 'gemini'
376
+ *
377
+ * Default: 'openai'
378
+ */
379
+ provider?: string;
380
+ /**
381
+ * API model
382
+ *
383
+ * The model to use for the AI features of Intlayer.
384
+ *
385
+ * Example: 'gpt-4o-2024-11-20'
386
+ *
387
+ */
388
+ model?: string;
389
+ /**
390
+ * temperature
391
+ *
392
+ * The temperature to use for the AI features of Intlayer.
393
+ * The temperature controls the randomness of the AI's responses.
394
+ * A higher temperature will make the AI more creative and less predictable.
395
+ *
396
+ * Example: 0.1
397
+ */
398
+ temperature?: number;
399
+ /**
400
+ * API key
401
+ *
402
+ * Use your own OpenAI API key to use the AI features of Intlayer.
403
+ * If you don't have an OpenAI API key, you can get one for free at https://openai.com/api/.
404
+ *
405
+ */
406
+ apiKey?: string;
407
+ /**
408
+ * Application context
409
+ *
410
+ * The context of the application to use for the AI features of Intlayer.
411
+ *
412
+ * Example: 'This is a website for a company that sells products online.'
413
+ */
414
+ applicationContext?: string;
415
+ };
416
+ type BuildConfig = {
417
+ /**
418
+ * Indicates if the build should be optimized
419
+ *
420
+ * Default: process.env.NODE_ENV === 'production'
421
+ *
422
+ * If true, the build will be optimized.
423
+ * If false, the build will not be optimized.
424
+ *
425
+ * Intlayer will replace all calls of dictionaries to optimize chunking. That way the final bundle will import only the dictionaries that are used.
426
+ * All imports will stay as static import to avoid async processing when loading the dictionaries.
427
+ *
428
+ * Note:
429
+ * - Intlayer will replace all call of `useIntlayer` with the defined mode by the `importMode` option.
430
+ * - Intlayer will replace all call of `getIntlayer` with `getDictionary`.
431
+ * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.
432
+ * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
433
+ */
434
+ optimize: boolean;
435
+ /**
436
+ * Indicates the mode of import to use for the dictionaries.
437
+ *
438
+ * Available modes:
439
+ * - "static": The dictionaries are imported statically.
440
+ * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionary`.
441
+ * - "dynamic": The dictionaries are imported dynamically in a synchronous component using the suspense API.
442
+ * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
443
+ * - "live": The dictionaries are imported dynamically using the live sync API.
444
+ * In that case, Intlayer will replace all calls to `useIntlayer` with `useDictionaryDynamic`.
445
+ * Live 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.
446
+ *
447
+ * Default: "static"
448
+ *
449
+ * By default, when a dictionary is loaded, it imports content for all locales as it's imported statically.
450
+ *
451
+ * Note:
452
+ * - Dynamic imports rely on Suspense and may slightly impact rendering performance.
453
+ * - If desabled all locales will be loaded at once, even if they are not used.
454
+ * - This option relies on the `@intlayer/babel` and `@intlayer/swc` plugins.
455
+ * - Ensure all keys are declared statically in the `useIntlayer` calls. e.g. `useIntlayer('navbar')`.
456
+ * - This option will be ignored if `optimize` is disabled.
457
+ * - 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.
458
+ * - The "live" allows to sync the dictionaries to the live sync server.
459
+ * - Require static key to work. Example of invalid code: `const navbarKey = "my-key"; useIntlayer(navbarKey)`.
460
+ */
461
+ importMode: 'static' | 'dynamic' | 'live';
462
+ /**
463
+ * Pattern to traverse the code to optimize.
464
+ *
465
+ * Allows to avoid to traverse the code that is not relevant to the optimization.
466
+ * Improve build performance.
467
+ *
468
+ * Default: ['**\/*.{js,ts,mjs,cjs,jsx,tsx,mjx,cjx}', '!**\/node_modules/**']
469
+ *
470
+ * Example: `['src/**\/*.{ts,tsx}', '../ui-library/**\/*.{ts,tsx}', '!**\/node_modules/**']`
471
+ *
472
+ * Note:
473
+ * - This option will be ignored if `optimize` is disabled.
474
+ * - Use glob pattern.
475
+ */
476
+ traversePattern: string[];
477
+ /**
478
+ * Output format of the dictionaries
479
+ *
480
+ * Default: ['cjs', 'esm']
481
+ *
482
+ * 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.
483
+ * This function will use the output format defined using this option.
484
+ * 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.
485
+ */
486
+ outputFormat: ('cjs' | 'esm')[];
487
+ /**
488
+ * Indicates if the cache should be enabled
489
+ *
490
+ * Default: true
491
+ *
492
+ * If true, the cache will be enabled.
493
+ * If false, the cache will not be enabled.
494
+ */
495
+ cache: boolean;
496
+ /**
497
+ * Require function
498
+ *
499
+ * In some environments, as VSCode extension, the require function should be set relatively to the project root to work properly.
500
+ *
501
+ * Default: undefined
502
+ *
503
+ * If undefined, the require function will be set to the default require function.
504
+ * If defined, the require function will be set to the defined require function.
505
+ *
506
+ * Example:
507
+ * ```js
508
+ * {
509
+ * require: require
510
+ * }
511
+ * ```
512
+ */
513
+ require: NodeJS.Require;
514
+ };
515
+ /**
516
+ * Custom configuration that can be provided to override default settings
517
+ */
518
+ type CustomIntlayerConfig = {
519
+ /**
520
+ * Custom internationalization configuration
521
+ */
522
+ internationalization?: Partial<InternationalizationConfig>;
523
+ /**
524
+ * Custom routing configuration
525
+ */
526
+ routing?: Partial<RoutingConfig>;
527
+ /**
528
+ * Custom content configuration
529
+ */
530
+ content?: Partial<ContentConfig>;
531
+ /**
532
+ * Custom editor configuration
533
+ */
534
+ editor?: Partial<EditorConfig>;
535
+ /**
536
+ * Custom log configuration
537
+ */
538
+ log?: Partial<LogConfig>;
539
+ /**
540
+ * Custom AI configuration
541
+ */
542
+ ai?: Partial<AiConfig>;
543
+ /**
544
+ * Custom build configuration
545
+ */
546
+ build?: Partial<BuildConfig>;
547
+ /**
548
+ * Custom plugins configuration
549
+ */
550
+ plugins?: Plugin[];
551
+ };
552
+ /**
553
+ * Combined configuration for internationalization, middleware, and content
554
+ */
555
+ type IntlayerConfig = {
556
+ /**
557
+ * Internationalization configuration
558
+ */
559
+ internationalization: InternationalizationConfig;
560
+ /**
561
+ * Routing configuration
562
+ */
563
+ routing: RoutingConfig;
564
+ /**
565
+ * Content configuration
566
+ */
567
+ content: ContentConfig;
568
+ /**
569
+ * Intlayer editor configuration
570
+ */
571
+ editor: EditorConfig;
572
+ /**
573
+ * Logger configuration
574
+ */
575
+ log: LogConfig;
576
+ /**
577
+ * AI configuration
578
+ */
579
+ ai?: Partial<AiConfig>;
580
+ /**
581
+ * Build configuration
582
+ */
583
+ build: BuildConfig;
584
+ /**
585
+ * Plugins configuration
586
+ */
587
+ plugins?: Plugin[];
588
+ };
589
+ /**
590
+ * Base configuration for content handling
591
+ */
592
+ type BaseContentConfig = {
593
+ /**
594
+ * File extensions of content to look for
595
+ *
596
+ * Default: ['.content.ts', '.content.js', '.content.cjs', '.content.mjs', '.content.json', '.content.tsx', '.content.jsx']
597
+ *
598
+ * List of file extensions to scan for content.
599
+ */
600
+ fileExtensions: string[];
601
+ /**
602
+ * Absolute path of the project's base directory
603
+ *
604
+ * Default: process.cwd()
605
+ *
606
+ * The root directory of the project, typically used for resolving other paths.
607
+ */
608
+ baseDir: string;
609
+ /**
610
+ * Directories to be excluded from content processing
611
+ *
612
+ * Default: ['node_modules', '.intlayer']
613
+ *
614
+ * A list of directories to exclude from content processing.
615
+ */
616
+ excludedPath: string[];
617
+ /**
618
+ * Indicates if Intlayer should watch for changes in the content declaration files in the app to rebuild the related dictionaries.
619
+ *
620
+ * Default: process.env.NODE_ENV === 'development'
621
+ */
622
+ watch: boolean;
623
+ /**
624
+ * Indicate how the content should be automatically filled using AI.
625
+ *
626
+ * Default: undefined
627
+ *
628
+ */
629
+ fill: Fill;
630
+ };
631
+ /**
632
+ * Configuration derived based on the base content configuration
633
+ */
634
+ type BaseDerivedConfig = {
635
+ /**
636
+ * Directory where the content is stored, relative to the base directory
637
+ *
638
+ * Default: ['.']
639
+ *
640
+ * Derived content directory based on the base configuration.
641
+ */
642
+ contentDir: string[];
643
+ /**
644
+ * Directory for module augmentation, relative to the base directory
645
+ *
646
+ * Default: .intlayer/types
647
+ *
648
+ * Defines the derived path for module augmentation.
649
+ */
650
+ moduleAugmentationDir: string;
651
+ /**
652
+ * Directory where unmerged dictionaries are stored, relative to the result directory
653
+ *
654
+ * Default: .intlayer/unmerged_dictionary
655
+ *
656
+ * Specifies the derived path for unmerged dictionaries relative to the result directory.
657
+ */
658
+ unmergedDictionariesDir: string;
659
+ /**
660
+ * Directory where remote dictionaries are stored, relative to the result directory
661
+ *
662
+ * Default: .intlayer/remote_dictionary
663
+ *
664
+ * Specifies the derived path for remote dictionaries relative to the result directory.
665
+ */
666
+ remoteDictionariesDir: string;
667
+ /**
668
+ * Directory where final dictionaries are stored, relative to the result directory
669
+ *
670
+ * Default: .intlayer/dictionary
671
+ *
672
+ * Specifies the derived path for dictionaries relative to the result directory.
673
+ */
674
+ dictionariesDir: string;
675
+ /**
676
+ * Directory where dynamic dictionaries are stored, relative to the result directory
677
+ *
678
+ * Default: .intlayer/dynamic_dictionary
679
+ *
680
+ * Specifies the derived path for dynamic dictionaries relative to the result directory.
681
+ */
682
+ dynamicDictionariesDir: string;
683
+ /**
684
+ * Directory where fetch dictionaries are stored, relative to the result directory
685
+ *
686
+ * Default: .intlayer/fetch_dictionary
687
+ *
688
+ * Specifies the derived path for fetch dictionaries relative to the result directory.
689
+ */
690
+ fetchDictionariesDir: string;
691
+ /**
692
+ * Directory where dictionary types are stored, relative to the result directory
693
+ *
694
+ * Default: .intlayer/types
695
+ *
696
+ * Specifies the derived path for dictionary types relative to the result directory.
697
+ */
698
+ typesDir: string;
699
+ /**
700
+ * Directory where the main files are stored, relative to the result directory
701
+ *
702
+ * Default: .intlayer/main
703
+ *
704
+ * Specifies the derived path for the main files relative to the result directory.
705
+ */
706
+ mainDir: string;
707
+ /**
708
+ * Directory where the configuration files are stored, relative to the result directory
709
+ *
710
+ * Default: .intlayer/config
711
+ *
712
+ * Specifies the derived path for the configuration files relative to the result directory.
713
+ */
714
+ configDir: string;
715
+ /**
716
+ * Directory where the cache files are stored, relative to the result directory
717
+ *
718
+ * Default: .intlayer/cache
719
+ *
720
+ * Specifies the derived path for the cache files relative to the result directory.
721
+ */
722
+ cacheDir: string;
723
+ };
724
+ /**
725
+ * Configuration for content patterns
726
+ */
727
+ type PatternsContentConfig = {
728
+ /**
729
+ * Patterns of files to watch for changes
730
+ *
731
+ * Default: ['/**\/*.content.ts', '/**\/*.content.js', '/**\/*.content.json', '/**\/*.content.cjs', '/**\/*.content.mjs', '/**\/*.content.tsx', '/**\/*.content.jsx']
732
+ *
733
+ * Defines file patterns for content to watch for changes.
734
+ */
735
+ watchedFilesPattern: string[];
736
+ /**
737
+ * Patterns of files to watch for changes including the relative path
738
+ *
739
+ * Default: ['src/**\/*.content.ts', 'src/**\/*.content.js', 'src/**\/*.content.json', 'src/**\/*.content.cjs', 'src/**\/*.content.mjs', 'src/**\/*.content.tsx', 'src/**\/*.content.jsx']
740
+ *
741
+ * Specifies the file patterns for content to watch, including relative paths.
742
+ */
743
+ watchedFilesPatternWithPath: string[];
744
+ /**
745
+ * Pattern for output files including the relative path
746
+ *
747
+ * Default: '{{dictionariesDir}}/**\/*.json'
748
+ *
749
+ * Defines the pattern for output files, including the relative path.
750
+ */
751
+ outputFilesPatternWithPath: string;
752
+ };
753
+ /**
754
+ * General configuration derived from the config file
755
+ */
756
+ type ContentConfig = BaseContentConfig & BaseDerivedConfig & PatternsContentConfig;
757
+ type LogFunctions = {
758
+ error?: typeof console.error;
759
+ log?: typeof console.log;
760
+ info?: typeof console.info;
761
+ warn?: typeof console.warn;
762
+ };
763
+ type LogConfig = {
764
+ /**
765
+ * Indicates if the logger is enabled
766
+ *
767
+ * Default: true
768
+ *
769
+ * If 'default', the logger is enabled and can be used.
770
+ * If 'verbose', the logger will be enabled and can be used, but will log more information.
771
+ * If 'disabled', the logger is disabled and cannot be used.
772
+ */
773
+ mode: 'default' | 'verbose' | 'disabled';
774
+ /**
775
+ * Prefix of the logger
776
+ *
777
+ * Default: '[intlayer]'
778
+ *
779
+ * The prefix of the logger.
780
+ */
781
+ prefix: string;
782
+ /**
783
+ * Functions to log
784
+ */
785
+ error?: typeof console.error;
786
+ log?: typeof console.log;
787
+ info?: typeof console.info;
788
+ warn?: typeof console.warn;
789
+ debug?: typeof console.debug;
790
+ };
791
+ //#endregion
792
+ export { AiConfig, BaseContentConfig, BaseDerivedConfig, BuildConfig, ContentConfig, CookiesAttributes, CustomIntlayerConfig, EditorConfig, InternationalizationConfig, IntlayerConfig, LocaleStorageAttributes, LogConfig, LogFunctions, PatternsContentConfig, RoutingConfig, StrictMode };
793
+ //# sourceMappingURL=config.d.ts.map