@lingo.dev/_spec 0.45.0 → 0.47.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.
@@ -1,46 +1,92 @@
1
1
  {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
2
3
  "type": "object",
3
4
  "properties": {
4
5
  "version": {
5
- "type": [
6
- "number",
7
- "string"
8
- ],
6
+ "description": "The version number of the schema.",
9
7
  "default": 0,
10
- "description": "The version number of the schema."
8
+ "anyOf": [
9
+ {
10
+ "type": "number"
11
+ },
12
+ {
13
+ "type": "string"
14
+ }
15
+ ]
11
16
  },
12
17
  "locale": {
13
18
  "type": "object",
14
19
  "properties": {
15
20
  "source": {
16
- "type": "string",
17
- "description": "Primary source locale code of your content (e.g. 'en', 'en-US', 'pt_BR', or 'pt-rBR'). Must be one of the supported locale codes – either a short ISO-639 language code or a full locale identifier using '-', '_' or Android '-r' notation."
21
+ "description": "Primary source locale code of your content (e.g. 'en', 'en-US', 'pt_BR', or 'pt-rBR'). Must be one of the supported locale codes – either a short ISO-639 language code or a full locale identifier using '-', '_' or Android '-r' notation.",
22
+ "type": "string"
18
23
  },
19
24
  "targets": {
25
+ "description": "List of target locale codes to translate to.",
20
26
  "type": "array",
21
27
  "items": {
22
- "$ref": "#/properties/locale/properties/source"
23
- },
24
- "description": "List of target locale codes to translate to."
28
+ "type": "string"
29
+ }
25
30
  },
26
31
  "extraSource": {
27
- "$ref": "#/properties/locale/properties/targets/items",
28
- "description": "Optional extra source locale code used as fallback during translation."
32
+ "description": "Optional extra source locale code used as fallback during translation.",
33
+ "type": "string"
29
34
  }
30
35
  },
31
36
  "required": [
32
37
  "source",
33
38
  "targets"
34
39
  ],
35
- "additionalProperties": false,
36
- "description": "Locale configuration block."
40
+ "additionalProperties": false
37
41
  },
38
42
  "buckets": {
43
+ "default": {},
39
44
  "type": "object",
45
+ "propertyNames": {
46
+ "type": "string",
47
+ "enum": [
48
+ "ail",
49
+ "android",
50
+ "csv",
51
+ "ejs",
52
+ "flutter",
53
+ "html",
54
+ "json",
55
+ "json5",
56
+ "jsonc",
57
+ "markdown",
58
+ "markdoc",
59
+ "mdx",
60
+ "mjml",
61
+ "twig",
62
+ "xcode-strings",
63
+ "xcode-stringsdict",
64
+ "xcode-xcstrings",
65
+ "xcode-xcstrings-v2",
66
+ "yaml",
67
+ "yaml-root-key",
68
+ "properties",
69
+ "po",
70
+ "xliff",
71
+ "xml",
72
+ "srt",
73
+ "dato",
74
+ "compiler",
75
+ "vtt",
76
+ "php",
77
+ "vue-json",
78
+ "typescript",
79
+ "txt",
80
+ "json-dictionary",
81
+ "csv-per-locale"
82
+ ]
83
+ },
40
84
  "additionalProperties": {
41
85
  "type": "object",
42
86
  "properties": {
43
87
  "include": {
88
+ "description": "Glob patterns or bucket items to include for this bucket.",
89
+ "default": [],
44
90
  "type": "array",
45
91
  "items": {
46
92
  "anyOf": [
@@ -48,37 +94,41 @@
48
94
  "type": "string"
49
95
  },
50
96
  {
97
+ "description": "Bucket path item. Either a string path or an object specifying path and delimiter.",
51
98
  "type": "object",
52
99
  "properties": {
53
100
  "path": {
54
- "type": "string",
55
- "description": "Path pattern containing a [locale] placeholder."
101
+ "description": "Path pattern containing a [locale] placeholder.",
102
+ "type": "string"
56
103
  },
57
104
  "delimiter": {
58
- "type": [
59
- "string",
60
- "null"
61
- ],
62
- "enum": [
63
- "-",
64
- "_",
65
- null
66
- ],
67
- "description": "Delimiter that replaces the [locale] placeholder in the path (default: no delimiter)."
105
+ "description": "Delimiter that replaces the [locale] placeholder in the path (default: no delimiter).",
106
+ "anyOf": [
107
+ {
108
+ "type": "string",
109
+ "const": "-"
110
+ },
111
+ {
112
+ "type": "string",
113
+ "const": "_"
114
+ },
115
+ {
116
+ "type": "null",
117
+ "const": null
118
+ }
119
+ ]
68
120
  }
69
121
  },
70
122
  "required": [
71
123
  "path"
72
124
  ],
73
- "additionalProperties": false,
74
- "description": "Bucket path item. Either a string path or an object specifying path and delimiter."
125
+ "additionalProperties": false
75
126
  }
76
127
  ]
77
- },
78
- "default": [],
79
- "description": "Glob patterns or bucket items to include for this bucket."
128
+ }
80
129
  },
81
130
  "exclude": {
131
+ "description": "Glob patterns or bucket items to exclude from this bucket.",
82
132
  "type": "array",
83
133
  "items": {
84
134
  "anyOf": [
@@ -86,96 +136,84 @@
86
136
  "type": "string"
87
137
  },
88
138
  {
89
- "$ref": "#/properties/buckets/additionalProperties/properties/include/items/anyOf/1"
139
+ "description": "Bucket path item. Either a string path or an object specifying path and delimiter.",
140
+ "type": "object",
141
+ "properties": {
142
+ "path": {
143
+ "description": "Path pattern containing a [locale] placeholder.",
144
+ "type": "string"
145
+ },
146
+ "delimiter": {
147
+ "description": "Delimiter that replaces the [locale] placeholder in the path (default: no delimiter).",
148
+ "anyOf": [
149
+ {
150
+ "type": "string",
151
+ "const": "-"
152
+ },
153
+ {
154
+ "type": "string",
155
+ "const": "_"
156
+ },
157
+ {
158
+ "type": "null",
159
+ "const": null
160
+ }
161
+ ]
162
+ }
163
+ },
164
+ "required": [
165
+ "path"
166
+ ],
167
+ "additionalProperties": false
90
168
  }
91
169
  ]
92
- },
93
- "default": [],
94
- "description": "Glob patterns or bucket items to exclude from this bucket."
170
+ }
95
171
  },
