@lingo.dev/_spec 0.46.0 → 0.47.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.
@@ -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,91 @@
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
+ }
199
+ },
200
+ "preservedKeys": {
201
+ "description": "Keys that are added to targets using source values as placeholders, but once present, are never overwritten by the CLI.",
202
+ "type": "array",
203
+ "items": {
204
+ "type": "string"
205
+ }
126
206
  }
127
207
  },
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": {}
208
+ "required": [
209
+ "include"
210
+ ],
211
+ "additionalProperties": false
212
+ }
171
213
  },
172
214
  "$schema": {
173
- "type": "string",
174
- "default": "https://lingo.dev/schema/i18n.json"
215
+ "default": "https://lingo.dev/schema/i18n.json",
216
+ "type": "string"
175
217
  },
176
218
  "provider": {
219
+ "description": "Configuration for the machine-translation provider.",
177
220
  "type": "object",
178
221
  "properties": {
179
222
  "id": {
223
+ "description": "Identifier of the translation provider service.",
180
224
  "type": "string",
181
225
  "enum": [
182
226
  "openai",
@@ -185,33 +229,32 @@
185
229
  "ollama",
186
230
  "openrouter",
187
231
  "mistral"
188
- ],
189
- "description": "Identifier of the translation provider service."
232
+ ]
190
233
  },
191
234
  "model": {
192
- "type": "string",
193
- "description": "Model name to use for translations."
235
+ "description": "Model name to use for translations.",
236
+ "type": "string"
194
237
  },
195
238
  "prompt": {
196
- "type": "string",
197
- "description": "Prompt template used when requesting translations."
239
+ "description": "Prompt template used when requesting translations.",
240
+ "type": "string"
198
241
  },
199
242
  "baseUrl": {
200
- "type": "string",
201
- "description": "Custom base URL for the provider API (optional)."
243
+ "description": "Custom base URL for the provider API (optional).",
244
+ "type": "string"
202
245
  },
203
246
  "settings": {
247
+ "description": "Model-specific settings for translation requests.",
204
248
  "type": "object",
205
249
  "properties": {
206
250
  "temperature": {
251
+ "description": "Controls randomness in model outputs (0=deterministic, 2=very random). Some models like GPT-5 require temperature=1.",
207
252
  "type": "number",
208
253
  "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."
254
+ "maximum": 2
211
255
  }
212
256
  },
213
- "additionalProperties": false,
214
- "description": "Model-specific settings for translation requests."
257
+ "additionalProperties": false
215
258
  }
216
259
  },
217
260
  "required": [
@@ -219,24 +262,25 @@
219
262
  "model",
220
263
  "prompt"
221
264
  ],
222
- "additionalProperties": false,
223
- "description": "Configuration for the machine-translation provider."
265
+ "additionalProperties": false
224
266
  },
225
267
  "formatter": {
268
+ "description": "Code formatter to use for all buckets. Defaults to 'prettier' if not specified and a prettier config is found.",
226
269
  "type": "string",
227
270
  "enum": [
228
271
  "prettier",
229
272
  "biome"
230
- ],
231
- "description": "Code formatter to use for all buckets. Defaults to 'prettier' if not specified and a prettier config is found."
273
+ ]
232
274
  },
233
275
  "vNext": {
234
276
  "type": "string"
235
277
  }
236
278
  },
237
279
  "required": [
238
- "locale"
280
+ "version",
281
+ "locale",
282
+ "buckets",
283
+ "$schema"
239
284
  ],
240
- "additionalProperties": false,
241
- "$schema": "http://json-schema.org/draft-07/schema#"
285
+ "additionalProperties": false
242
286
  }
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,
@@ -741,7 +753,31 @@ var configV1_11Definition = extendConfigDefinition(
741
753
  })
742
754
  }
743
755
  );
