@lingo.dev/_compiler 0.5.0 → 0.5.2
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-5H7RCOY5.cjs → chunk-42EM6MWM.cjs} +13 -0
- package/build/{chunk-X534EYJZ.mjs → chunk-XCIXY6J2.mjs} +13 -0
- package/build/index.cjs +22 -22
- 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 +2 -2
|
@@ -791,6 +791,19 @@ function getJsxElementName(nodePath) {
|
|
|
791
791
|
if (t9.isJSXIdentifier(openingElement.name)) {
|
|
792
792
|
return openingElement.name.name;
|
|
793
793
|
}
|
|
794
|
+
if (t9.isJSXMemberExpression(openingElement.name)) {
|
|
795
|
+
const memberExpr = openingElement.name;
|
|
796
|
+
const parts = [];
|
|
797
|
+
let current = memberExpr;
|
|
798
|
+
while (t9.isJSXMemberExpression(current)) {
|
|
799
|
+
parts.unshift(current.property.name);
|
|
800
|
+
current = current.object;
|
|
801
|
+
}
|
|
802
|
+
if (t9.isJSXIdentifier(current)) {
|
|
803
|
+
parts.unshift(current.name);
|
|
804
|
+
}
|
|
805
|
+
return parts.join(".");
|
|
806
|
+
}
|
|
794
807
|
return null;
|
|
795
808
|
}
|
|
796
809
|
function getNestedJsxElements(nodePath) {
|
|
@@ -791,6 +791,19 @@ function getJsxElementName(nodePath) {
|
|
|
791
791
|
if (t9.isJSXIdentifier(openingElement.name)) {
|
|
792
792
|
return openingElement.name.name;
|
|
793
793
|
}
|
|
794
|
+
if (t9.isJSXMemberExpression(openingElement.name)) {
|
|
795
|
+
const memberExpr = openingElement.name;
|
|
796
|
+
const parts = [];
|
|
797
|
+
let current = memberExpr;
|
|
798
|
+
while (t9.isJSXMemberExpression(current)) {
|
|
799
|
+
parts.unshift(current.property.name);
|
|
800
|
+
current = current.object;
|
|
801
|
+
}
|
|
802
|
+
if (t9.isJSXIdentifier(current)) {
|
|
803
|
+
parts.unshift(current.name);
|
|
804
|
+
}
|
|
805
|
+
return parts.join(".");
|
|
806
|
+
}
|
|
794
807
|
return null;
|
|
795
808
|
}
|
|
796
809
|
function getNestedJsxElements(nodePath) {
|
package/build/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunk42EM6MWMcjs = require('./chunk-42EM6MWM.cjs');
|
|
20
20
|
|
|
21
21
|
// src/index.ts
|
|
22
22
|
var _unplugin = require('unplugin');
|
|
@@ -24,7 +24,7 @@ var _unplugin = require('unplugin');
|
|
|
24
24
|
// package.json
|
|
25
25
|
var package_default = {
|
|
26
26
|
name: "@lingo.dev/_compiler",
|
|
27
|
-
version: "0.5.
|
|
27
|
+
version: "0.5.2",
|
|
28
28
|
description: "Lingo.dev Compiler",
|
|
29
29
|
private: false,
|
|
30
30
|
publishConfig: {
|
|
@@ -91,33 +91,33 @@ var _lodash = require('lodash'); var _lodash2 = _interopRequireDefault(_lodash);
|
|
|
91
91
|
var _dedent = require('dedent'); var _dedent2 = _interopRequireDefault(_dedent);
|
|
92
92
|
var keyCheckers = {
|
|
93
93
|
groq: {
|
|
94
|
-
checkEnv:
|
|
95
|
-
checkRc:
|
|
94
|
+
checkEnv: _chunk42EM6MWMcjs.getGroqKeyFromEnv,
|
|
95
|
+
checkRc: _chunk42EM6MWMcjs.getGroqKeyFromRc
|
|
96
96
|
},
|
|
97
97
|
google: {
|
|
98
|
-
checkEnv:
|
|
99
|
-
checkRc:
|
|
98
|
+
checkEnv: _chunk42EM6MWMcjs.getGoogleKeyFromEnv,
|
|
99
|
+
checkRc: _chunk42EM6MWMcjs.getGoogleKeyFromRc
|
|
100
100
|
},
|
|
101
101
|
mistral: {
|
|
102
|
-
checkEnv:
|
|
103
|
-
checkRc:
|
|
102
|
+
checkEnv: _chunk42EM6MWMcjs.getMistralKeyFromEnv,
|
|
103
|
+
checkRc: _chunk42EM6MWMcjs.getMistralKeyFromRc
|
|
104
104
|
},
|
|
105
105
|
"lingo.dev": {
|
|
106
|
-
checkEnv:
|
|
107
|
-
checkRc:
|
|
106
|
+
checkEnv: _chunk42EM6MWMcjs.getLingoDotDevKeyFromEnv,
|
|
107
|
+
checkRc: _chunk42EM6MWMcjs.getLingoDotDevKeyFromRc
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
110
|
var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
111
111
|
(_params, _meta) => {
|
|
112
112
|
console.log("\u2139\uFE0F Starting Lingo.dev compiler...");
|
|
113
|
-
const params = _lodash2.default.defaults(_params,
|
|
114
|
-
if (!
|
|
113
|
+
const params = _lodash2.default.defaults(_params, _chunk42EM6MWMcjs.defaultParams);
|
|
114
|
+
if (!_chunk42EM6MWMcjs.isRunningInCIOrDocker.call(void 0, )) {
|
|
115
115
|
if (params.models === "lingo.dev") {
|
|
116
116
|
validateLLMKeyDetails(["lingo.dev"]);
|
|
117
117
|
} else {
|
|
118
118
|
const configuredProviders = getConfiguredProviders(params.models);
|
|
119
119
|
validateLLMKeyDetails(configuredProviders);
|
|
120
|
-
const invalidLocales =
|
|
120
|
+
const invalidLocales = _chunk42EM6MWMcjs.getInvalidLocales.call(void 0,
|
|
121
121
|
params.models,
|
|
122
122
|
params.sourceLocale,
|
|
123
123
|
params.targetLocales
|
|
@@ -140,16 +140,16 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
|
|
143
|
+
_chunk42EM6MWMcjs.LCPCache.ensureDictionaryFile({
|
|
144
144
|
sourceRoot: params.sourceRoot,
|
|
145
145
|
lingoDir: params.lingoDir
|
|
146
146
|
});
|
|
147
147
|
const isDev = "dev" in _meta ? !!_meta.dev : process.env.NODE_ENV !== "production";
|
|
148
148
|
return {
|
|
149
149
|
name: package_default.name,
|
|
150
|
-
loadInclude: (id) => !!id.match(
|
|
150
|
+
loadInclude: (id) => !!id.match(_chunk42EM6MWMcjs.LCP_DICTIONARY_FILE_NAME),
|
|
151
151
|
async load(id) {
|
|
152
|
-
const dictionary = await
|
|
152
|
+
const dictionary = await _chunk42EM6MWMcjs.loadDictionary.call(void 0, {
|
|
153
153
|
resourcePath: id,
|
|
154
154
|
resourceQuery: "",
|
|
155
155
|
params: {
|
|
@@ -174,7 +174,7 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
|
174
174
|
enforce: "pre",
|
|
175
175
|
transform(code, id) {
|
|
176
176
|
try {
|
|
177
|
-
const result =
|
|
177
|
+
const result = _chunk42EM6MWMcjs.transformComponent.call(void 0, {
|
|
178
178
|
code,
|
|
179
179
|
params,
|
|
180
180
|
resourcePath: id,
|
|
@@ -194,7 +194,7 @@ var src_default = {
|
|
|
194
194
|
next: (compilerParams) => (nextConfig = {}) => {
|
|
195
195
|
const mergedParams = _lodash2.default.merge(
|
|
196
196
|
{},
|
|
197
|
-
|
|
197
|
+
_chunk42EM6MWMcjs.defaultParams,
|
|
198
198
|
{
|
|
199
199
|
rsc: true,
|
|
200
200
|
turbopack: {
|
|
@@ -243,7 +243,7 @@ var src_default = {
|
|
|
243
243
|
turbopackConfigPath.rules ??= {};
|
|
244
244
|
const rules = turbopackConfigPath.rules;
|
|
245
245
|
const lingoGlob = `**/*.{ts,tsx,js,jsx}`;
|
|
246
|
-
const lingoLoaderPath =
|
|
246
|
+
const lingoLoaderPath = _chunk42EM6MWMcjs.__require.resolve("./lingo-turbopack-loader");
|
|
247
247
|
rules[lingoGlob] = {
|
|
248
248
|
loaders: [
|
|
249
249
|
{
|
|
@@ -257,14 +257,14 @@ var src_default = {
|
|
|
257
257
|
},
|
|
258
258
|
vite: (compilerParams) => (config) => {
|
|
259
259
|
config.plugins.unshift(
|
|
260
|
-
unplugin.vite(_lodash2.default.merge({},
|
|
260
|
+
unplugin.vite(_lodash2.default.merge({}, _chunk42EM6MWMcjs.defaultParams, { rsc: false }, compilerParams))
|
|
261
261
|
);
|
|
262
262
|
return config;
|
|
263
263
|
}
|
|
264
264
|
};
|
|
265
265
|
function getConfiguredProviders(models) {
|
|
266
266
|
return _lodash2.default.chain(Object.values(models)).map((modelString) => modelString.split(":")[0]).filter(Boolean).uniq().filter(
|
|
267
|
-
(providerId) =>
|
|
267
|
+
(providerId) => _chunk42EM6MWMcjs.providerDetails.hasOwnProperty(providerId) && keyCheckers.hasOwnProperty(providerId)
|
|
268
268
|
).value();
|
|
269
269
|
}
|
|
270
270
|
function validateLLMKeyDetails(configuredProviders) {
|
|
@@ -275,7 +275,7 @@ function validateLLMKeyDetails(configuredProviders) {
|
|
|
275
275
|
const missingProviders = [];
|
|
276
276
|
const foundProviders = [];
|
|
277
277
|
for (const providerId of configuredProviders) {
|
|
278
|
-
const details =
|
|
278
|
+
const details = _chunk42EM6MWMcjs.providerDetails[providerId];
|
|
279
279
|
const checkers = keyCheckers[providerId];
|
|
280
280
|
if (!details || !checkers) continue;
|
|
281
281
|
const foundInEnv = !!checkers.checkEnv();
|
package/build/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
loadDictionary,
|
|
17
17
|
providerDetails,
|
|
18
18
|
transformComponent
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-XCIXY6J2.mjs";
|
|
20
20
|
|
|
21
21
|
// src/index.ts
|
|
22
22
|
import { createUnplugin } from "unplugin";
|
|
@@ -24,7 +24,7 @@ import { createUnplugin } from "unplugin";
|
|
|
24
24
|
// package.json
|
|
25
25
|
var package_default = {
|
|
26
26
|
name: "@lingo.dev/_compiler",
|
|
27
|
-
version: "0.5.
|
|
27
|
+
version: "0.5.2",
|
|
28
28
|
description: "Lingo.dev Compiler",
|
|
29
29
|
private: false,
|
|
30
30
|
publishConfig: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk42EM6MWMcjs = require('./chunk-42EM6MWM.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 _chunk42EM6MWMcjs.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 = _chunk42EM6MWMcjs.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.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Lingo.dev Compiler",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"unplugin": "^2.1.2",
|
|
51
51
|
"vitest": "^2.1.4",
|
|
52
52
|
"zod": "^3.24.1",
|
|
53
|
-
"@lingo.dev/_sdk": "0.9.
|
|
53
|
+
"@lingo.dev/_sdk": "0.9.5"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"dev": "tsup --watch",
|