96
172
  "injectLocale": {
173
+ "description": "Keys within files where the current locale should be injected or removed.",
97
174
  "type": "array",
98
175
  "items": {
99
176
  "type": "string"
100
- },
101
- "description": "Keys within files where the current locale should be injected or removed."
177
+ }
102
178
  },
103
179
  "lockedKeys": {
180
+ "description": "Keys that must remain unchanged and should never be overwritten by translations.",
104
181
  "type": "array",
105
182
  "items": {
106
183
  "type": "string"
107
- },
108
- "default": [],
109
- "description": "Keys that must remain unchanged and should never be overwritten by translations."
184
+ }
110
185
  },
111
186
  "lockedPatterns": {
187
+ "description": "Regular expression patterns whose matched content should remain locked during translation.",
112
188
  "type": "array",
113
189
  "items": {
114
190
  "type": "string"
115
- },
116
- "default": [],
117
- "description": "Regular expression patterns whose matched content should remain locked during translation."
191
+ }
118
192
  },
119
193
  "ignoredKeys": {
194
+ "description": "Keys that should be completely ignored by translation processes.",
120
195
  "type": "array",
121
196
  "items": {
122
197
  "type": "string"
123
- },
124
- "default": [],
125
- "description": "Keys that should be completely ignored by translation processes."
198
+ }
126
199
  }
127
200
  },
128
- "additionalProperties": false,
129
- "description": "Configuration options for a translation bucket."
130
- },
131
- "propertyNames": {
132
- "enum": [
133
- "ail",
134
- "android",
135
- "csv",
136
- "ejs",
137
- "flutter",
138
- "html",
139
- "json",
140
- "json5",
141
- "jsonc",
142
- "markdown",
143
- "markdoc",
144
- "mdx",
145
- "mjml",
146
- "twig",
147
- "xcode-strings",
148
- "xcode-stringsdict",
149
- "xcode-xcstrings",
150
- "xcode-xcstrings-v2",
151
- "yaml",
152
- "yaml-root-key",
153
- "properties",
154
- "po",
155
- "xliff",
156
- "xml",
157
- "srt",
158
- "dato",
159
- "compiler",
160
- "vtt",
161
- "php",
162
- "po",
163
- "vue-json",
164
- "typescript",
165
- "txt",
166
- "json-dictionary"
167
- ]
168
- },
169
- "default": {}
201
+ "required": [
202
+ "include"
203
+ ],
204
+ "additionalProperties": false
205
+ }
170
206
  },
171
207
  "$schema": {
172
- "type": "string",
173
- "default": "https://lingo.dev/schema/i18n.json"
208
+ "default": "https://lingo.dev/schema/i18n.json",
209
+ "type": "string"
174
210
  },
