@lingo.dev/_compiler 0.5.3 → 0.5.4
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-23GDRLDY.cjs → chunk-PO4OCL2U.cjs} +13 -6
- package/build/{chunk-S326ZU7C.mjs → chunk-ZXNG22MO.mjs} +13 -6
- package/build/index.cjs +23 -23
- package/build/index.d.cts +77 -0
- package/build/index.d.ts +77 -0
- package/build/index.mjs +2 -2
- package/build/lingo-turbopack-loader.cjs +3 -3
- package/build/lingo-turbopack-loader.mjs +1 -1
- package/package.json +1 -1
|
@@ -53,7 +53,8 @@ var defaultParams = {
|
|
|
53
53
|
rsc: false,
|
|
54
54
|
useDirective: false,
|
|
55
55
|
debug: false,
|
|
56
|
-
models: {}
|
|
56
|
+
models: {},
|
|
57
|
+
prompt: null
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
// src/_const.ts
|
|
@@ -1927,7 +1928,7 @@ var shots_default = [
|
|
|
1927
1928
|
// src/lib/lcp/api/index.ts
|
|
1928
1929
|
|
|
1929
1930
|
var LCPAPI = class {
|
|
1930
|
-
static async translate(models, sourceDictionary, sourceLocale, targetLocale) {
|
|
1931
|
+
static async translate(models, sourceDictionary, sourceLocale, targetLocale, prompt) {
|
|
1931
1932
|
const timeLabel = `LCPAPI.translate: ${targetLocale}`;
|
|
1932
1933
|
console.time(timeLabel);
|
|
1933
1934
|
const chunks = this._chunkDictionary(sourceDictionary);
|
|
@@ -1937,7 +1938,8 @@ var LCPAPI = class {
|
|
|
1937
1938
|
models,
|
|
1938
1939
|
chunk,
|
|
1939
1940
|
sourceLocale,
|
|
1940
|
-
targetLocale
|
|
1941
|
+
targetLocale,
|
|
1942
|
+
prompt
|
|
1941
1943
|
);
|
|
1942
1944
|
translatedChunks.push(translatedChunk);
|
|
1943
1945
|
}
|
|
@@ -2026,7 +2028,7 @@ var LCPAPI = class {
|
|
|
2026
2028
|
apiKey
|
|
2027
2029
|
});
|
|
2028
2030
|
}
|
|
2029
|
-
static async _translateChunk(models, sourceDictionary, sourceLocale, targetLocale) {
|
|
2031
|
+
static async _translateChunk(models, sourceDictionary, sourceLocale, targetLocale, prompt) {
|
|
2030
2032
|
if (models === "lingo.dev") {
|
|
2031
2033
|
try {
|
|
2032
2034
|
const lingoDotDevEngine = this._createLingoDotDevEngine();
|
|
@@ -2087,7 +2089,11 @@ var LCPAPI = class {
|
|
|
2087
2089
|
messages: [
|
|
2088
2090
|
{
|
|
2089
2091
|
role: "system",
|
|
2090
|
-
content: prompt_default({
|
|
2092
|
+
content: prompt_default({
|
|
2093
|
+
sourceLocale,
|
|
2094
|
+
targetLocale,
|
|
2095
|
+
prompt: _nullishCoalesce(prompt, () => ( void 0))
|
|
2096
|
+
})
|
|
2091
2097
|
},
|
|
2092
2098
|
...shots_default.flatMap((shotsTuple) => [
|
|
2093
2099
|
{
|
|
@@ -2390,7 +2396,8 @@ var LCPServer = (_class = class {
|
|
|
2390
2396
|
params.models,
|
|
2391
2397
|
uncachedSourceDictionary,
|
|
2392
2398
|
params.sourceLocale,
|
|
2393
|
-
params.targetLocale
|
|
2399
|
+
params.targetLocale,
|
|
2400
|
+
params.prompt
|
|
2394
2401
|
);
|
|
2395
2402
|
targetDictionary = this._mergeDictionaries(newTranslations, cache);
|
|
2396
2403
|
targetDictionary = {
|
|
@@ -53,7 +53,8 @@ var defaultParams = {
|
|
|
53
53
|
rsc: false,
|
|
54
54
|
useDirective: false,
|
|
55
55
|
debug: false,
|
|
56
|
-
models: {}
|
|
56
|
+
models: {},
|
|
57
|
+
prompt: null
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
// src/_const.ts
|
|
@@ -1927,7 +1928,7 @@ var shots_default = [
|
|
|
1927
1928
|
// src/lib/lcp/api/index.ts
|
|
1928
1929
|
import dedent2 from "dedent";
|
|
1929
1930
|
var LCPAPI = class {
|
|
1930
|
-
static async translate(models, sourceDictionary, sourceLocale, targetLocale) {
|
|
1931
|
+
static async translate(models, sourceDictionary, sourceLocale, targetLocale, prompt) {
|
|
1931
1932
|
const timeLabel = `LCPAPI.translate: ${targetLocale}`;
|
|
1932
1933
|
console.time(timeLabel);
|
|
1933
1934
|
const chunks = this._chunkDictionary(sourceDictionary);
|
|
@@ -1937,7 +1938,8 @@ var LCPAPI = class {
|
|
|
1937
1938
|
models,
|
|
1938
1939
|
chunk,
|
|
1939
1940
|
sourceLocale,
|
|
1940
|
-
targetLocale
|
|
1941
|
+
targetLocale,
|
|
1942
|
+
prompt
|
|
1941
1943
|
);
|
|
1942
1944
|
translatedChunks.push(translatedChunk);
|
|
1943
1945
|
}
|
|
@@ -2026,7 +2028,7 @@ var LCPAPI = class {
|
|
|
2026
2028
|
apiKey
|
|
2027
2029
|
});
|
|
2028
2030
|
}
|
|
2029
|
-
static async _translateChunk(models, sourceDictionary, sourceLocale, targetLocale) {
|
|
2031
|
+
static async _translateChunk(models, sourceDictionary, sourceLocale, targetLocale, prompt) {
|
|
2030
2032
|
if (models === "lingo.dev") {
|
|
2031
2033
|
try {
|
|
2032
2034
|
const lingoDotDevEngine = this._createLingoDotDevEngine();
|
|
@@ -2087,7 +2089,11 @@ var LCPAPI = class {
|
|
|
2087
2089
|
messages: [
|
|
2088
2090
|
{
|
|
2089
2091
|
role: "system",
|
|
2090
|
-
content: prompt_default({
|
|
2092
|
+
content: prompt_default({
|
|
2093
|
+
sourceLocale,
|
|
2094
|
+
targetLocale,
|
|
2095
|
+
prompt: prompt ?? void 0
|
|
2096
|
+
})
|
|
2091
2097
|
},
|
|
2092
2098
|
...shots_default.flatMap((shotsTuple) => [
|
|
2093
2099
|
{
|
|
@@ -2390,7 +2396,8 @@ var LCPServer = class {
|
|
|
2390
2396
|
params.models,
|
|
2391
2397
|
uncachedSourceDictionary,
|
|
2392
2398
|
params.sourceLocale,
|
|
2393
|
-
params.targetLocale
|
|
2399
|
+
params.targetLocale,
|
|
2400
|
+
params.prompt
|
|
2394
2401
|
);
|
|
2395
2402
|
targetDictionary = this._mergeDictionaries(newTranslations, cache);
|
|
2396
2403
|
targetDictionary = {
|
package/build/index.cjs
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkPO4OCL2Ucjs = require('./chunk-PO4OCL2U.cjs');
|
|
21
21
|
|
|
22
22
|
// src/index.ts
|
|
23
23
|
var _unplugin = require('unplugin');
|
|
@@ -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.
|
|
28
|
+
version: "0.5.4",
|
|
29
29
|
description: "Lingo.dev Compiler",
|
|
30
30
|
private: false,
|
|
31
31
|
publishConfig: {
|
|
@@ -130,7 +130,7 @@ async function trackEvent(event, properties) {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
async function getActualId() {
|
|
133
|
-
const rc =
|
|
133
|
+
const rc = _chunkPO4OCL2Ucjs.getRc.call(void 0, );
|
|
134
134
|
const apiKey = process.env.LINGODOTDEV_API_KEY || _optionalChain([rc, 'optionalAccess', _3 => _3.auth, 'optionalAccess', _4 => _4.apiKey]);
|
|
135
135
|
const apiUrl = process.env.LINGODOTDEV_API_URL || _optionalChain([rc, 'optionalAccess', _5 => _5.auth, 'optionalAccess', _6 => _6.apiUrl]) || "https://engine.lingo.dev";
|
|
136
136
|
if (apiKey) {
|
|
@@ -158,20 +158,20 @@ async function getActualId() {
|
|
|
158
158
|
// src/index.ts
|
|
159
159
|
var keyCheckers = {
|
|
160
160
|
groq: {
|
|
161
|
-
checkEnv:
|
|
162
|
-
checkRc:
|
|
161
|
+
checkEnv: _chunkPO4OCL2Ucjs.getGroqKeyFromEnv,
|
|
162
|
+
checkRc: _chunkPO4OCL2Ucjs.getGroqKeyFromRc
|
|
163
163
|
},
|
|
164
164
|
google: {
|
|
165
|
-
checkEnv:
|
|
166
|
-
checkRc:
|
|
165
|
+
checkEnv: _chunkPO4OCL2Ucjs.getGoogleKeyFromEnv,
|
|
166
|
+
checkRc: _chunkPO4OCL2Ucjs.getGoogleKeyFromRc
|
|
167
167
|
},
|
|
168
168
|
mistral: {
|
|
169
|
-
checkEnv:
|
|
170
|
-
checkRc:
|
|
169
|
+
checkEnv: _chunkPO4OCL2Ucjs.getMistralKeyFromEnv,
|
|
170
|
+
checkRc: _chunkPO4OCL2Ucjs.getMistralKeyFromRc
|
|
171
171
|
},
|
|
172
172
|
"lingo.dev": {
|
|
173
|
-
checkEnv:
|
|
174
|
-
checkRc:
|
|
173
|
+
checkEnv: _chunkPO4OCL2Ucjs.getLingoDotDevKeyFromEnv,
|
|
174
|
+
checkRc: _chunkPO4OCL2Ucjs.getLingoDotDevKeyFromRc
|
|
175
175
|
}
|
|
176
176
|
};
|
|
177
177
|
var alreadySentBuildEvent = { value: false };
|
|
@@ -187,14 +187,14 @@ function sendBuildEvent(framework, config, isDev) {
|
|
|
187
187
|
var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
188
188
|
(_params, _meta) => {
|
|
189
189
|
console.log("\u2139\uFE0F Starting Lingo.dev compiler...");
|
|
190
|
-
const params = _lodash2.default.defaults(_params,
|
|
191
|
-
if (!
|
|
190
|
+
const params = _lodash2.default.defaults(_params, _chunkPO4OCL2Ucjs.defaultParams);
|
|
191
|
+
if (!_chunkPO4OCL2Ucjs.isRunningInCIOrDocker.call(void 0, )) {
|
|
192
192
|
if (params.models === "lingo.dev") {
|
|
193
193
|
validateLLMKeyDetails(["lingo.dev"]);
|
|
194
194
|
} else {
|
|
195
195
|
const configuredProviders = getConfiguredProviders(params.models);
|
|
196
196
|
validateLLMKeyDetails(configuredProviders);
|
|
197
|
-
const invalidLocales =
|
|
197
|
+
const invalidLocales = _chunkPO4OCL2Ucjs.getInvalidLocales.call(void 0,
|
|
198
198
|
params.models,
|
|
199
199
|
params.sourceLocale,
|
|
200
200
|
params.targetLocales
|
|
@@ -217,7 +217,7 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
|
|
220
|
+
_chunkPO4OCL2Ucjs.LCPCache.ensureDictionaryFile({
|
|
221
221
|
sourceRoot: params.sourceRoot,
|
|
222
222
|
lingoDir: params.lingoDir
|
|
223
223
|
});
|
|
@@ -225,9 +225,9 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
|
225
225
|
sendBuildEvent("unplugin", params, isDev);
|
|
226
226
|
return {
|
|
227
227
|
name: package_default.name,
|
|
228
|
-
loadInclude: (id) => !!id.match(
|
|
228
|
+
loadInclude: (id) => !!id.match(_chunkPO4OCL2Ucjs.LCP_DICTIONARY_FILE_NAME),
|
|
229
229
|
async load(id) {
|
|
230
|
-
const dictionary = await
|
|
230
|
+
const dictionary = await _chunkPO4OCL2Ucjs.loadDictionary.call(void 0, {
|
|
231
231
|
resourcePath: id,
|
|
232
232
|
resourceQuery: "",
|
|
233
233
|
params: {
|
|
@@ -251,7 +251,7 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
|
251
251
|
enforce: "pre",
|
|
252
252
|
transform(code, id) {
|
|
253
253
|
try {
|
|
254
|
-
const result =
|
|
254
|
+
const result = _chunkPO4OCL2Ucjs.transformComponent.call(void 0, {
|
|
255
255
|
code,
|
|
256
256
|
params,
|
|
257
257
|
resourcePath: id,
|
|
@@ -271,7 +271,7 @@ var src_default = {
|
|
|
271
271
|
next: (compilerParams) => (nextConfig = {}) => {
|
|
272
272
|
const mergedParams = _lodash2.default.merge(
|
|
273
273
|
{},
|
|
274
|
-
|
|
274
|
+
_chunkPO4OCL2Ucjs.defaultParams,
|
|
275
275
|
{
|
|
276
276
|
rsc: true,
|
|
277
277
|
turbopack: {
|
|
@@ -322,7 +322,7 @@ var src_default = {
|
|
|
322
322
|
turbopackConfigPath.rules ??= {};
|
|
323
323
|
const rules = turbopackConfigPath.rules;
|
|
324
324
|
const lingoGlob = `**/*.{ts,tsx,js,jsx}`;
|
|
325
|
-
const lingoLoaderPath =
|
|
325
|
+
const lingoLoaderPath = _chunkPO4OCL2Ucjs.__require.resolve("./lingo-turbopack-loader");
|
|
326
326
|
rules[lingoGlob] = {
|
|
327
327
|
loaders: [
|
|
328
328
|
{
|
|
@@ -337,7 +337,7 @@ var src_default = {
|
|
|
337
337
|
vite: (compilerParams) => (config) => {
|
|
338
338
|
const mergedParams = _lodash2.default.merge(
|
|
339
339
|
{},
|
|
340
|
-
|
|
340
|
+
_chunkPO4OCL2Ucjs.defaultParams,
|
|
341
341
|
{ rsc: false },
|
|
342
342
|
compilerParams
|
|
343
343
|
);
|
|
@@ -351,7 +351,7 @@ var src_default = {
|
|
|
351
351
|
};
|
|
352
352
|
function getConfiguredProviders(models) {
|
|
353
353
|
return _lodash2.default.chain(Object.values(models)).map((modelString) => modelString.split(":")[0]).filter(Boolean).uniq().filter(
|
|
354
|
-
(providerId) =>
|
|
354
|
+
(providerId) => _chunkPO4OCL2Ucjs.providerDetails.hasOwnProperty(providerId) && keyCheckers.hasOwnProperty(providerId)
|
|
355
355
|
).value();
|
|
356
356
|
}
|
|
357
357
|
function validateLLMKeyDetails(configuredProviders) {
|
|
@@ -362,7 +362,7 @@ function validateLLMKeyDetails(configuredProviders) {
|
|
|
362
362
|
const missingProviders = [];
|
|
363
363
|
const foundProviders = [];
|
|
364
364
|
for (const providerId of configuredProviders) {
|
|
365
|
-
const details =
|
|
365
|
+
const details = _chunkPO4OCL2Ucjs.providerDetails[providerId];
|
|
366
366
|
const checkers = keyCheckers[providerId];
|
|
367
367
|
if (!details || !checkers) continue;
|
|
368
368
|
const foundInEnv = !!checkers.checkEnv();
|
package/build/index.d.cts
CHANGED
|
@@ -1,14 +1,91 @@
|
|
|
1
1
|
import { NextConfig } from 'next';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Options for configuring Lingo.dev Compiler.
|
|
5
|
+
*/
|
|
3
6
|
type CompilerParams = {
|
|
7
|
+
/**
|
|
8
|
+
* The locale to translate from.
|
|
9
|
+
*
|
|
10
|
+
* This must match one of the following formats:
|
|
11
|
+
*
|
|
12
|
+
* - [ISO 639-1 language code](https://en.wikipedia.org/wiki/ISO_639-1) (e.g., `"en"`)
|
|
13
|
+
* - [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) (e.g., `"en-US"`)
|
|
14
|
+
*
|
|
15
|
+
* @default "en"
|
|
16
|
+
*/
|
|
4
17
|
sourceLocale: string;
|
|
18
|
+
/**
|
|
19
|
+
* The locale(s) to translate to.
|
|
20
|
+
*
|
|
21
|
+
* Each locale must match one of the following formats:
|
|
22
|
+
*
|
|
23
|
+
* - [ISO 639-1 language code](https://en.wikipedia.org/wiki/ISO_639-1) (e.g., `"en"`)
|
|
24
|
+
* - [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) (e.g., `"en-US"`)
|
|
25
|
+
*
|
|
26
|
+
* @default ["es"]
|
|
27
|
+
*/
|
|
5
28
|
targetLocales: string[];
|
|
29
|
+
/**
|
|
30
|
+
* The name of the directory where translation files will be stored, relative to `sourceRoot`.
|
|
31
|
+
*
|
|
32
|
+
* @default "lingo"
|
|
33
|
+
*/
|
|
6
34
|
lingoDir: string;
|
|
35
|
+
/**
|
|
36
|
+
* The directory of the source code that will be translated, relative to the current working directory.
|
|
37
|
+
*
|
|
38
|
+
* @default "src"
|
|
39
|
+
*/
|
|
7
40
|
sourceRoot: string;
|
|
41
|
+
/**
|
|
42
|
+
* If `true`, the compiler will generate code for React Server Components (RSC).
|
|
43
|
+
*
|
|
44
|
+
* When using Vite, this value is always `false`.
|
|
45
|
+
*
|
|
46
|
+
* When using Next.js, this value is always `true`.
|
|
47
|
+
*
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
8
50
|
rsc: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* If `true`, the compiler will only localize files that use the `"use i18n";` directive.
|
|
53
|
+
*
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
9
56
|
useDirective: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* If `true`, the compiler will log additional information to the console.
|
|
59
|
+
*
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
10
62
|
debug: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* The model(s) to use for translation.
|
|
65
|
+
*
|
|
66
|
+
* If set to `"lingo.dev"`, the compiler will use Lingo.dev Engine.
|
|
67
|
+
*
|
|
68
|
+
* If set to an object, the compiler will use the model(s) specified in the object:
|
|
69
|
+
*
|
|
70
|
+
* - The key is a string that represents the source and target locales, separated by a colon (e.g., `"en:es"`).
|
|
71
|
+
* - The value is a string that represents the LLM provider and model, separated by a colon (e.g., `"google:gemini-2.0-flash"`).
|
|
72
|
+
*
|
|
73
|
+
* You can use `*` as a wildcard to match any locale.
|
|
74
|
+
*
|
|
75
|
+
* If a model is not specified, an error will be thrown.
|
|
76
|
+
*
|
|
77
|
+
* @default {}
|
|
78
|
+
*/
|
|
11
79
|
models: "lingo.dev" | Record<string, string>;
|
|
80
|
+
/**
|
|
81
|
+
* Custom system prompt for the translation engine. If set, this prompt will override the default system prompt defined in Compiler.
|
|
82
|
+
* Only works with custom models, not with Lingo.dev Engine.
|
|
83
|
+
*
|
|
84
|
+
* Example: "You are a helpful assistant that translates {SOURCE_LOCALE} to {TARGET_LOCALE}."
|
|
85
|
+
*
|
|
86
|
+
* @default null
|
|
87
|
+
*/
|
|
88
|
+
prompt?: string | null;
|
|
12
89
|
};
|
|
13
90
|
declare const defaultParams: CompilerParams;
|
|
14
91
|
|
package/build/index.d.ts
CHANGED
|
@@ -1,14 +1,91 @@
|
|
|
1
1
|
import { NextConfig } from 'next';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Options for configuring Lingo.dev Compiler.
|
|
5
|
+
*/
|
|
3
6
|
type CompilerParams = {
|
|
7
|
+
/**
|
|
8
|
+
* The locale to translate from.
|
|
9
|
+
*
|
|
10
|
+
* This must match one of the following formats:
|
|
11
|
+
*
|
|
12
|
+
* - [ISO 639-1 language code](https://en.wikipedia.org/wiki/ISO_639-1) (e.g., `"en"`)
|
|
13
|
+
* - [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) (e.g., `"en-US"`)
|
|
14
|
+
*
|
|
15
|
+
* @default "en"
|
|
16
|
+
*/
|
|
4
17
|
sourceLocale: string;
|
|
18
|
+
/**
|
|
19
|
+
* The locale(s) to translate to.
|
|
20
|
+
*
|
|
21
|
+
* Each locale must match one of the following formats:
|
|
22
|
+
*
|
|
23
|
+
* - [ISO 639-1 language code](https://en.wikipedia.org/wiki/ISO_639-1) (e.g., `"en"`)
|
|
24
|
+
* - [IETF BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) (e.g., `"en-US"`)
|
|
25
|
+
*
|
|
26
|
+
* @default ["es"]
|
|
27
|
+
*/
|
|
5
28
|
targetLocales: string[];
|
|
29
|
+
/**
|
|
30
|
+
* The name of the directory where translation files will be stored, relative to `sourceRoot`.
|
|
31
|
+
*
|
|
32
|
+
* @default "lingo"
|
|
33
|
+
*/
|
|
6
34
|
lingoDir: string;
|
|
35
|
+
/**
|
|
36
|
+
* The directory of the source code that will be translated, relative to the current working directory.
|
|
37
|
+
*
|
|
38
|
+
* @default "src"
|
|
39
|
+
*/
|
|
7
40
|
sourceRoot: string;
|
|
41
|
+
/**
|
|
42
|
+
* If `true`, the compiler will generate code for React Server Components (RSC).
|
|
43
|
+
*
|
|
44
|
+
* When using Vite, this value is always `false`.
|
|
45
|
+
*
|
|
46
|
+
* When using Next.js, this value is always `true`.
|
|
47
|
+
*
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
8
50
|
rsc: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* If `true`, the compiler will only localize files that use the `"use i18n";` directive.
|
|
53
|
+
*
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
9
56
|
useDirective: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* If `true`, the compiler will log additional information to the console.
|
|
59
|
+
*
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
10
62
|
debug: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* The model(s) to use for translation.
|
|
65
|
+
*
|
|
66
|
+
* If set to `"lingo.dev"`, the compiler will use Lingo.dev Engine.
|
|
67
|
+
*
|
|
68
|
+
* If set to an object, the compiler will use the model(s) specified in the object:
|
|
69
|
+
*
|
|
70
|
+
* - The key is a string that represents the source and target locales, separated by a colon (e.g., `"en:es"`).
|
|
71
|
+
* - The value is a string that represents the LLM provider and model, separated by a colon (e.g., `"google:gemini-2.0-flash"`).
|
|
72
|
+
*
|
|
73
|
+
* You can use `*` as a wildcard to match any locale.
|
|
74
|
+
*
|
|
75
|
+
* If a model is not specified, an error will be thrown.
|
|
76
|
+
*
|
|
77
|
+
* @default {}
|
|
78
|
+
*/
|
|
11
79
|
models: "lingo.dev" | Record<string, string>;
|
|
80
|
+
/**
|
|
81
|
+
* Custom system prompt for the translation engine. If set, this prompt will override the default system prompt defined in Compiler.
|
|
82
|
+
* Only works with custom models, not with Lingo.dev Engine.
|
|
83
|
+
*
|
|
84
|
+
* Example: "You are a helpful assistant that translates {SOURCE_LOCALE} to {TARGET_LOCALE}."
|
|
85
|
+
*
|
|
86
|
+
* @default null
|
|
87
|
+
*/
|
|
88
|
+
prompt?: string | null;
|
|
12
89
|
};
|
|
13
90
|
declare const defaultParams: CompilerParams;
|
|
14
91
|
|
package/build/index.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
loadDictionary,
|
|
18
18
|
providerDetails,
|
|
19
19
|
transformComponent
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-ZXNG22MO.mjs";
|
|
21
21
|
|
|
22
22
|
// src/index.ts
|
|
23
23
|
import { createUnplugin } from "unplugin";
|
|
@@ -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.
|
|
28
|
+
version: "0.5.4",
|
|
29
29
|
description: "Lingo.dev Compiler",
|
|
30
30
|
private: false,
|
|
31
31
|
publishConfig: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkPO4OCL2Ucjs = require('./chunk-PO4OCL2U.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 _chunkPO4OCL2Ucjs.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 = _chunkPO4OCL2Ucjs.transformComponent.call(void 0, {
|
|
25
25
|
code: source,
|
|
26
26
|
params,
|
|
27
27
|
resourcePath: this.resourcePath,
|