@lingo.dev/_compiler 0.5.4 → 0.6.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.
package/build/index.cjs CHANGED
@@ -25,7 +25,7 @@ var _unplugin = require('unplugin');
25
25
  // package.json
26
26
  var package_default = {
27
27
  name: "@lingo.dev/_compiler",
28
- version: "0.5.4",
28
+ version: "0.6.0",
29
29
  description: "Lingo.dev Compiler",
30
30
  private: false,
31
31
  publishConfig: {
@@ -69,6 +69,7 @@ var package_default = {
69
69
  "@babel/traverse": "^7.27.4",
70
70
  "@babel/types": "^7.26.7",
71
71
  "@lingo.dev/_sdk": "workspace:*",
72
+ "@lingo.dev/_spec": "workspace:*",
72
73
  "@openrouter/ai-sdk-provider": "^0.7.1",
73
74
  "@prettier/sync": "^0.6.1",
74
75
  ai: "^4.2.10",
package/build/index.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { NextConfig } from 'next';
2
+ import { LocaleCode } from '@lingo.dev/_spec';
2
3
 
3
4
  /**
4
5
  * Options for configuring Lingo.dev Compiler.
@@ -14,7 +15,7 @@ type CompilerParams = {
14
15
  *
15
16
  * @default "en"
16
17
  */
17
- sourceLocale: string;
18
+ sourceLocale: LocaleCode;
18
19
  /**
19
20
  * The locale(s) to translate to.
20
21
  *
@@ -25,7 +26,7 @@ type CompilerParams = {
25
26
  *
26
27
  * @default ["es"]
27
28
  */
28
- targetLocales: string[];
29
+ targetLocales: LocaleCode[];
29
30
  /**
30
31
  * The name of the directory where translation files will be stored, relative to `sourceRoot`.
31
32
  *
@@ -76,7 +77,7 @@ type CompilerParams = {
76
77
  *
77
78
  * @default {}
78
79
  */
79
- models: "lingo.dev" | Record<string, string>;
80
+ models: "lingo.dev" | ModelMap;
80
81
  /**
81
82
  * Custom system prompt for the translation engine. If set, this prompt will override the default system prompt defined in Compiler.
82
83
  * Only works with custom models, not with Lingo.dev Engine.
@@ -87,6 +88,40 @@ type CompilerParams = {
87
88
  */
88
89
  prompt?: string | null;
89
90
  };
91
+ /**
92
+ * A mapping between locale pairings and the model to use to translate that pairing.
93
+ */
94
+ type ModelMap = {
95
+ [key in SourceTargetLocale]?: ModelIdentifier;
96
+ };
97
+ /**
98
+ * A pairing of a source and target locale.
99
+ */
100
+ type SourceTargetLocale = LocalePair | AnyTargetLocale | AnySourceLocale | AnyLocale;
101
+ /**
102
+ * A translation from a specific source locale to a specific target locale.
103
+ */
104
+ type LocalePair = `${LocaleCode}:${LocaleCode}`;
105
+ /**
106
+ * A translation from a specific source locale to any target locale.
107
+ */
108
+ type AnyTargetLocale = `${LocaleCode}:${LocaleWildcard}`;
109
+ /**
110
+ * A translation from any source locale to a specific target locale.
111
+ */
112
+ type AnySourceLocale = `${LocaleWildcard}:${LocaleCode}`;
113
+ /**
114
+ * A translation from any source locale to any target locale.
115
+ */
116
+ type AnyLocale = `${LocaleWildcard}:${LocaleWildcard}`;
117
+ /**
118
+ * A wildcard symbol that matches any locale.
119
+ */
120
+ type LocaleWildcard = "*";
121
+ /**
122
+ * The colon-separated identifier of a model to use for translation.
123
+ */
124
+ type ModelIdentifier = `${string}:${string}`;
90
125
  declare const defaultParams: CompilerParams;
91
126
 
92
127
  declare const _default: {
package/build/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { NextConfig } from 'next';
2
+ import { LocaleCode } from '@lingo.dev/_spec';
2
3
 
3
4
  /**
4
5
  * Options for configuring Lingo.dev Compiler.
@@ -14,7 +15,7 @@ type CompilerParams = {
14
15
  *
15
16
  * @default "en"
16
17
  */
17
- sourceLocale: string;
18
+ sourceLocale: LocaleCode;
18
19
  /**
19
20
  * The locale(s) to translate to.
20
21
  *
@@ -25,7 +26,7 @@ type CompilerParams = {
25
26
  *
26
27
  * @default ["es"]
27
28
  */
28
- targetLocales: string[];
29
+ targetLocales: LocaleCode[];
29
30
  /**
30
31
  * The name of the directory where translation files will be stored, relative to `sourceRoot`.
31
32
  *
@@ -76,7 +77,7 @@ type CompilerParams = {
76
77
  *
77
78
  * @default {}
78
79
  */
79
- models: "lingo.dev" | Record<string, string>;
80
+ models: "lingo.dev" | ModelMap;
80
81
  /**
81
82
  * Custom system prompt for the translation engine. If set, this prompt will override the default system prompt defined in Compiler.
82
83
  * Only works with custom models, not with Lingo.dev Engine.
@@ -87,6 +88,40 @@ type CompilerParams = {
87
88
  */
88
89
  prompt?: string | null;
89
90
  };
91
+ /**
92
+ * A mapping between locale pairings and the model to use to translate that pairing.
93
+ */
94
+ type ModelMap = {
95
+ [key in SourceTargetLocale]?: ModelIdentifier;
96
+ };
97
+ /**
98
+ * A pairing of a source and target locale.
99
+ */
100
+ type SourceTargetLocale = LocalePair | AnyTargetLocale | AnySourceLocale | AnyLocale;
101
+ /**
102
+ * A translation from a specific source locale to a specific target locale.
103
+ */
104
+ type LocalePair = `${LocaleCode}:${LocaleCode}`;
105
+ /**
106
+ * A translation from a specific source locale to any target locale.
107
+ */
108
+ type AnyTargetLocale = `${LocaleCode}:${LocaleWildcard}`;
109
+ /**
110
+ * A translation from any source locale to a specific target locale.
111
+ */
112
+ type AnySourceLocale = `${LocaleWildcard}:${LocaleCode}`;
113
+ /**
114
+ * A translation from any source locale to any target locale.
115
+ */
116
+ type AnyLocale = `${LocaleWildcard}:${LocaleWildcard}`;
117
+ /**
118
+ * A wildcard symbol that matches any locale.
119
+ */
120
+ type LocaleWildcard = "*";
121
+ /**
122
+ * The colon-separated identifier of a model to use for translation.
123
+ */
124
+ type ModelIdentifier = `${string}:${string}`;
90
125
  declare const defaultParams: CompilerParams;
91
126
 
92
127
  declare const _default: {
package/build/index.mjs CHANGED
@@ -25,7 +25,7 @@ import { createUnplugin } from "unplugin";
25
25
  // package.json
26
26
  var package_default = {
27
27
  name: "@lingo.dev/_compiler",
28
- version: "0.5.4",
28
+ version: "0.6.0",
29
29
  description: "Lingo.dev Compiler",
30
30
  private: false,
31
31
  publishConfig: {
@@ -69,6 +69,7 @@ var package_default = {
69
69
  "@babel/traverse": "^7.27.4",
70
70
  "@babel/types": "^7.26.7",
71
71
  "@lingo.dev/_sdk": "workspace:*",
72
+ "@lingo.dev/_spec": "workspace:*",
72
73
  "@openrouter/ai-sdk-provider": "^0.7.1",
73
74
  "@prettier/sync": "^0.6.1",
74
75
  ai: "^4.2.10",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingo.dev/_compiler",
3
- "version": "0.5.4",
3
+ "version": "0.6.0",
4
4
  "description": "Lingo.dev Compiler",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -52,7 +52,8 @@
52
52
  "zod": "^3.24.1",
53
53
  "posthog-node": "^4.17.0",
54
54
  "node-machine-id": "^1.1.12",
55
- "@lingo.dev/_sdk": "0.9.6"
55
+ "@lingo.dev/_sdk": "0.10.0",
56
+ "@lingo.dev/_spec": "0.39.1"
56
57
  },
57
58
  "scripts": {
58
59
  "dev": "tsup --watch",