175
211
  "provider": {
212
+ "description": "Configuration for the machine-translation provider.",
176
213
  "type": "object",
177
214
  "properties": {
178
215
  "id": {
216
+ "description": "Identifier of the translation provider service.",
179
217
  "type": "string",
180
218
  "enum": [
181
219
  "openai",
@@ -184,33 +222,32 @@
184
222
  "ollama",
185
223
  "openrouter",
186
224
  "mistral"
187
- ],
188
- "description": "Identifier of the translation provider service."
225
+ ]
189
226
  },
190
227
  "model": {
191
- "type": "string",
192
- "description": "Model name to use for translations."
228
+ "description": "Model name to use for translations.",
229
+ "type": "string"
193
230
  },
194
231
  "prompt": {
195
- "type": "string",
196
- "description": "Prompt template used when requesting translations."
232
+ "description": "Prompt template used when requesting translations.",
233
+ "type": "string"
197
234
  },
198
235
  "baseUrl": {
199
- "type": "string",
200
- "description": "Custom base URL for the provider API (optional)."
236
+ "description": "Custom base URL for the provider API (optional).",
237
+ "type": "string"
201
238
  },
202
239
  "settings": {
240
+ "description": "Model-specific settings for translation requests.",
203
241
  "type": "object",
204
242
  "properties": {
205
243
  "temperature": {
244
+ "description": "Controls randomness in model outputs (0=deterministic, 2=very random). Some models like GPT-5 require temperature=1.",
206
245
  "type": "number",
207
246
  "minimum": 0,
208
- "maximum": 2,
209
- "description": "Controls randomness in model outputs (0=deterministic, 2=very random). Some models like GPT-5 require temperature=1."
247
+ "maximum": 2
210
248
  }
211
249
  },
212
- "additionalProperties": false,
213
- "description": "Model-specific settings for translation requests."
250
+ "additionalProperties": false
214
251
  }
215
252
  },
216
253
  "required": [
@@ -218,24 +255,25 @@
218
255
  "model",
219
256
  "prompt"
220
257
  ],
221
- "additionalProperties": false,
222
- "description": "Configuration for the machine-translation provider."
258
+ "additionalProperties": false
223
259
  },
224
260
  "formatter": {
261
+ "description": "Code formatter to use for all buckets. Defaults to 'prettier' if not specified and a prettier config is found.",
225
262
  "type": "string",
226
263
  "enum": [
227
264
  "prettier",
228
265
  "biome"
229
- ],
230
- "description": "Code formatter to use for all buckets. Defaults to 'prettier' if not specified and a prettier config is found."
266
+ ]
231
267
  },
232
268
  "vNext": {
233
269
  "type": "string"
234
270
  }
235
271
  },
236
272
  "required": [
237
- "locale"
273
+ "version",
274
+ "locale",
275
+ "buckets",
276
+ "$schema"
238
277
  ],
239
- "additionalProperties": false,
240
- "$schema": "http://json-schema.org/draft-07/schema#"
278
+ "additionalProperties": false
241
279
  }
package/build/index.cjs CHANGED
@@ -380,7 +380,8 @@ var bucketTypes = [
380
380
  "vue-json",
381
381
  "typescript",
382
382
  "txt",
383
- "json-dictionary"
383
+ "json-dictionary",
384
+ "csv-per-locale"
384
385
  ];
385
386
  var bucketTypeSchema = _zod2.default.enum(bucketTypes);
386
387
 
