@lingo.dev/_compiler 0.8.0 → 0.8.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.
- package/build/{chunk-NMKWLVJK.cjs → chunk-AKV7BRP5.cjs} +22 -26
- package/build/{chunk-K3VLB5BY.mjs → chunk-VG5I5JDL.mjs} +16 -20
- 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 +1 -1
|
@@ -3,8 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
var _chunkAKFJBAG4cjs = require('./chunk-AKFJBAG4.cjs');
|
|
5
5
|
|
|
6
|
-
// src/
|
|
6
|
+
// src/babel-interop.ts
|
|
7
|
+
var _traverse2 = require('@babel/traverse'); var _traverse3 = _interopRequireDefault(_traverse2);
|
|
7
8
|
var _generator = require('@babel/generator'); var _generator2 = _interopRequireDefault(_generator);
|
|
9
|
+
var traverse = typeof _traverse3.default == "function" ? _traverse3.default : _traverse3.default.default;
|
|
10
|
+
var generate = typeof _generator2.default == "function" ? _generator2.default : _generator2.default.default;
|
|
11
|
+
|
|
12
|
+
// src/_base.ts
|
|
8
13
|
var _parser = require('@babel/parser'); var parser = _interopRequireWildcard(_parser);
|
|
9
14
|
function createCodeMutation(spec) {
|
|
10
15
|
return (payload) => {
|
|
@@ -23,7 +28,7 @@ function createPayload(input) {
|
|
|
23
28
|
};
|
|
24
29
|
}
|
|
25
30
|
function createOutput(payload) {
|
|
26
|
-
const generationResult =
|
|
31
|
+
const generationResult = generate(payload.ast, {}, payload.code);
|
|
27
32
|
return {
|
|
28
33
|
code: generationResult.code,
|
|
29
34
|
map: generationResult.map
|
|
@@ -20190,7 +20195,6 @@ var providerDetails = {
|
|
|
20190
20195
|
|
|
20191
20196
|
|
|
20192
20197
|
// src/utils/index.ts
|
|
20193
|
-
var _traverse = require('@babel/traverse'); var _traverse2 = _interopRequireDefault(_traverse);
|
|
20194
20198
|
var _types = require('@babel/types'); var t2 = _interopRequireWildcard(_types); var t = _interopRequireWildcard(_types); var t3 = _interopRequireWildcard(_types); var t5 = _interopRequireWildcard(_types); var t4 = _interopRequireWildcard(_types); var t8 = _interopRequireWildcard(_types); var t6 = _interopRequireWildcard(_types); var t7 = _interopRequireWildcard(_types); var t10 = _interopRequireWildcard(_types); var t9 = _interopRequireWildcard(_types); var t11 = _interopRequireWildcard(_types); var t12 = _interopRequireWildcard(_types); var t13 = _interopRequireWildcard(_types); var t14 = _interopRequireWildcard(_types); var t15 = _interopRequireWildcard(_types); var t17 = _interopRequireWildcard(_types); var t16 = _interopRequireWildcard(_types); var t21 = _interopRequireWildcard(_types); var t18 = _interopRequireWildcard(_types); var t19 = _interopRequireWildcard(_types); var t20 = _interopRequireWildcard(_types); var t22 = _interopRequireWildcard(_types); var t23 = _interopRequireWildcard(_types); var t24 = _interopRequireWildcard(_types);
|
|
20195
20199
|
|
|
20196
20200
|
// src/utils/jsx-attribute.ts
|
|
@@ -20279,7 +20283,7 @@ function createAttributeValue(value) {
|
|
|
20279
20283
|
// src/utils/index.ts
|
|
20280
20284
|
function getJsxRoots(node) {
|
|
20281
20285
|
const result = [];
|
|
20282
|
-
|
|
20286
|
+
traverse(node, {
|
|
20283
20287
|
JSXElement(path20) {
|
|
20284
20288
|
result.push(path20);
|
|
20285
20289
|
path20.skip();
|
|
@@ -20308,7 +20312,7 @@ function getOrCreateImport(ast, params) {
|
|
|
20308
20312
|
}
|
|
20309
20313
|
function findExistingImport(ast, exportedName, moduleName) {
|
|
20310
20314
|
let result = null;
|
|
20311
|
-
|
|
20315
|
+
traverse(ast, {
|
|
20312
20316
|
ImportDeclaration(path20) {
|
|
20313
20317
|
if (!moduleName.includes(path20.node.source.value)) {
|
|
20314
20318
|
return;
|
|
@@ -20340,7 +20344,7 @@ function findExistingImport(ast, exportedName, moduleName) {
|
|
|
20340
20344
|
}
|
|
20341
20345
|
function generateUniqueImportName(ast, baseName) {
|
|
20342
20346
|
const usedNames = /* @__PURE__ */ new Set();
|
|
20343
|
-
|
|
20347
|
+
traverse(ast, {
|
|
20344
20348
|
Identifier(path20) {
|
|
20345
20349
|
usedNames.add(path20.node.name);
|
|
20346
20350
|
}
|
|
@@ -20357,7 +20361,7 @@ function generateUniqueImportName(ast, baseName) {
|
|
|
20357
20361
|
return candidateName;
|
|
20358
20362
|
}
|
|
20359
20363
|
function createImportDeclaration(ast, localName, exportedName, moduleName) {
|
|
20360
|
-
|
|
20364
|
+
traverse(ast, {
|
|
20361
20365
|
Program(path20) {
|
|
20362
20366
|
const importSpecifier2 = t2.importSpecifier(
|
|
20363
20367
|
t2.identifier(localName),
|
|
@@ -20391,7 +20395,7 @@ function findLastImportIndex(programPath) {
|
|
|
20391
20395
|
}
|
|
20392
20396
|
function _hasFileDirective(ast, directiveValue) {
|
|
20393
20397
|
let hasDirective = false;
|
|
20394
|
-
|
|
20398
|
+
traverse(ast, {
|
|
20395
20399
|
Directive(path20) {
|
|
20396
20400
|
if (path20.node.value.value === directiveValue) {
|
|
20397
20401
|
hasDirective = true;
|
|
@@ -20421,10 +20425,9 @@ function getModuleExecutionMode(ast, rscEnabled) {
|
|
|
20421
20425
|
|
|
20422
20426
|
// src/utils/invokations.ts
|
|
20423
20427
|
|
|
20424
|
-
|
|
20425
20428
|
function findInvokations(ast, params) {
|
|
20426
20429
|
const result = [];
|
|
20427
|
-
|
|
20430
|
+
traverse(ast, {
|
|
20428
20431
|
ImportDeclaration(path20) {
|
|
20429
20432
|
if (!params.moduleName.includes(path20.node.source.value)) return;
|
|
20430
20433
|
const importNames = /* @__PURE__ */ new Map();
|
|
@@ -20540,10 +20543,9 @@ var i18n_directive_default = i18nDirectiveMutation;
|
|
|
20540
20543
|
|
|
20541
20544
|
// src/utils/jsx-attribute-scope.ts
|
|
20542
20545
|
|
|
20543
|
-
|
|
20544
20546
|
function collectJsxAttributeScopes(node) {
|
|
20545
20547
|
const result = [];
|
|
20546
|
-
|
|
20548
|
+
traverse(node, {
|
|
20547
20549
|
JSXElement(path20) {
|
|
20548
20550
|
if (!hasJsxAttributeScopeAttribute(path20)) return;
|
|
20549
20551
|
const localizableAttributes = getJsxAttributeScopeAttribute(path20);
|
|
@@ -20566,7 +20568,7 @@ function getJsxAttributeScopes(node) {
|
|
|
20566
20568
|
"content",
|
|
20567
20569
|
"subtitle"
|
|
20568
20570
|
];
|
|
20569
|
-
|
|
20571
|
+
traverse(node, {
|
|
20570
20572
|
JSXElement(path20) {
|
|
20571
20573
|
const openingElement = path20.node.openingElement;
|
|
20572
20574
|
const elementName = openingElement.name;
|
|
@@ -20617,7 +20619,6 @@ function getJsxAttributeScopeAttribute(path20) {
|
|
|
20617
20619
|
|
|
20618
20620
|
// src/utils/ast-key.ts
|
|
20619
20621
|
|
|
20620
|
-
|
|
20621
20622
|
function getAstKey(nodePath) {
|
|
20622
20623
|
const keyChunks = [];
|
|
20623
20624
|
let current = nodePath;
|
|
@@ -20993,12 +20994,11 @@ function jsxAttributeScopesExportMutation(payload) {
|
|
|
20993
20994
|
|
|
20994
20995
|
// src/jsx-fragment.ts
|
|
20995
20996
|
|
|
20996
|
-
|
|
20997
20997
|
function jsxFragmentMutation(payload) {
|
|
20998
20998
|
const { ast } = payload;
|
|
20999
20999
|
let foundFragments = false;
|
|
21000
21000
|
let fragmentImportName = null;
|
|
21001
|
-
|
|
21001
|
+
traverse(ast, {
|
|
21002
21002
|
ImportDeclaration(path20) {
|
|
21003
21003
|
if (path20.node.source.value !== "react") return;
|
|
21004
21004
|
for (const specifier of path20.node.specifiers) {
|
|
@@ -21009,7 +21009,7 @@ function jsxFragmentMutation(payload) {
|
|
|
21009
21009
|
}
|
|
21010
21010
|
}
|
|
21011
21011
|
});
|
|
21012
|
-
|
|
21012
|
+
traverse(ast, {
|
|
21013
21013
|
JSXFragment(path20) {
|
|
21014
21014
|
foundFragments = true;
|
|
21015
21015
|
if (!fragmentImportName) {
|
|
@@ -21033,9 +21033,8 @@ function jsxFragmentMutation(payload) {
|
|
|
21033
21033
|
|
|
21034
21034
|
// src/jsx-html-lang.ts
|
|
21035
21035
|
|
|
21036
|
-
|
|
21037
21036
|
var jsxHtmlLangMutation = createCodeMutation((payload) => {
|
|
21038
|
-
|
|
21037
|
+
traverse(payload.ast, {
|
|
21039
21038
|
JSXElement: (path20) => {
|
|
21040
21039
|
if (_optionalChain([getJsxElementName, 'call', _25 => _25(path20), 'optionalAccess', _26 => _26.toLowerCase, 'call', _27 => _27()]) === "html") {
|
|
21041
21040
|
const mode = getModuleExecutionMode(payload.ast, payload.params.rsc);
|
|
@@ -21061,9 +21060,8 @@ var jsxHtmlLangMutation = createCodeMutation((payload) => {
|
|
|
21061
21060
|
|
|
21062
21061
|
// src/jsx-provider.ts
|
|
21063
21062
|
|
|
21064
|
-
|
|
21065
21063
|
var jsxProviderMutation = createCodeMutation((payload) => {
|
|
21066
|
-
|
|
21064
|
+
traverse(payload.ast, {
|
|
21067
21065
|
JSXElement: (path20) => {
|
|
21068
21066
|
if (_optionalChain([getJsxElementName, 'call', _28 => _28(path20), 'optionalAccess', _29 => _29.toLowerCase, 'call', _30 => _30()]) === "html") {
|
|
21069
21067
|
const mode = getModuleExecutionMode(payload.ast, payload.params.rsc);
|
|
@@ -21113,7 +21111,6 @@ var jsx_provider_default = jsxProviderMutation;
|
|
|
21113
21111
|
|
|
21114
21112
|
// src/jsx-remove-attributes.ts
|
|
21115
21113
|
|
|
21116
|
-
|
|
21117
21114
|
var jsxRemoveAttributesMutation = createCodeMutation(
|
|
21118
21115
|
(payload) => {
|
|
21119
21116
|
const ATTRIBUTES_TO_REMOVE = [
|
|
@@ -21121,7 +21118,7 @@ var jsxRemoveAttributesMutation = createCodeMutation(
|
|
|
21121
21118
|
"data-jsx-scope",
|
|
21122
21119
|
"data-jsx-attribute-scope"
|
|
21123
21120
|
];
|
|
21124
|
-
|
|
21121
|
+
traverse(payload.ast, {
|
|
21125
21122
|
JSXElement(path20) {
|
|
21126
21123
|
const openingElement = path20.node.openingElement;
|
|
21127
21124
|
openingElement.attributes = openingElement.attributes.filter((attr) => {
|
|
@@ -21156,10 +21153,9 @@ var jsx_root_flag_default = jsxRootFlagMutation;
|
|
|
21156
21153
|
|
|
21157
21154
|
// src/utils/jsx-scope.ts
|
|
21158
21155
|
|
|
21159
|
-
|
|
21160
21156
|
function collectJsxScopes(ast) {
|
|
21161
21157
|
const jsxScopes = [];
|
|
21162
|
-
|
|
21158
|
+
traverse(ast, {
|
|
21163
21159
|
JSXElement: (path20) => {
|
|
21164
21160
|
if (!hasJsxScopeAttribute(path20)) return;
|
|
21165
21161
|
path20.skip();
|
|
@@ -21170,7 +21166,7 @@ function collectJsxScopes(ast) {
|
|
|
21170
21166
|
}
|
|
21171
21167
|
function getJsxScopes(node) {
|
|
21172
21168
|
const result = [];
|
|
21173
|
-
|
|
21169
|
+
traverse(node, {
|
|
21174
21170
|
JSXElement(path20) {
|
|
21175
21171
|
if (getJsxElementName(path20) === "LingoProvider") {
|
|
21176
21172
|
return;
|
|
@@ -2,8 +2,13 @@ import {
|
|
|
2
2
|
__export
|
|
3
3
|
} from "./chunk-6BWS3CLP.mjs";
|
|
4
4
|
|
|
5
|
+
// src/babel-interop.ts
|
|
6
|
+
import _traverse from "@babel/traverse";
|
|
7
|
+
import _generate from "@babel/generator";
|
|
8
|
+
var traverse = typeof _traverse == "function" ? _traverse : _traverse.default;
|
|
9
|
+
var generate = typeof _generate == "function" ? _generate : _generate.default;
|
|
10
|
+
|
|
5
11
|
// src/_base.ts
|
|
6
|
-
import generate from "@babel/generator";
|
|
7
12
|
import * as parser from "@babel/parser";
|
|
8
13
|
function createCodeMutation(spec) {
|
|
9
14
|
return (payload) => {
|
|
@@ -20189,7 +20194,6 @@ import _11 from "lodash";
|
|
|
20189
20194
|
import path19 from "path";
|
|
20190
20195
|
|
|
20191
20196
|
// src/utils/index.ts
|
|
20192
|
-
import traverse from "@babel/traverse";
|
|
20193
20197
|
import * as t2 from "@babel/types";
|
|
20194
20198
|
|
|
20195
20199
|
// src/utils/jsx-attribute.ts
|
|
@@ -20420,10 +20424,9 @@ function getModuleExecutionMode(ast, rscEnabled) {
|
|
|
20420
20424
|
|
|
20421
20425
|
// src/utils/invokations.ts
|
|
20422
20426
|
import * as t3 from "@babel/types";
|
|
20423
|
-
import traverse2 from "@babel/traverse";
|
|
20424
20427
|
function findInvokations(ast, params) {
|
|
20425
20428
|
const result = [];
|
|
20426
|
-
|
|
20429
|
+
traverse(ast, {
|
|
20427
20430
|
ImportDeclaration(path20) {
|
|
20428
20431
|
if (!params.moduleName.includes(path20.node.source.value)) return;
|
|
20429
20432
|
const importNames = /* @__PURE__ */ new Map();
|
|
@@ -20539,10 +20542,9 @@ import * as t8 from "@babel/types";
|
|
|
20539
20542
|
|
|
20540
20543
|
// src/utils/jsx-attribute-scope.ts
|
|
20541
20544
|
import * as t6 from "@babel/types";
|
|
20542
|
-
import traverse3 from "@babel/traverse";
|
|
20543
20545
|
function collectJsxAttributeScopes(node) {
|
|
20544
20546
|
const result = [];
|
|
20545
|
-
|
|
20547
|
+
traverse(node, {
|
|
20546
20548
|
JSXElement(path20) {
|
|
20547
20549
|
if (!hasJsxAttributeScopeAttribute(path20)) return;
|
|
20548
20550
|
const localizableAttributes = getJsxAttributeScopeAttribute(path20);
|
|
@@ -20565,7 +20567,7 @@ function getJsxAttributeScopes(node) {
|
|
|
20565
20567
|
"content",
|
|
20566
20568
|
"subtitle"
|
|
20567
20569
|
];
|
|
20568
|
-
|
|
20570
|
+
traverse(node, {
|
|
20569
20571
|
JSXElement(path20) {
|
|
20570
20572
|
const openingElement = path20.node.openingElement;
|
|
20571
20573
|
const elementName = openingElement.name;
|
|
@@ -20616,7 +20618,6 @@ function getJsxAttributeScopeAttribute(path20) {
|
|
|
20616
20618
|
|
|
20617
20619
|
// src/utils/ast-key.ts
|
|
20618
20620
|
import * as t7 from "@babel/types";
|
|
20619
|
-
import traverse4 from "@babel/traverse";
|
|
20620
20621
|
function getAstKey(nodePath) {
|
|
20621
20622
|
const keyChunks = [];
|
|
20622
20623
|
let current = nodePath;
|
|
@@ -20991,13 +20992,12 @@ function jsxAttributeScopesExportMutation(payload) {
|
|
|
20991
20992
|
}
|
|
20992
20993
|
|
|
20993
20994
|
// src/jsx-fragment.ts
|
|
20994
|
-
import traverse5 from "@babel/traverse";
|
|
20995
20995
|
import * as t11 from "@babel/types";
|
|
20996
20996
|
function jsxFragmentMutation(payload) {
|
|
20997
20997
|
const { ast } = payload;
|
|
20998
20998
|
let foundFragments = false;
|
|
20999
20999
|
let fragmentImportName = null;
|
|
21000
|
-
|
|
21000
|
+
traverse(ast, {
|
|
21001
21001
|
ImportDeclaration(path20) {
|
|
21002
21002
|
if (path20.node.source.value !== "react") return;
|
|
21003
21003
|
for (const specifier of path20.node.specifiers) {
|
|
@@ -21008,7 +21008,7 @@ function jsxFragmentMutation(payload) {
|
|
|
21008
21008
|
}
|
|
21009
21009
|
}
|
|
21010
21010
|
});
|
|
21011
|
-
|
|
21011
|
+
traverse(ast, {
|
|
21012
21012
|
JSXFragment(path20) {
|
|
21013
21013
|
foundFragments = true;
|
|
21014
21014
|
if (!fragmentImportName) {
|
|
@@ -21031,10 +21031,9 @@ function jsxFragmentMutation(payload) {
|
|
|
21031
21031
|
}
|
|
21032
21032
|
|
|
21033
21033
|
// src/jsx-html-lang.ts
|
|
21034
|
-
import traverse6 from "@babel/traverse";
|
|
21035
21034
|
import * as t12 from "@babel/types";
|
|
21036
21035
|
var jsxHtmlLangMutation = createCodeMutation((payload) => {
|
|
21037
|
-
|
|
21036
|
+
traverse(payload.ast, {
|
|
21038
21037
|
JSXElement: (path20) => {
|
|
21039
21038
|
if (getJsxElementName(path20)?.toLowerCase() === "html") {
|
|
21040
21039
|
const mode = getModuleExecutionMode(payload.ast, payload.params.rsc);
|
|
@@ -21059,10 +21058,9 @@ var jsxHtmlLangMutation = createCodeMutation((payload) => {
|
|
|
21059
21058
|
});
|
|
21060
21059
|
|
|
21061
21060
|
// src/jsx-provider.ts
|
|
21062
|
-
import traverse7 from "@babel/traverse";
|
|
21063
21061
|
import * as t13 from "@babel/types";
|
|
21064
21062
|
var jsxProviderMutation = createCodeMutation((payload) => {
|
|
21065
|
-
|
|
21063
|
+
traverse(payload.ast, {
|
|
21066
21064
|
JSXElement: (path20) => {
|
|
21067
21065
|
if (getJsxElementName(path20)?.toLowerCase() === "html") {
|
|
21068
21066
|
const mode = getModuleExecutionMode(payload.ast, payload.params.rsc);
|
|
@@ -21112,7 +21110,6 @@ var jsx_provider_default = jsxProviderMutation;
|
|
|
21112
21110
|
|
|
21113
21111
|
// src/jsx-remove-attributes.ts
|
|
21114
21112
|
import * as t14 from "@babel/types";
|
|
21115
|
-
import traverse8 from "@babel/traverse";
|
|
21116
21113
|
var jsxRemoveAttributesMutation = createCodeMutation(
|
|
21117
21114
|
(payload) => {
|
|
21118
21115
|
const ATTRIBUTES_TO_REMOVE = [
|
|
@@ -21120,7 +21117,7 @@ var jsxRemoveAttributesMutation = createCodeMutation(
|
|
|
21120
21117
|
"data-jsx-scope",
|
|
21121
21118
|
"data-jsx-attribute-scope"
|
|
21122
21119
|
];
|
|
21123
|
-
|
|
21120
|
+
traverse(payload.ast, {
|
|
21124
21121
|
JSXElement(path20) {
|
|
21125
21122
|
const openingElement = path20.node.openingElement;
|
|
21126
21123
|
openingElement.attributes = openingElement.attributes.filter((attr) => {
|
|
@@ -21155,10 +21152,9 @@ import * as t17 from "@babel/types";
|
|
|
21155
21152
|
|
|
21156
21153
|
// src/utils/jsx-scope.ts
|
|
21157
21154
|
import * as t16 from "@babel/types";
|
|
21158
|
-
import traverse9 from "@babel/traverse";
|
|
21159
21155
|
function collectJsxScopes(ast) {
|
|
21160
21156
|
const jsxScopes = [];
|
|
21161
|
-
|
|
21157
|
+
traverse(ast, {
|
|
21162
21158
|
JSXElement: (path20) => {
|
|
21163
21159
|
if (!hasJsxScopeAttribute(path20)) return;
|
|
21164
21160
|
path20.skip();
|
|
@@ -21169,7 +21165,7 @@ function collectJsxScopes(ast) {
|
|
|
21169
21165
|
}
|
|
21170
21166
|
function getJsxScopes(node) {
|
|
21171
21167
|
const result = [];
|
|
21172
|
-
|
|
21168
|
+
traverse(node, {
|
|
21173
21169
|
JSXElement(path20) {
|
|
21174
21170
|
if (getJsxElementName(path20) === "LingoProvider") {
|
|
21175
21171
|
return;
|
package/build/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkAKV7BRP5cjs = require('./chunk-AKV7BRP5.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
var _chunkAKFJBAG4cjs = require('./chunk-AKFJBAG4.cjs');
|
|
@@ -27,7 +27,7 @@ var _unplugin = require('unplugin');
|
|
|
27
27
|
// package.json
|
|
28
28
|
var package_default = {
|
|
29
29
|
name: "@lingo.dev/_compiler",
|
|
30
|
-
version: "0.8.
|
|
30
|
+
version: "0.8.1",
|
|
31
31
|
description: "Lingo.dev Compiler",
|
|
32
32
|
private: false,
|
|
33
33
|
publishConfig: {
|
|
@@ -141,7 +141,7 @@ async function trackEvent(event, properties) {
|
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
async function getActualId() {
|
|
144
|
-
const rc =
|
|
144
|
+
const rc = _chunkAKV7BRP5cjs.getRc.call(void 0, );
|
|
145
145
|
const apiKey = process.env.LINGODOTDEV_API_KEY || _optionalChain([rc, 'optionalAccess', _3 => _3.auth, 'optionalAccess', _4 => _4.apiKey]);
|
|
146
146
|
const apiUrl = process.env.LINGODOTDEV_API_URL || _optionalChain([rc, 'optionalAccess', _5 => _5.auth, 'optionalAccess', _6 => _6.apiUrl]) || "https://engine.lingo.dev";
|
|
147
147
|
if (apiKey) {
|
|
@@ -169,20 +169,20 @@ async function getActualId() {
|
|
|
169
169
|
// src/index.ts
|
|
170
170
|
var keyCheckers = {
|
|
171
171
|
groq: {
|
|
172
|
-
checkEnv:
|
|
173
|
-
checkRc:
|
|
172
|
+
checkEnv: _chunkAKV7BRP5cjs.getGroqKeyFromEnv,
|
|
173
|
+
checkRc: _chunkAKV7BRP5cjs.getGroqKeyFromRc
|
|
174
174
|
},
|
|
175
175
|
google: {
|
|
176
|
-
checkEnv:
|
|
177
|
-
checkRc:
|
|
176
|
+
checkEnv: _chunkAKV7BRP5cjs.getGoogleKeyFromEnv,
|
|
177
|
+
checkRc: _chunkAKV7BRP5cjs.getGoogleKeyFromRc
|
|
178
178
|
},
|
|
179
179
|
mistral: {
|
|
180
|
-
checkEnv:
|
|
181
|
-
checkRc:
|
|
180
|
+
checkEnv: _chunkAKV7BRP5cjs.getMistralKeyFromEnv,
|
|
181
|
+
checkRc: _chunkAKV7BRP5cjs.getMistralKeyFromRc
|
|
182
182
|
},
|
|
183
183
|
"lingo.dev": {
|
|
184
|
-
checkEnv:
|
|
185
|
-
checkRc:
|
|
184
|
+
checkEnv: _chunkAKV7BRP5cjs.getLingoDotDevKeyFromEnv,
|
|
185
|
+
checkRc: _chunkAKV7BRP5cjs.getLingoDotDevKeyFromRc
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
188
|
var alreadySentBuildEvent = { value: false };
|
|
@@ -198,14 +198,14 @@ function sendBuildEvent(framework, config, isDev) {
|
|
|
198
198
|
var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
199
199
|
(_params, _meta) => {
|
|
200
200
|
console.log("\u2139\uFE0F Starting Lingo.dev compiler...");
|
|
201
|
-
const params = _lodash2.default.defaults(_params,
|
|
202
|
-
if (!
|
|
201
|
+
const params = _lodash2.default.defaults(_params, _chunkAKV7BRP5cjs.defaultParams);
|
|
202
|
+
if (!_chunkAKV7BRP5cjs.isRunningInCIOrDocker.call(void 0, )) {
|
|
203
203
|
if (params.models === "lingo.dev") {
|
|
204
204
|
validateLLMKeyDetails(["lingo.dev"]);
|
|
205
205
|
} else {
|
|
206
206
|
const configuredProviders = getConfiguredProviders(params.models);
|
|
207
207
|
validateLLMKeyDetails(configuredProviders);
|
|
208
|
-
const invalidLocales =
|
|
208
|
+
const invalidLocales = _chunkAKV7BRP5cjs.getInvalidLocales.call(void 0,
|
|
209
209
|
params.models,
|
|
210
210
|
params.sourceLocale,
|
|
211
211
|
params.targetLocales
|
|
@@ -224,7 +224,7 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
|
|
227
|
+
_chunkAKV7BRP5cjs.LCPCache.ensureDictionaryFile({
|
|
228
228
|
sourceRoot: params.sourceRoot,
|
|
229
229
|
lingoDir: params.lingoDir
|
|
230
230
|
});
|
|
@@ -232,9 +232,9 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
|
232
232
|
sendBuildEvent("unplugin", params, isDev);
|
|
233
233
|
return {
|
|
234
234
|
name: package_default.name,
|
|
235
|
-
loadInclude: (id) => !!id.match(
|
|
235
|
+
loadInclude: (id) => !!id.match(_chunkAKV7BRP5cjs.LCP_DICTIONARY_FILE_NAME),
|
|
236
236
|
async load(id) {
|
|
237
|
-
const dictionary = await
|
|
237
|
+
const dictionary = await _chunkAKV7BRP5cjs.loadDictionary.call(void 0, {
|
|
238
238
|
resourcePath: id,
|
|
239
239
|
resourceQuery: "",
|
|
240
240
|
params: {
|
|
@@ -258,7 +258,7 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
|
258
258
|
enforce: "pre",
|
|
259
259
|
transform(code, id) {
|
|
260
260
|
try {
|
|
261
|
-
const result =
|
|
261
|
+
const result = _chunkAKV7BRP5cjs.transformComponent.call(void 0, {
|
|
262
262
|
code,
|
|
263
263
|
params,
|
|
264
264
|
resourcePath: id,
|
|
@@ -300,7 +300,7 @@ var index_default = {
|
|
|
300
300
|
next: (compilerParams) => (nextConfig = {}) => {
|
|
301
301
|
const mergedParams = _lodash2.default.merge(
|
|
302
302
|
{},
|
|
303
|
-
|
|
303
|
+
_chunkAKV7BRP5cjs.defaultParams,
|
|
304
304
|
{
|
|
305
305
|
rsc: true,
|
|
306
306
|
turbopack: {
|
|
@@ -411,7 +411,7 @@ var index_default = {
|
|
|
411
411
|
vite: (compilerParams) => (config) => {
|
|
412
412
|
const mergedParams = _lodash2.default.merge(
|
|
413
413
|
{},
|
|
414
|
-
|
|
414
|
+
_chunkAKV7BRP5cjs.defaultParams,
|
|
415
415
|
{ rsc: false },
|
|
416
416
|
compilerParams
|
|
417
417
|
);
|
|
@@ -425,7 +425,7 @@ var index_default = {
|
|
|
425
425
|
};
|
|
426
426
|
function getConfiguredProviders(models) {
|
|
427
427
|
return _lodash2.default.chain(Object.values(models)).map((modelString) => modelString.split(":")[0]).filter(Boolean).uniq().filter(
|
|
428
|
-
(providerId) =>
|
|
428
|
+
(providerId) => _chunkAKV7BRP5cjs.providerDetails.hasOwnProperty(providerId) && keyCheckers.hasOwnProperty(providerId)
|
|
429
429
|
).value();
|
|
430
430
|
}
|
|
431
431
|
function validateLLMKeyDetails(configuredProviders) {
|
|
@@ -436,7 +436,7 @@ function validateLLMKeyDetails(configuredProviders) {
|
|
|
436
436
|
const missingProviders = [];
|
|
437
437
|
const foundProviders = [];
|
|
438
438
|
for (const providerId of configuredProviders) {
|
|
439
|
-
const details =
|
|
439
|
+
const details = _chunkAKV7BRP5cjs.providerDetails[providerId];
|
|
440
440
|
const checkers = keyCheckers[providerId];
|
|
441
441
|
if (!details || !checkers) continue;
|
|
442
442
|
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-VG5I5JDL.mjs";
|
|
20
20
|
import {
|
|
21
21
|
__require
|
|
22
22
|
} from "./chunk-6BWS3CLP.mjs";
|
|
@@ -27,7 +27,7 @@ import { createUnplugin } from "unplugin";
|
|
|
27
27
|
// package.json
|
|
28
28
|
var package_default = {
|
|
29
29
|
name: "@lingo.dev/_compiler",
|
|
30
|
-
version: "0.8.
|
|
30
|
+
version: "0.8.1",
|
|
31
31
|
description: "Lingo.dev Compiler",
|
|
32
32
|
private: false,
|
|
33
33
|
publishConfig: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkAKV7BRP5cjs = require('./chunk-AKV7BRP5.cjs');
|
|
5
5
|
require('./chunk-AKFJBAG4.cjs');
|
|
6
6
|
|
|
7
7
|
// src/lingo-turbopack-loader.ts
|
|
@@ -10,7 +10,7 @@ async function lingo_turbopack_loader_default(source) {
|
|
|
10
10
|
const params = this.getOptions();
|
|
11
11
|
const isDev = process.env.NODE_ENV !== "production";
|
|
12
12
|
try {
|
|
13
|
-
const dictionary = await
|
|
13
|
+
const dictionary = await _chunkAKV7BRP5cjs.loadDictionary.call(void 0, {
|
|
14
14
|
resourcePath: this.resourcePath,
|
|
15
15
|
resourceQuery: this.resourceQuery,
|
|
16
16
|
params,
|
|
@@ -22,7 +22,7 @@ async function lingo_turbopack_loader_default(source) {
|
|
|
22
22
|
const code = `export default ${JSON.stringify(dictionary, null, 2)};`;
|
|
23
23
|
return callback(null, code);
|
|
24
24
|
}
|
|
25
|
-
const result =
|
|
25
|
+
const result = _chunkAKV7BRP5cjs.transformComponent.call(void 0, {
|
|
26
26
|
code: source,
|
|
27
27
|
params,
|
|
28
28
|
resourcePath: this.resourcePath,
|