@lingo.dev/_spec 0.46.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,97 +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
- "csv-per-locale"
168
- ]
169
- },
170
- "default": {}
201
+ "required": [
202
+ "include"
203
+ ],
204
+ "additionalProperties": false
205
+ }
171
206
  },
172
207
  "$schema": {
173
- "type": "string",
174
- "default": "https://lingo.dev/schema/i18n.json"
208
+ "default": "https://lingo.dev/schema/i18n.json",
209
+ "type": "string"
175
210
  },
176
211
  "provider": {
212
+ "description": "Configuration for the machine-translation provider.",
177
213
  "type": "object",
178
214
  "properties": {
179
215
  "id": {
216
+ "description": "Identifier of the translation provider service.",
180
217
  "type": "string",
181
218
  "enum": [
182
219
  "openai",
@@ -185,33 +222,32 @@
185
222
  "ollama",
186
223
  "openrouter",
187
224
  "mistral"
188
- ],
189
- "description": "Identifier of the translation provider service."
225
+ ]
190
226
  },
191
227
  "model": {
192
- "type": "string",
193
- "description": "Model name to use for translations."
228
+ "description": "Model name to use for translations.",
229
+ "type": "string"
194
230
  },
195
231
  "prompt": {
196
- "type": "string",
197
- "description": "Prompt template used when requesting translations."
232
+ "description": "Prompt template used when requesting translations.",
233
+ "type": "string"
198
234
  },
199
235
  "baseUrl": {
200
- "type": "string",
201
- "description": "Custom base URL for the provider API (optional)."
236
+ "description": "Custom base URL for the provider API (optional).",
237
+ "type": "string"
202
238
  },
203
239
  "settings": {
240
+ "description": "Model-specific settings for translation requests.",
204
241
  "type": "object",
205
242
  "properties": {
206
243
  "temperature": {
244
+ "description": "Controls randomness in model outputs (0=deterministic, 2=very random). Some models like GPT-5 require temperature=1.",
207
245
  "type": "number",
208
246
  "minimum": 0,
209
- "maximum": 2,
210
- "description": "Controls randomness in model outputs (0=deterministic, 2=very random). Some models like GPT-5 require temperature=1."
247
+ "maximum": 2
211
248
  }
212
249
  },
213
- "additionalProperties": false,
214
- "description": "Model-specific settings for translation requests."
250
+ "additionalProperties": false
215
251
  }
216
252
  },
217
253
  "required": [
@@ -219,24 +255,25 @@
219
255
  "model",
220
256
  "prompt"
221
257
  ],
222
- "additionalProperties": false,
223
- "description": "Configuration for the machine-translation provider."
258
+ "additionalProperties": false
224
259
  },
225
260
  "formatter": {
261
+ "description": "Code formatter to use for all buckets. Defaults to 'prettier' if not specified and a prettier config is found.",
226
262
  "type": "string",
227
263
  "enum": [
228
264
  "prettier",
229
265
  "biome"
230
- ],
231
- "description": "Code formatter to use for all buckets. Defaults to 'prettier' if not specified and a prettier config is found."
266
+ ]
232
267
  },
233
268
  "vNext": {
234
269
  "type": "string"
235
270
  }
236
271
  },
237
272
  "required": [
238
- "locale"
273
+ "version",
274
+ "locale",
275
+ "buckets",
276
+ "$schema"
239
277
  ],
240
- "additionalProperties": false,
241
- "$schema": "http://json-schema.org/draft-07/schema#"
278
+ "additionalProperties": false
242
279
  }