@@ -407,7 +408,7 @@ var extendConfigDefinition = (definition, params) => {
407
408
  if (safeResult.success) {
408
409
  return safeResult.data;
409
410
  }
410
- const localeErrors = safeResult.error.errors.filter((issue) => issue.message.includes("Invalid locale code")).map((issue) => {
411
+ const localeErrors = safeResult.error.issues.filter((issue) => issue.message.includes("Invalid locale code")).map((issue) => {
411
412
  let unsupportedLocale = "";
412
413
  const path = issue.path;
413
414
  const config = rawConfig;
@@ -467,13 +468,13 @@ var configV1Definition = extendConfigDefinition(configV0Definition, {
467
468
  });
468
469
  var configV1_1Definition = extendConfigDefinition(configV1Definition, {
469
470
  createSchema: (baseSchema) => baseSchema.extend({
470
- buckets: _zod2.default.record(
471
+ buckets: _zod2.default.partialRecord(
471
472
  bucketTypeSchema,
472
473
  _zod2.default.object({
473
474
  include: _zod2.default.array(_zod2.default.string()).default([]).describe(
474
475
  "File paths or glob patterns to include for this bucket."
475
476
  ),
476
- exclude: _zod2.default.array(_zod2.default.string()).default([]).optional().describe(
477
+ exclude: _zod2.default.array(_zod2.default.string()).optional().describe(
477
478
  "File paths or glob patterns to exclude from this bucket."
478
479
  )
479
480
  })
@@ -535,7 +536,7 @@ var bucketItemSchema = _zod2.default.object({
535
536
  );
536
537
  var bucketValueSchemaV1_3 = _zod2.default.object({
537
538
  include: _zod2.default.array(_zod2.default.union([_zod2.default.string(), bucketItemSchema])).default([]).describe("Glob patterns or bucket items to include for this bucket."),
538
- exclude: _zod2.default.array(_zod2.default.union([_zod2.default.string(), bucketItemSchema])).default([]).optional().describe("Glob patterns or bucket items to exclude from this bucket."),
539
+ exclude: _zod2.default.array(_zod2.default.union([_zod2.default.string(), bucketItemSchema])).optional().describe("Glob patterns or bucket items to exclude from this bucket."),
539
540
  injectLocale: _zod2.default.array(_zod2.default.string()).optional().describe(
540
541
  "Keys within files where the current locale should be injected or removed."
541
542
  )
@@ -544,7 +545,10 @@ var configV1_3Definition = extendConfigDefinition(
544
545
  configV1_2Definition,
545
546
  {
546
547
  createSchema: (baseSchema) => baseSchema.extend({
547
- buckets: _zod2.default.record(bucketTypeSchema, bucketValueSchemaV1_3).default({})
548
+ buckets: _zod2.default.partialRecord(
549
+ bucketTypeSchema,
550
+ bucketValueSchemaV1_3
551
+ ).default({})
548
552
  }),
549
553
  createDefaultValue: (baseDefaultValue) => ({
550
554
  ...baseDefaultValue,
@@ -607,7 +611,7 @@ var configV1_5Definition = extendConfigDefinition(
607
611
  }
608
612
  );
609
613
  var bucketValueSchemaV1_6 = bucketValueSchemaV1_3.extend({
610
- lockedKeys: _zod2.default.array(_zod2.default.string()).default([]).optional().describe(
614
+ lockedKeys: _zod2.default.array(_zod2.default.string()).optional().describe(
611
615
  "Keys that must remain unchanged and should never be overwritten by translations."
612
616
  )
613
617
  });
@@ -615,7 +619,10 @@ var configV1_6Definition = extendConfigDefinition(
615
619
  configV1_5Definition,
616
620
  {
617
621
  createSchema: (baseSchema) => baseSchema.extend({
618
- buckets: _zod2.default.record(bucketTypeSchema, bucketValueSchemaV1_6).default({})
622
+ buckets: _zod2.default.partialRecord(
623
+ bucketTypeSchema,
624
+ bucketValueSchemaV1_6
625
+ ).default({})
619
626
  }),
620
627
  createDefaultValue: (baseDefaultValue) => ({
621
628
  ...baseDefaultValue,
@@ -628,7 +635,7 @@ var configV1_6Definition = extendConfigDefinition(
628
635
  }
629
636
  );
630
637
  var bucketValueSchemaV1_7 = bucketValueSchemaV1_6.extend({
631
- lockedPatterns: _zod2.default.array(_zod2.default.string()).default([]).optional().describe(
638
+ lockedPatterns: _zod2.default.array(_zod2.default.string()).optional().describe(
632
639
  "Regular expression patterns whose matched content should remain locked during translation."
633
640
  )
634
641
  });
@@ -636,7 +643,10 @@ var configV1_7Definition = extendConfigDefinition(
636
643
  configV1_6Definition,
637
644
  {
638
645
  createSchema: (baseSchema) => baseSchema.extend({
639
- buckets: _zod2.default.record(bucketTypeSchema, bucketValueSchemaV1_7).default({})
646
+ buckets: _zod2.default.partialRecord(
647
+ bucketTypeSchema,
648
+ bucketValueSchemaV1_7
649
+ ).default({})
640
650
  }),
641
651
  createDefaultValue: (baseDefaultValue) => ({
642
652
  ...baseDefaultValue,
@@ -649,7 +659,7 @@ var configV1_7Definition = extendConfigDefinition(
649
659
  }
650
660
  );
651
661
  var bucketValueSchemaV1_8 = bucketValueSchemaV1_7.extend({
652
- ignoredKeys: _zod2.default.array(_zod2.default.string()).default([]).optional().describe(
662
+ ignoredKeys: _zod2.default.array(_zod2.default.string()).optional().describe(
653
663
  "Keys that should be completely ignored by translation processes."
654
664
  )
655
665
  });
@@ -657,7 +667,10 @@ var configV1_8Definition = extendConfigDefinition(
657
667
  configV1_7Definition,
658
668
  {
659
669
  createSchema: (baseSchema) => baseSchema.extend({
660
- buckets: _zod2.default.record(bucketTypeSchema, bucketValueSchemaV1_8).default({})
670
+ buckets: _zod2.default.partialRecord(
671
+ bucketTypeSchema,
672
+ bucketValueSchemaV1_8
673
+ ).default({})
661
674
  }),
662
675
  createDefaultValue: (baseDefaultValue) => ({
663
676
  ...baseDefaultValue,