744
- var LATEST_CONFIG_DEFINITION = configV1_11Definition;
756
+ var bucketValueSchemaV1_12 = bucketValueSchemaV1_8.extend({
757
+ preservedKeys: _zod2.default.array(_zod2.default.string()).optional().describe(
758
+ "Keys that are added to targets using source values as placeholders, but once present, are never overwritten by the CLI."
759
+ )
760
+ });
761
+ var configV1_12Definition = extendConfigDefinition(
762
+ configV1_11Definition,
763
+ {
764
+ createSchema: (baseSchema) => baseSchema.extend({
765
+ buckets: _zod2.default.partialRecord(
766
+ bucketTypeSchema,
767
+ bucketValueSchemaV1_12
768
+ ).default({})
769
+ }),
770
+ createDefaultValue: (baseDefaultValue) => ({
771
+ ...baseDefaultValue,
772
+ version: "1.12"
773
+ }),
774
+ createUpgrader: (oldConfig) => ({
775
+ ...oldConfig,
776
+ version: "1.12"
777
+ })
778
+ }
779
+ );
780
+ var LATEST_CONFIG_DEFINITION = configV1_12Definition;
745
781
  function parseI18nConfig(rawConfig) {
746
782
  try {
747
783
  const result = LATEST_CONFIG_DEFINITION.parse(rawConfig);
@@ -786,4 +822,6 @@ var defaultConfig = LATEST_CONFIG_DEFINITION.defaultValue;
786
822
 
787
823
 
788
824
 
789
- exports.LATEST_CONFIG_DEFINITION = LATEST_CONFIG_DEFINITION; exports.bucketItemSchema = bucketItemSchema; exports.bucketTypeSchema = bucketTypeSchema; exports.bucketTypes = bucketTypes; exports.bucketValueSchemaV1_3 = bucketValueSchemaV1_3; exports.bucketValueSchemaV1_6 = bucketValueSchemaV1_6; exports.bucketValueSchemaV1_7 = bucketValueSchemaV1_7; exports.bucketValueSchemaV1_8 = bucketValueSchemaV1_8; exports.configV0Definition = configV0Definition; exports.configV1Definition = configV1Definition; exports.configV1_10Definition = configV1_10Definition; exports.configV1_11Definition = configV1_11Definition; exports.configV1_1Definition = configV1_1Definition; exports.configV1_2Definition = configV1_2Definition; exports.configV1_3Definition = configV1_3Definition; exports.configV1_4Definition = configV1_4Definition; exports.configV1_5Definition = configV1_5Definition; exports.configV1_6Definition = configV1_6Definition; exports.configV1_7Definition = configV1_7Definition; exports.configV1_8Definition = configV1_8Definition; exports.configV1_9Definition = configV1_9Definition; exports.defaultConfig = defaultConfig; exports.getLocaleCodeDelimiter = getLocaleCodeDelimiter; exports.localeCodeSchema = localeCodeSchema; exports.localeCodes = localeCodes; exports.localeCodesFull = localeCodesFull; exports.localeCodesFullExplicitRegion = localeCodesFullExplicitRegion; exports.localeCodesFullUnderscore = localeCodesFullUnderscore; exports.localeCodesShort = localeCodesShort; exports.localeSchema = localeSchema; exports.normalizeLocale = normalizeLocale; exports.parseI18nConfig = parseI18nConfig; exports.resolveLocaleCode = resolveLocaleCode; exports.resolveOverriddenLocale = resolveOverriddenLocale;
825
+
826
+
827
+ exports.LATEST_CONFIG_DEFINITION = LATEST_CONFIG_DEFINITION; exports.bucketItemSchema = bucketItemSchema; exports.bucketTypeSchema = bucketTypeSchema; exports.bucketTypes = bucketTypes; exports.bucketValueSchemaV1_12 = bucketValueSchemaV1_12; exports.bucketValueSchemaV1_3 = bucketValueSchemaV1_3; exports.bucketValueSchemaV1_6 = bucketValueSchemaV1_6; exports.bucketValueSchemaV1_7 = bucketValueSchemaV1_7; exports.bucketValueSchemaV1_8 = bucketValueSchemaV1_8; exports.configV0Definition = configV0Definition; exports.configV1Definition = configV1Definition; exports.configV1_10Definition = configV1_10Definition; exports.configV1_11Definition = configV1_11Definition; exports.configV1_12Definition = configV1_12Definition; exports.configV1_1Definition = configV1_1Definition; exports.configV1_2Definition = configV1_2Definition; exports.configV1_3Definition = configV1_3Definition; exports.configV1_4Definition = configV1_4Definition; exports.configV1_5Definition = configV1_5Definition; exports.configV1_6Definition = configV1_6Definition; exports.configV1_7Definition = configV1_7Definition; exports.configV1_8Definition = configV1_8Definition; exports.configV1_9Definition = configV1_9Definition; exports.defaultConfig = defaultConfig; exports.getLocaleCodeDelimiter = getLocaleCodeDelimiter; exports.localeCodeSchema = localeCodeSchema; exports.localeCodes = localeCodes; exports.localeCodesFull = localeCodesFull; exports.localeCodesFullExplicitRegion = localeCodesFullExplicitRegion; exports.localeCodesFullUnderscore = localeCodesFullUnderscore; exports.localeCodesShort = localeCodesShort; exports.localeSchema = localeSchema; exports.normalizeLocale = normalizeLocale; exports.parseI18nConfig = parseI18nConfig; exports.resolveLocaleCode = resolveLocaleCode; exports.resolveOverriddenLocale = resolveOverriddenLocale;