package/build/index.cjs CHANGED
@@ -408,7 +408,7 @@ var extendConfigDefinition = (definition, params) => {
408
408
  if (safeResult.success) {
409
409
  return safeResult.data;
410
410
  }
411
- 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) => {
412
412
  let unsupportedLocale = "";
413
413
  const path = issue.path;
414
414
  const config = rawConfig;
@@ -468,13 +468,13 @@ var configV1Definition = extendConfigDefinition(configV0Definition, {
468
468
  });
469
469
  var configV1_1Definition = extendConfigDefinition(configV1Definition, {
470
470
  createSchema: (baseSchema) => baseSchema.extend({
471
- buckets: _zod2.default.record(
471
+ buckets: _zod2.default.partialRecord(
472
472
  bucketTypeSchema,
473
473
  _zod2.default.object({
474
474
  include: _zod2.default.array(_zod2.default.string()).default([]).describe(
475
475
  "File paths or glob patterns to include for this bucket."
476
476
  ),
477
- exclude: _zod2.default.array(_zod2.default.string()).default([]).optional().describe(
477
+ exclude: _zod2.default.array(_zod2.default.string()).optional().describe(
478
478
  "File paths or glob patterns to exclude from this bucket."
479
479
  )
480
480
  })
@@ -536,7 +536,7 @@ var bucketItemSchema = _zod2.default.object({
536
536
  );
537
537
  var bucketValueSchemaV1_3 = _zod2.default.object({
538
538
  include: _zod2.default.array(_zod2.default.union([_zod2.default.string(), bucketItemSchema])).default([]).describe("Glob patterns or bucket items to include for this bucket."),
539
- 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."),
540
540
  injectLocale: _zod2.default.array(_zod2.default.string()).optional().describe(
541
541
  "Keys within files where the current locale should be injected or removed."
542
542
  )
@@ -545,7 +545,10 @@ var configV1_3Definition = extendConfigDefinition(
545
545
  configV1_2Definition,
546
546
  {
547
547
  createSchema: (baseSchema) => baseSchema.extend({
548
- buckets: _zod2.default.record(bucketTypeSchema, bucketValueSchemaV1_3).default({})
548
+ buckets: _zod2.default.partialRecord(
549
+ bucketTypeSchema,
550
+ bucketValueSchemaV1_3
551
+ ).default({})
549
552
  }),
550
553
  createDefaultValue: (baseDefaultValue) => ({
551
554
  ...baseDefaultValue,
@@ -608,7 +611,7 @@ var configV1_5Definition = extendConfigDefinition(
608
611
  }
609
612
  );
610
613
  var bucketValueSchemaV1_6 = bucketValueSchemaV1_3.extend({
611
- lockedKeys: _zod2.default.array(_zod2.default.string()).default([]).optional().describe(
614
+ lockedKeys: _zod2.default.array(_zod2.default.string()).optional().describe(
612
615
  "Keys that must remain unchanged and should never be overwritten by translations."
613
616
  )
614
617
  });
@@ -616,7 +619,10 @@ var configV1_6Definition = extendConfigDefinition(
616
619
  configV1_5Definition,
617
620
  {
618
621
  createSchema: (baseSchema) => baseSchema.extend({
619
- buckets: _zod2.default.record(bucketTypeSchema, bucketValueSchemaV1_6).default({})
622
+ buckets: _zod2.default.partialRecord(
623
+ bucketTypeSchema,
624
+ bucketValueSchemaV1_6
625
+ ).default({})
620
626
  }),
621
627
  createDefaultValue: (baseDefaultValue) => ({
622
628
  ...baseDefaultValue,
@@ -629,7 +635,7 @@ var configV1_6Definition = extendConfigDefinition(
629
635
  }
630
636
  );
631
637
  var bucketValueSchemaV1_7 = bucketValueSchemaV1_6.extend({
632
- lockedPatterns: _zod2.default.array(_zod2.default.string()).default([]).optional().describe(
638
+ lockedPatterns: _zod2.default.array(_zod2.default.string()).optional().describe(
633
639
  "Regular expression patterns whose matched content should remain locked during translation."
634
640
  )
635
641
  });
@@ -637,7 +643,10 @@ var configV1_7Definition = extendConfigDefinition(
637
643
  configV1_6Definition,
638
644
  {
639
645
  createSchema: (baseSchema) => baseSchema.extend({
640
- buckets: _zod2.default.record(bucketTypeSchema, bucketValueSchemaV1_7).default({})
646
+ buckets: _zod2.default.partialRecord(
647
+ bucketTypeSchema,
648
+ bucketValueSchemaV1_7
649
+ ).default({})
641
650
  }),
642
651
  createDefaultValue: (baseDefaultValue) => ({
643
652
  ...baseDefaultValue,
@@ -650,7 +659,7 @@ var configV1_7Definition = extendConfigDefinition(
650
659
  }
651
660
  );
652
661
  var bucketValueSchemaV1_8 = bucketValueSchemaV1_7.extend({
653
- ignoredKeys: _zod2.default.array(_zod2.default.string()).default([]).optional().describe(
662
+ ignoredKeys: _zod2.default.array(_zod2.default.string()).optional().describe(
654
663
  "Keys that should be completely ignored by translation processes."
655
664
  )
656
665
  });
@@ -658,7 +667,10 @@ var configV1_8Definition = extendConfigDefinition(
658
667
  configV1_7Definition,
659
668
  {
660
669
  createSchema: (baseSchema) => baseSchema.extend({
661
- buckets: _zod2.default.record(bucketTypeSchema, bucketValueSchemaV1_8).default({})
670
+ buckets: _zod2.default.partialRecord(
671
+ bucketTypeSchema,
672
+ bucketValueSchemaV1_8
673
+ ).default({})
662
674
  }),
663
675
  createDefaultValue: (baseDefaultValue) => ({
664
676
  ...baseDefaultValue,