@lingo.dev/_compiler 0.4.0 → 0.5.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/{chunk-OO4SG7IH.cjs → chunk-5H7RCOY5.cjs} +49 -5
- package/build/{chunk-YT6JFNHK.mjs → chunk-X534EYJZ.mjs} +48 -4
- package/build/index.cjs +37 -23
- package/build/index.mjs +19 -5
- package/build/lingo-turbopack-loader.cjs +3 -3
- package/build/lingo-turbopack-loader.mjs +1 -1
- package/package.json +4 -2
|
@@ -301,6 +301,15 @@ function getOpenRouterKeyFromRc() {
|
|
|
301
301
|
function getOpenRouterKeyFromEnv() {
|
|
302
302
|
return getKeyFromEnv("OPENROUTER_API_KEY");
|
|
303
303
|
}
|
|
304
|
+
function getMistralKey() {
|
|
305
|
+
return getMistralKeyFromEnv() || getMistralKeyFromRc();
|
|
306
|
+
}
|
|
307
|
+
function getMistralKeyFromRc() {
|
|
308
|
+
return getKeyFromRc("llm.mistralApiKey");
|
|
309
|
+
}
|
|
310
|
+
function getMistralKeyFromEnv() {
|
|
311
|
+
return getKeyFromEnv("MISTRAL_API_KEY");
|
|
312
|
+
}
|
|
304
313
|
|
|
305
314
|
// src/utils/env.ts
|
|
306
315
|
|
|
@@ -339,6 +348,13 @@ var providerDetails = {
|
|
|
339
348
|
// Ollama doesn't require an API key
|
|
340
349
|
getKeyLink: "https://ollama.com/download",
|
|
341
350
|
docsLink: "https://github.com/ollama/ollama/tree/main/docs"
|
|
351
|
+
},
|
|
352
|
+
mistral: {
|
|
353
|
+
name: "Mistral",
|
|
354
|
+
apiKeyEnvVar: "MISTRAL_API_KEY",
|
|
355
|
+
apiKeyConfigKey: "llm.mistralApiKey",
|
|
356
|
+
getKeyLink: "https://console.mistral.ai",
|
|
357
|
+
docsLink: "https://docs.mistral.ai"
|
|
342
358
|
}
|
|
343
359
|
};
|
|
344
360
|
|
|
@@ -995,7 +1011,7 @@ var LCP = class _LCP {
|
|
|
995
1011
|
return { ...this.data, files };
|
|
996
1012
|
}
|
|
997
1013
|
toString() {
|
|
998
|
-
return JSON.stringify(this.toJSON(), null, 2);
|
|
1014
|
+
return JSON.stringify(this.toJSON(), null, 2) + "\n";
|
|
999
1015
|
}
|
|
1000
1016
|
save() {
|
|
1001
1017
|
const hasChanges = !fs4.existsSync(this.filePath) || fs4.readFileSync(this.filePath, "utf8") !== this.toString();
|
|
@@ -1704,6 +1720,7 @@ var _groq = require('@ai-sdk/groq');
|
|
|
1704
1720
|
var _google = require('@ai-sdk/google');
|
|
1705
1721
|
var _aisdkprovider = require('@openrouter/ai-sdk-provider');
|
|
1706
1722
|
var _ollamaaiprovider = require('ollama-ai-provider');
|
|
1723
|
+
var _mistral = require('@ai-sdk/mistral');
|
|
1707
1724
|
var _ai = require('ai');
|
|
1708
1725
|
var __sdk = require('@lingo.dev/_sdk');
|
|
1709
1726
|
|
|
@@ -2165,9 +2182,27 @@ var LCPAPI = class {
|
|
|
2165
2182
|
);
|
|
2166
2183
|
return _ollamaaiprovider.createOllama.call(void 0, )(modelId);
|
|
2167
2184
|
}
|
|
2185
|
+
case "mistral": {
|
|
2186
|
+
if (isRunningInCIOrDocker()) {
|
|
2187
|
+
const mistralFromEnv = getMistralKeyFromEnv();
|
|
2188
|
+
if (!mistralFromEnv) {
|
|
2189
|
+
this._failMissingLLMKeyCi(providerId);
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
const mistralKey = getMistralKey();
|
|
2193
|
+
if (!mistralKey) {
|
|
2194
|
+
throw new Error(
|
|
2195
|
+
"\u26A0\uFE0F Mistral API key not found. Please set MISTRAL_API_KEY environment variable or configure it user-wide."
|
|
2196
|
+
);
|
|
2197
|
+
}
|
|
2198
|
+
console.log(
|
|
2199
|
+
`Creating Mistral client for ${targetLocale} using model ${modelId}`
|
|
2200
|
+
);
|
|
2201
|
+
return _mistral.createMistral.call(void 0, { apiKey: mistralKey })(modelId);
|
|
2202
|
+
}
|
|
2168
2203
|
default: {
|
|
2169
2204
|
throw new Error(
|
|
2170
|
-
`\u26A0\uFE0F Provider "${providerId}" for locale "${targetLocale}" is not supported. Only "groq" and "
|
|
2205
|
+
`\u26A0\uFE0F Provider "${providerId}" for locale "${targetLocale}" is not supported. Only "groq", "google", "openrouter", "ollama", and "mistral" providers are supported at the moment.`
|
|
2171
2206
|
);
|
|
2172
2207
|
}
|
|
2173
2208
|
}
|
|
@@ -2573,9 +2608,16 @@ function parseParametrizedModuleId(rawId) {
|
|
|
2573
2608
|
|
|
2574
2609
|
// src/_loader-utils.ts
|
|
2575
2610
|
async function loadDictionary(options) {
|
|
2576
|
-
const {
|
|
2611
|
+
const {
|
|
2612
|
+
resourcePath,
|
|
2613
|
+
resourceQuery = "",
|
|
2614
|
+
params,
|
|
2615
|
+
sourceRoot,
|
|
2616
|
+
lingoDir,
|
|
2617
|
+
isDev
|
|
2618
|
+
} = options;
|
|
2577
2619
|
const fullResourcePath = `${resourcePath}${resourceQuery}`;
|
|
2578
|
-
if (!resourcePath.
|
|
2620
|
+
if (!resourcePath.match(LCP_DICTIONARY_FILE_NAME)) {
|
|
2579
2621
|
return null;
|
|
2580
2622
|
}
|
|
2581
2623
|
const moduleInfo = parseParametrizedModuleId(fullResourcePath);
|
|
@@ -2646,4 +2688,6 @@ function transformComponent(options) {
|
|
|
2646
2688
|
|
|
2647
2689
|
|
|
2648
2690
|
|
|
2649
|
-
|
|
2691
|
+
|
|
2692
|
+
|
|
2693
|
+
exports.__require = __require; exports.defaultParams = defaultParams; exports.LCP_DICTIONARY_FILE_NAME = LCP_DICTIONARY_FILE_NAME; exports.LCPCache = LCPCache; exports.getInvalidLocales = getInvalidLocales; exports.getGroqKeyFromRc = getGroqKeyFromRc; exports.getGroqKeyFromEnv = getGroqKeyFromEnv; exports.getLingoDotDevKeyFromEnv = getLingoDotDevKeyFromEnv; exports.getLingoDotDevKeyFromRc = getLingoDotDevKeyFromRc; exports.getGoogleKeyFromRc = getGoogleKeyFromRc; exports.getGoogleKeyFromEnv = getGoogleKeyFromEnv; exports.getMistralKeyFromRc = getMistralKeyFromRc; exports.getMistralKeyFromEnv = getMistralKeyFromEnv; exports.isRunningInCIOrDocker = isRunningInCIOrDocker; exports.providerDetails = providerDetails; exports.loadDictionary = loadDictionary; exports.transformComponent = transformComponent;
|
|
@@ -301,6 +301,15 @@ function getOpenRouterKeyFromRc() {
|
|
|
301
301
|
function getOpenRouterKeyFromEnv() {
|
|
302
302
|
return getKeyFromEnv("OPENROUTER_API_KEY");
|
|
303
303
|
}
|
|
304
|
+
function getMistralKey() {
|
|
305
|
+
return getMistralKeyFromEnv() || getMistralKeyFromRc();
|
|
306
|
+
}
|
|
307
|
+
function getMistralKeyFromRc() {
|
|
308
|
+
return getKeyFromRc("llm.mistralApiKey");
|
|
309
|
+
}
|
|
310
|
+
function getMistralKeyFromEnv() {
|
|
311
|
+
return getKeyFromEnv("MISTRAL_API_KEY");
|
|
312
|
+
}
|
|
304
313
|
|
|
305
314
|
// src/utils/env.ts
|
|
306
315
|
import fs3 from "fs";
|
|
@@ -339,6 +348,13 @@ var providerDetails = {
|
|
|
339
348
|
// Ollama doesn't require an API key
|
|
340
349
|
getKeyLink: "https://ollama.com/download",
|
|
341
350
|
docsLink: "https://github.com/ollama/ollama/tree/main/docs"
|
|
351
|
+
},
|
|
352
|
+
mistral: {
|
|
353
|
+
name: "Mistral",
|
|
354
|
+
apiKeyEnvVar: "MISTRAL_API_KEY",
|
|
355
|
+
apiKeyConfigKey: "llm.mistralApiKey",
|
|
356
|
+
getKeyLink: "https://console.mistral.ai",
|
|
357
|
+
docsLink: "https://docs.mistral.ai"
|
|
342
358
|
}
|
|
343
359
|
};
|
|
344
360
|
|
|
@@ -995,7 +1011,7 @@ var LCP = class _LCP {
|
|
|
995
1011
|
return { ...this.data, files };
|
|
996
1012
|
}
|
|
997
1013
|
toString() {
|
|
998
|
-
return JSON.stringify(this.toJSON(), null, 2);
|
|
1014
|
+
return JSON.stringify(this.toJSON(), null, 2) + "\n";
|
|
999
1015
|
}
|
|
1000
1016
|
save() {
|
|
1001
1017
|
const hasChanges = !fs4.existsSync(this.filePath) || fs4.readFileSync(this.filePath, "utf8") !== this.toString();
|
|
@@ -1704,6 +1720,7 @@ import { createGroq } from "@ai-sdk/groq";
|
|
|
1704
1720
|
import { createGoogleGenerativeAI } from "@ai-sdk/google";
|
|
1705
1721
|
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
|
|
1706
1722
|
import { createOllama } from "ollama-ai-provider";
|
|
1723
|
+
import { createMistral } from "@ai-sdk/mistral";
|
|
1707
1724
|
import { generateText } from "ai";
|
|
1708
1725
|
import { LingoDotDevEngine } from "@lingo.dev/_sdk";
|
|
1709
1726
|
import _9 from "lodash";
|
|
@@ -2165,9 +2182,27 @@ var LCPAPI = class {
|
|
|
2165
2182
|
);
|
|
2166
2183
|
return createOllama()(modelId);
|
|
2167
2184
|
}
|
|
2185
|
+
case "mistral": {
|
|
2186
|
+
if (isRunningInCIOrDocker()) {
|
|
2187
|
+
const mistralFromEnv = getMistralKeyFromEnv();
|
|
2188
|
+
if (!mistralFromEnv) {
|
|
2189
|
+
this._failMissingLLMKeyCi(providerId);
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
const mistralKey = getMistralKey();
|
|
2193
|
+
if (!mistralKey) {
|
|
2194
|
+
throw new Error(
|
|
2195
|
+
"\u26A0\uFE0F Mistral API key not found. Please set MISTRAL_API_KEY environment variable or configure it user-wide."
|
|
2196
|
+
);
|
|
2197
|
+
}
|
|
2198
|
+
console.log(
|
|
2199
|
+
`Creating Mistral client for ${targetLocale} using model ${modelId}`
|
|
2200
|
+
);
|
|
2201
|
+
return createMistral({ apiKey: mistralKey })(modelId);
|
|
2202
|
+
}
|
|
2168
2203
|
default: {
|
|
2169
2204
|
throw new Error(
|
|
2170
|
-
`\u26A0\uFE0F Provider "${providerId}" for locale "${targetLocale}" is not supported. Only "groq" and "
|
|
2205
|
+
`\u26A0\uFE0F Provider "${providerId}" for locale "${targetLocale}" is not supported. Only "groq", "google", "openrouter", "ollama", and "mistral" providers are supported at the moment.`
|
|
2171
2206
|
);
|
|
2172
2207
|
}
|
|
2173
2208
|
}
|
|
@@ -2573,9 +2608,16 @@ function parseParametrizedModuleId(rawId) {
|
|
|
2573
2608
|
|
|
2574
2609
|
// src/_loader-utils.ts
|
|
2575
2610
|
async function loadDictionary(options) {
|
|
2576
|
-
const {
|
|
2611
|
+
const {
|
|
2612
|
+
resourcePath,
|
|
2613
|
+
resourceQuery = "",
|
|
2614
|
+
params,
|
|
2615
|
+
sourceRoot,
|
|
2616
|
+
lingoDir,
|
|
2617
|
+
isDev
|
|
2618
|
+
} = options;
|
|
2577
2619
|
const fullResourcePath = `${resourcePath}${resourceQuery}`;
|
|
2578
|
-
if (!resourcePath.
|
|
2620
|
+
if (!resourcePath.match(LCP_DICTIONARY_FILE_NAME)) {
|
|
2579
2621
|
return null;
|
|
2580
2622
|
}
|
|
2581
2623
|
const moduleInfo = parseParametrizedModuleId(fullResourcePath);
|
|
@@ -2642,6 +2684,8 @@ export {
|
|
|
2642
2684
|
getLingoDotDevKeyFromRc,
|
|
2643
2685
|
getGoogleKeyFromRc,
|
|
2644
2686
|
getGoogleKeyFromEnv,
|
|
2687
|
+
getMistralKeyFromRc,
|
|
2688
|
+
getMistralKeyFromEnv,
|
|
2645
2689
|
isRunningInCIOrDocker,
|
|
2646
2690
|
providerDetails,
|
|
2647
2691
|
loadDictionary,
|
package/build/index.cjs
CHANGED
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunk5H7RCOY5cjs = require('./chunk-5H7RCOY5.cjs');
|
|
18
20
|
|
|
19
21
|
// src/index.ts
|
|
20
22
|
var _unplugin = require('unplugin');
|
|
@@ -22,7 +24,7 @@ var _unplugin = require('unplugin');
|
|
|
22
24
|
// package.json
|
|
23
25
|
var package_default = {
|
|
24
26
|
name: "@lingo.dev/_compiler",
|
|
25
|
-
version: "0.
|
|
27
|
+
version: "0.5.0",
|
|
26
28
|
description: "Lingo.dev Compiler",
|
|
27
29
|
private: false,
|
|
28
30
|
publishConfig: {
|
|
@@ -60,12 +62,14 @@ var package_default = {
|
|
|
60
62
|
dependencies: {
|
|
61
63
|
"@ai-sdk/google": "^1.2.19",
|
|
62
64
|
"@ai-sdk/groq": "^1.2.3",
|
|
65
|
+
"@ai-sdk/mistral": "^1.2.8",
|
|
63
66
|
"@babel/generator": "^7.26.5",
|
|
64
67
|
"@babel/parser": "^7.26.7",
|
|
65
68
|
"@babel/traverse": "^7.27.4",
|
|
66
69
|
"@babel/types": "^7.26.7",
|
|
67
70
|
"@lingo.dev/_sdk": "workspace:*",
|
|
68
71
|
"@openrouter/ai-sdk-provider": "^0.7.1",
|
|
72
|
+
"@prettier/sync": "^0.6.1",
|
|
69
73
|
ai: "^4.2.10",
|
|
70
74
|
dedent: "^1.6.0",
|
|
71
75
|
dotenv: "^16.4.5",
|
|
@@ -87,29 +91,33 @@ var _lodash = require('lodash'); var _lodash2 = _interopRequireDefault(_lodash);
|
|
|
87
91
|
var _dedent = require('dedent'); var _dedent2 = _interopRequireDefault(_dedent);
|
|
88
92
|
var keyCheckers = {
|
|
89
93
|
groq: {
|
|
90
|
-
checkEnv:
|
|
91
|
-
checkRc:
|
|
94
|
+
checkEnv: _chunk5H7RCOY5cjs.getGroqKeyFromEnv,
|
|
95
|
+
checkRc: _chunk5H7RCOY5cjs.getGroqKeyFromRc
|
|
92
96
|
},
|
|
93
97
|
google: {
|
|
94
|
-
checkEnv:
|
|
95
|
-
checkRc:
|
|
98
|
+
checkEnv: _chunk5H7RCOY5cjs.getGoogleKeyFromEnv,
|
|
99
|
+
checkRc: _chunk5H7RCOY5cjs.getGoogleKeyFromRc
|
|
100
|
+
},
|
|
101
|
+
mistral: {
|
|
102
|
+
checkEnv: _chunk5H7RCOY5cjs.getMistralKeyFromEnv,
|
|
103
|
+
checkRc: _chunk5H7RCOY5cjs.getMistralKeyFromRc
|
|
96
104
|
},
|
|
97
105
|
"lingo.dev": {
|
|
98
|
-
checkEnv:
|
|
99
|
-
checkRc:
|
|
106
|
+
checkEnv: _chunk5H7RCOY5cjs.getLingoDotDevKeyFromEnv,
|
|
107
|
+
checkRc: _chunk5H7RCOY5cjs.getLingoDotDevKeyFromRc
|
|
100
108
|
}
|
|
101
109
|
};
|
|
102
110
|
var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
103
111
|
(_params, _meta) => {
|
|
104
112
|
console.log("\u2139\uFE0F Starting Lingo.dev compiler...");
|
|
105
|
-
const params = _lodash2.default.defaults(_params,
|
|
106
|
-
if (!
|
|
113
|
+
const params = _lodash2.default.defaults(_params, _chunk5H7RCOY5cjs.defaultParams);
|
|
114
|
+
if (!_chunk5H7RCOY5cjs.isRunningInCIOrDocker.call(void 0, )) {
|
|
107
115
|
if (params.models === "lingo.dev") {
|
|
108
116
|
validateLLMKeyDetails(["lingo.dev"]);
|
|
109
117
|
} else {
|
|
110
118
|
const configuredProviders = getConfiguredProviders(params.models);
|
|
111
119
|
validateLLMKeyDetails(configuredProviders);
|
|
112
|
-
const invalidLocales =
|
|
120
|
+
const invalidLocales = _chunk5H7RCOY5cjs.getInvalidLocales.call(void 0,
|
|
113
121
|
params.models,
|
|
114
122
|
params.sourceLocale,
|
|
115
123
|
params.targetLocales
|
|
@@ -117,7 +125,9 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
|
117
125
|
if (invalidLocales.length > 0) {
|
|
118
126
|
console.log(_dedent2.default`
|
|
119
127
|
\n
|
|
120
|
-
⚠️ Lingo.dev Localization Compiler requires LLM model setup for the following locales: ${invalidLocales.join(
|
|
128
|
+
⚠️ Lingo.dev Localization Compiler requires LLM model setup for the following locales: ${invalidLocales.join(
|
|
129
|
+
", "
|
|
130
|
+
)}.
|
|
121
131
|
|
|
122
132
|
⭐️ Next steps:
|
|
123
133
|
1. Refer to documentation for help: https://lingo.dev/compiler
|
|
@@ -130,16 +140,16 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
|
130
140
|
}
|
|
131
141
|
}
|
|
132
142
|
}
|
|
133
|
-
|
|
143
|
+
_chunk5H7RCOY5cjs.LCPCache.ensureDictionaryFile({
|
|
134
144
|
sourceRoot: params.sourceRoot,
|
|
135
145
|
lingoDir: params.lingoDir
|
|
136
146
|
});
|
|
137
147
|
const isDev = "dev" in _meta ? !!_meta.dev : process.env.NODE_ENV !== "production";
|
|
138
148
|
return {
|
|
139
149
|
name: package_default.name,
|
|
140
|
-
loadInclude: (id) => !!id.match(
|
|
150
|
+
loadInclude: (id) => !!id.match(_chunk5H7RCOY5cjs.LCP_DICTIONARY_FILE_NAME),
|
|
141
151
|
async load(id) {
|
|
142
|
-
const dictionary = await
|
|
152
|
+
const dictionary = await _chunk5H7RCOY5cjs.loadDictionary.call(void 0, {
|
|
143
153
|
resourcePath: id,
|
|
144
154
|
resourceQuery: "",
|
|
145
155
|
params: {
|
|
@@ -164,7 +174,7 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
|
164
174
|
enforce: "pre",
|
|
165
175
|
transform(code, id) {
|
|
166
176
|
try {
|
|
167
|
-
const result =
|
|
177
|
+
const result = _chunk5H7RCOY5cjs.transformComponent.call(void 0, {
|
|
168
178
|
code,
|
|
169
179
|
params,
|
|
170
180
|
resourcePath: id,
|
|
@@ -184,7 +194,7 @@ var src_default = {
|
|
|
184
194
|
next: (compilerParams) => (nextConfig = {}) => {
|
|
185
195
|
const mergedParams = _lodash2.default.merge(
|
|
186
196
|
{},
|
|
187
|
-
|
|
197
|
+
_chunk5H7RCOY5cjs.defaultParams,
|
|
188
198
|
{
|
|
189
199
|
rsc: true,
|
|
190
200
|
turbopack: {
|
|
@@ -233,7 +243,7 @@ var src_default = {
|
|
|
233
243
|
turbopackConfigPath.rules ??= {};
|
|
234
244
|
const rules = turbopackConfigPath.rules;
|
|
235
245
|
const lingoGlob = `**/*.{ts,tsx,js,jsx}`;
|
|
236
|
-
const lingoLoaderPath =
|
|
246
|
+
const lingoLoaderPath = _chunk5H7RCOY5cjs.__require.resolve("./lingo-turbopack-loader");
|
|
237
247
|
rules[lingoGlob] = {
|
|
238
248
|
loaders: [
|
|
239
249
|
{
|
|
@@ -247,14 +257,14 @@ var src_default = {
|
|
|
247
257
|
},
|
|
248
258
|
vite: (compilerParams) => (config) => {
|
|
249
259
|
config.plugins.unshift(
|
|
250
|
-
unplugin.vite(_lodash2.default.merge({},
|
|
260
|
+
unplugin.vite(_lodash2.default.merge({}, _chunk5H7RCOY5cjs.defaultParams, { rsc: false }, compilerParams))
|
|
251
261
|
);
|
|
252
262
|
return config;
|
|
253
263
|
}
|
|
254
264
|
};
|
|
255
265
|
function getConfiguredProviders(models) {
|
|
256
266
|
return _lodash2.default.chain(Object.values(models)).map((modelString) => modelString.split(":")[0]).filter(Boolean).uniq().filter(
|
|
257
|
-
(providerId) =>
|
|
267
|
+
(providerId) => _chunk5H7RCOY5cjs.providerDetails.hasOwnProperty(providerId) && keyCheckers.hasOwnProperty(providerId)
|
|
258
268
|
).value();
|
|
259
269
|
}
|
|
260
270
|
function validateLLMKeyDetails(configuredProviders) {
|
|
@@ -265,7 +275,7 @@ function validateLLMKeyDetails(configuredProviders) {
|
|
|
265
275
|
const missingProviders = [];
|
|
266
276
|
const foundProviders = [];
|
|
267
277
|
for (const providerId of configuredProviders) {
|
|
268
|
-
const details =
|
|
278
|
+
const details = _chunk5H7RCOY5cjs.providerDetails[providerId];
|
|
269
279
|
const checkers = keyCheckers[providerId];
|
|
270
280
|
if (!details || !checkers) continue;
|
|
271
281
|
const foundInEnv = !!checkers.checkEnv();
|
|
@@ -280,7 +290,9 @@ function validateLLMKeyDetails(configuredProviders) {
|
|
|
280
290
|
if (missingProviders.length > 0) {
|
|
281
291
|
console.log(_dedent2.default`
|
|
282
292
|
\n
|
|
283
|
-
💡 Lingo.dev Localization Compiler is configured to use the following LLM provider(s): ${configuredProviders.join(
|
|
293
|
+
💡 Lingo.dev Localization Compiler is configured to use the following LLM provider(s): ${configuredProviders.join(
|
|
294
|
+
", "
|
|
295
|
+
)}.
|
|
284
296
|
|
|
285
297
|
The compiler requires API keys for these providers to work, but the following keys are missing:
|
|
286
298
|
`);
|
|
@@ -311,7 +323,9 @@ function validateLLMKeyDetails(configuredProviders) {
|
|
|
311
323
|
} else if (foundProviders.length > 0) {
|
|
312
324
|
console.log(_dedent2.default`
|
|
313
325
|
\n
|
|
314
|
-
🔑 LLM API keys detected for configured providers: ${foundProviders.join(
|
|
326
|
+
🔑 LLM API keys detected for configured providers: ${foundProviders.join(
|
|
327
|
+
", "
|
|
328
|
+
)}.
|
|
315
329
|
`);
|
|
316
330
|
for (const providerId of foundProviders) {
|
|
317
331
|
const status = keyStatuses[providerId];
|
package/build/index.mjs
CHANGED
|
@@ -10,11 +10,13 @@ import {
|
|
|
10
10
|
getInvalidLocales,
|
|
11
11
|
getLingoDotDevKeyFromEnv,
|
|
12
12
|
getLingoDotDevKeyFromRc,
|
|
13
|
+
getMistralKeyFromEnv,
|
|
14
|
+
getMistralKeyFromRc,
|
|
13
15
|
isRunningInCIOrDocker,
|
|
14
16
|
loadDictionary,
|
|
15
17
|
providerDetails,
|
|
16
18
|
transformComponent
|
|
17
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-X534EYJZ.mjs";
|
|
18
20
|
|
|
19
21
|
// src/index.ts
|
|
20
22
|
import { createUnplugin } from "unplugin";
|
|
@@ -22,7 +24,7 @@ import { createUnplugin } from "unplugin";
|
|
|
22
24
|
// package.json
|
|
23
25
|
var package_default = {
|
|
24
26
|
name: "@lingo.dev/_compiler",
|
|
25
|
-
version: "0.
|
|
27
|
+
version: "0.5.0",
|
|
26
28
|
description: "Lingo.dev Compiler",
|
|
27
29
|
private: false,
|
|
28
30
|
publishConfig: {
|
|
@@ -60,12 +62,14 @@ var package_default = {
|
|
|
60
62
|
dependencies: {
|
|
61
63
|
"@ai-sdk/google": "^1.2.19",
|
|
62
64
|
"@ai-sdk/groq": "^1.2.3",
|
|
65
|
+
"@ai-sdk/mistral": "^1.2.8",
|
|
63
66
|
"@babel/generator": "^7.26.5",
|
|
64
67
|
"@babel/parser": "^7.26.7",
|
|
65
68
|
"@babel/traverse": "^7.27.4",
|
|
66
69
|
"@babel/types": "^7.26.7",
|
|
67
70
|
"@lingo.dev/_sdk": "workspace:*",
|
|
68
71
|
"@openrouter/ai-sdk-provider": "^0.7.1",
|
|
72
|
+
"@prettier/sync": "^0.6.1",
|
|
69
73
|
ai: "^4.2.10",
|
|
70
74
|
dedent: "^1.6.0",
|
|
71
75
|
dotenv: "^16.4.5",
|
|
@@ -94,6 +98,10 @@ var keyCheckers = {
|
|
|
94
98
|
checkEnv: getGoogleKeyFromEnv,
|
|
95
99
|
checkRc: getGoogleKeyFromRc
|
|
96
100
|
},
|
|
101
|
+
mistral: {
|
|
102
|
+
checkEnv: getMistralKeyFromEnv,
|
|
103
|
+
checkRc: getMistralKeyFromRc
|
|
104
|
+
},
|
|
97
105
|
"lingo.dev": {
|
|
98
106
|
checkEnv: getLingoDotDevKeyFromEnv,
|
|
99
107
|
checkRc: getLingoDotDevKeyFromRc
|
|
@@ -117,7 +125,9 @@ var unplugin = createUnplugin(
|
|
|
117
125
|
if (invalidLocales.length > 0) {
|
|
118
126
|
console.log(dedent`
|
|
119
127
|
\n
|
|
120
|
-
⚠️ Lingo.dev Localization Compiler requires LLM model setup for the following locales: ${invalidLocales.join(
|
|
128
|
+
⚠️ Lingo.dev Localization Compiler requires LLM model setup for the following locales: ${invalidLocales.join(
|
|
129
|
+
", "
|
|
130
|
+
)}.
|
|
121
131
|
|
|
122
132
|
⭐️ Next steps:
|
|
123
133
|
1. Refer to documentation for help: https://lingo.dev/compiler
|
|
@@ -280,7 +290,9 @@ function validateLLMKeyDetails(configuredProviders) {
|
|
|
280
290
|
if (missingProviders.length > 0) {
|
|
281
291
|
console.log(dedent`
|
|
282
292
|
\n
|
|
283
|
-
💡 Lingo.dev Localization Compiler is configured to use the following LLM provider(s): ${configuredProviders.join(
|
|
293
|
+
💡 Lingo.dev Localization Compiler is configured to use the following LLM provider(s): ${configuredProviders.join(
|
|
294
|
+
", "
|
|
295
|
+
)}.
|
|
284
296
|
|
|
285
297
|
The compiler requires API keys for these providers to work, but the following keys are missing:
|
|
286
298
|
`);
|
|
@@ -311,7 +323,9 @@ function validateLLMKeyDetails(configuredProviders) {
|
|
|
311
323
|
} else if (foundProviders.length > 0) {
|
|
312
324
|
console.log(dedent`
|
|
313
325
|
\n
|
|
314
|
-
🔑 LLM API keys detected for configured providers: ${foundProviders.join(
|
|
326
|
+
🔑 LLM API keys detected for configured providers: ${foundProviders.join(
|
|
327
|
+
", "
|
|
328
|
+
)}.
|
|
315
329
|
`);
|
|
316
330
|
for (const providerId of foundProviders) {
|
|
317
331
|
const status = keyStatuses[providerId];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk5H7RCOY5cjs = require('./chunk-5H7RCOY5.cjs');
|
|
5
5
|
|
|
6
6
|
// src/lingo-turbopack-loader.ts
|
|
7
7
|
async function lingo_turbopack_loader_default(source) {
|
|
@@ -9,7 +9,7 @@ async function lingo_turbopack_loader_default(source) {
|
|
|
9
9
|
const params = this.getOptions();
|
|
10
10
|
const isDev = process.env.NODE_ENV !== "production";
|
|
11
11
|
try {
|
|
12
|
-
const dictionary = await
|
|
12
|
+
const dictionary = await _chunk5H7RCOY5cjs.loadDictionary.call(void 0, {
|
|
13
13
|
resourcePath: this.resourcePath,
|
|
14
14
|
resourceQuery: this.resourceQuery,
|
|
15
15
|
params,
|
|
@@ -21,7 +21,7 @@ async function lingo_turbopack_loader_default(source) {
|
|
|
21
21
|
const code = `export default ${JSON.stringify(dictionary, null, 2)};`;
|
|
22
22
|
return callback(null, code);
|
|
23
23
|
}
|
|
24
|
-
const result =
|
|
24
|
+
const result = _chunk5H7RCOY5cjs.transformComponent.call(void 0, {
|
|
25
25
|
code: source,
|
|
26
26
|
params,
|
|
27
27
|
resourcePath: this.resourcePath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingo.dev/_compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Lingo.dev Compiler",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -31,11 +31,13 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@ai-sdk/google": "^1.2.19",
|
|
33
33
|
"@ai-sdk/groq": "^1.2.3",
|
|
34
|
+
"@ai-sdk/mistral": "^1.2.8",
|
|
34
35
|
"@babel/generator": "^7.26.5",
|
|
35
36
|
"@babel/parser": "^7.26.7",
|
|
36
37
|
"@babel/traverse": "^7.27.4",
|
|
37
38
|
"@babel/types": "^7.26.7",
|
|
38
39
|
"@openrouter/ai-sdk-provider": "^0.7.1",
|
|
40
|
+
"@prettier/sync": "^0.6.1",
|
|
39
41
|
"ai": "^4.2.10",
|
|
40
42
|
"dedent": "^1.6.0",
|
|
41
43
|
"dotenv": "^16.4.5",
|
|
@@ -48,7 +50,7 @@
|
|
|
48
50
|
"unplugin": "^2.1.2",
|
|
49
51
|
"vitest": "^2.1.4",
|
|
50
52
|
"zod": "^3.24.1",
|
|
51
|
-
"@lingo.dev/_sdk": "0.9.
|
|
53
|
+
"@lingo.dev/_sdk": "0.9.4"
|
|
52
54
|
},
|
|
53
55
|
"scripts": {
|
|
54
56
|
"dev": "tsup --watch",
|