@lingo.dev/_compiler 0.7.5 → 0.7.7

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.
@@ -403,6 +403,20 @@ function getJsxAttributeValue(nodePath, attributeName) {
403
403
  }
404
404
  return extractAttributeValue(attribute);
405
405
  }
406
+ function setJsxAttributeValue(nodePath, attributeName, value) {
407
+ const attributes = nodePath.node.openingElement.attributes;
408
+ const attributeIndex = _lodash2.default.findIndex(
409
+ attributes,
410
+ (attr) => attr.type === "JSXAttribute" && attr.name.type === "JSXIdentifier" && attr.name.name === attributeName
411
+ );
412
+ const jsxValue = createAttributeValue(value);
413
+ const jsxAttribute7 = t.jsxAttribute(t.jsxIdentifier(attributeName), jsxValue);
414
+ if (attributeIndex >= 0) {
415
+ attributes[attributeIndex] = jsxAttribute7;
416
+ } else {
417
+ attributes.push(jsxAttribute7);
418
+ }
419
+ }
406
420
  function extractAttributeValue(attribute) {
407
421
  if (!attribute.value) {
408
422
  return true;
@@ -424,6 +438,24 @@ function extractAttributeValue(attribute) {
424
438
  }
425
439
  return null;
426
440
  }
441
+ function createAttributeValue(value) {
442
+ if (value === null || value === void 0) {
443
+ return null;
444
+ }
445
+ if (typeof value === "string") {
446
+ return t.stringLiteral(value);
447
+ }
448
+ if (typeof value === "boolean") {
449
+ return t.jsxExpressionContainer(t.booleanLiteral(value));
450
+ }
451
+ if (typeof value === "number") {
452
+ return t.jsxExpressionContainer(t.numericLiteral(value));
453
+ }
454
+ if (t.isExpression(value)) {
455
+ return t.jsxExpressionContainer(value);
456
+ }
457
+ return t.jsxExpressionContainer(t.stringLiteral(JSON.stringify(value)));
458
+ }
427
459
 
428
460
  // src/utils/index.ts
429
461
  function getJsxRoots(node) {
@@ -615,13 +647,17 @@ function collectCallExpressions(path7, importNames, result, functionName) {
615
647
  // src/_utils.ts
616
648
 
617
649
  var getDictionaryPath = (params) => {
618
- const absolute = path.default.resolve(
650
+ const toFile = path.default.resolve(
619
651
  params.sourceRoot,
620
652
  params.lingoDir,
621
653
  LCP_DICTIONARY_FILE_NAME
622
654
  );
623
- const rel = path.default.relative(params.relativeFilePath, absolute);
624
- return rel.split(path.default.sep).join(path.default.posix.sep);
655
+ const fromDir = path.default.dirname(
656
+ path.default.resolve(params.sourceRoot, params.relativeFilePath)
657
+ );
658
+ const relativePath = path.default.relative(fromDir, toFile);
659
+ const normalizedPath = relativePath.split(path.default.sep).join(path.default.posix.sep);
660
+ return `./${normalizedPath}`;
625
661
  };
626
662
 
627
663
  // src/utils/create-locale-import-map.ts
@@ -877,26 +913,18 @@ var lingoJsxAttributeScopeInjectMutation = createCodeMutation(
877
913
  jsxScope.node.openingElement.attributes.push(
878
914
  t10.jsxAttribute(t10.jsxIdentifier("$attrAs"), as)
879
915
  );
880
- jsxScope.node.openingElement.attributes.push(
881
- t10.jsxAttribute(
882
- t10.jsxIdentifier("$fileKey"),
883
- t10.stringLiteral(payload.relativeFilePath)
884
- )
885
- );
886
- jsxScope.node.openingElement.attributes.push(
887
- t10.jsxAttribute(
888
- t10.jsxIdentifier("$attributes"),
889
- t10.jsxExpressionContainer(
890
- t10.objectExpression(
891
- attributes.map((attributeDefinition) => {
892
- const [attribute, key = ""] = attributeDefinition.split(":");
893
- return t10.objectProperty(
894
- t10.stringLiteral(attribute),
895
- t10.stringLiteral(key)
896
- );
897
- })
898
- )
899
- )
916
+ setJsxAttributeValue(jsxScope, "$fileKey", payload.relativeFilePath);
917
+ setJsxAttributeValue(
918
+ jsxScope,
919
+ "$attributes",
920
+ t10.objectExpression(
921
+ attributes.map((attributeDefinition) => {
922
+ const [attribute, key = ""] = attributeDefinition.split(":");
923
+ return t10.objectProperty(
924
+ t10.stringLiteral(attribute),
925
+ t10.stringLiteral(key)
926
+ );
927
+ })
900
928
  )
901
929
  );
902
930
  if (mode === "server") {
@@ -904,18 +932,14 @@ var lingoJsxAttributeScopeInjectMutation = createCodeMutation(
904
932
  exportedName: "loadDictionary",
905
933
  moduleName: ModuleId.ReactRSC
906
934
  });
907
- jsxScope.node.openingElement.attributes.push(
908
- t10.jsxAttribute(
909
- t10.jsxIdentifier("$loadDictionary"),
910
- t10.jsxExpressionContainer(
911
- t10.arrowFunctionExpression(
912
- [t10.identifier("locale")],
913
- t10.callExpression(
914
- t10.identifier(loadDictionaryImport.importedName),
915
- [t10.identifier("locale")]
916
- )
917
- )
918
- )
935
+ setJsxAttributeValue(
936
+ jsxScope,
937
+ "$loadDictionary",
938
+ t10.arrowFunctionExpression(
939
+ [t10.identifier("locale")],
940
+ t10.callExpression(t10.identifier(loadDictionaryImport.importedName), [
941
+ t10.identifier("locale")
942
+ ])
919
943
  )
920
944
  );
921
945
  }
@@ -1505,91 +1529,64 @@ var lingoJsxScopeInjectMutation = createCodeMutation((payload) => {
1505
1529
  if (!originalJsxElementName) {
1506
1530
  continue;
1507
1531
  }
1508
- const originalAttributes = jsxScope.node.openingElement.attributes.slice();
1509
- const as = /^[A-Z]/.test(originalJsxElementName) ? t21.jsxExpressionContainer(t21.identifier(originalJsxElementName)) : t21.stringLiteral(originalJsxElementName);
1510
- originalAttributes.push(t21.jsxAttribute(t21.jsxIdentifier("$as"), as));
1511
- originalAttributes.push(
1512
- t21.jsxAttribute(
1513
- t21.jsxIdentifier("$fileKey"),
1514
- t21.stringLiteral(payload.relativeFilePath)
1515
- )
1532
+ const newNode = t21.jsxElement(
1533
+ t21.jsxOpeningElement(
1534
+ t21.jsxIdentifier(lingoComponentImport.importedName),
1535
+ jsxScope.node.openingElement.attributes.slice(),
1536
+ // original attributes
1537
+ true
1538
+ // selfClosing
1539
+ ),
1540
+ null,
1541
+ // no closing element
1542
+ [],
1543
+ // no children
1544
+ true
1545
+ // selfClosing
1516
1546
  );
1517
- originalAttributes.push(
1518
- t21.jsxAttribute(
1519
- t21.jsxIdentifier("$entryKey"),
1520
- t21.stringLiteral(getJsxScopeAttribute(jsxScope))
1521
- )
1547
+ const newNodePath = {
1548
+ node: newNode
1549
+ };
1550
+ const as = /^[A-Z]/.test(originalJsxElementName) ? t21.identifier(originalJsxElementName) : originalJsxElementName;
1551
+ setJsxAttributeValue(newNodePath, "$as", as);
1552
+ setJsxAttributeValue(newNodePath, "$fileKey", payload.relativeFilePath);
1553
+ setJsxAttributeValue(
1554
+ newNodePath,
1555
+ "$entryKey",
1556
+ getJsxScopeAttribute(jsxScope)
1522
1557
  );
1523
1558
  const $variables = getJsxVariables(jsxScope);
1524
1559
  if ($variables.properties.length > 0) {
1525
- originalAttributes.push(
1526
- t21.jsxAttribute(
1527
- t21.jsxIdentifier("$variables"),
1528
- t21.jsxExpressionContainer($variables)
1529
- )
1530
- );
1560
+ setJsxAttributeValue(newNodePath, "$variables", $variables);
1531
1561
  }
1532
1562
  const $elements = getNestedJsxElements(jsxScope);
1533
1563
  if ($elements.elements.length > 0) {
1534
- originalAttributes.push(
1535
- t21.jsxAttribute(
1536
- t21.jsxIdentifier("$elements"),
1537
- t21.jsxExpressionContainer($elements)
1538
- )
1539
- );
1564
+ setJsxAttributeValue(newNodePath, "$elements", $elements);
1540
1565
  }
1541
1566
  const $functions = getJsxFunctions(jsxScope);
1542
1567
  if ($functions.properties.length > 0) {
1543
- originalAttributes.push(
1544
- t21.jsxAttribute(
1545
- t21.jsxIdentifier("$functions"),
1546
- t21.jsxExpressionContainer($functions)
1547
- )
1548
- );
1568
+ setJsxAttributeValue(newNodePath, "$functions", $functions);
1549
1569
  }
1550
1570
  const $expressions = getJsxExpressions(jsxScope);
1551
1571
  if ($expressions.elements.length > 0) {
1552
- originalAttributes.push(
1553
- t21.jsxAttribute(
1554
- t21.jsxIdentifier("$expressions"),
1555
- t21.jsxExpressionContainer($expressions)
1556
- )
1557
- );
1572
+ setJsxAttributeValue(newNodePath, "$expressions", $expressions);
1558
1573
  }
1559
1574
  if (mode === "server") {
1560
1575
  const loadDictionaryImport = getOrCreateImport(payload.ast, {
1561
1576
  exportedName: "loadDictionary",
1562
1577
  moduleName: ModuleId.ReactRSC
1563
1578
  });
1564
- originalAttributes.push(
1565
- t21.jsxAttribute(
1566
- t21.jsxIdentifier("$loadDictionary"),
1567
- t21.jsxExpressionContainer(
1568
- t21.arrowFunctionExpression(
1569
- [t21.identifier("locale")],
1570
- t21.callExpression(
1571
- t21.identifier(loadDictionaryImport.importedName),
1572
- [t21.identifier("locale")]
1573
- )
1574
- )
1575
- )
1579
+ setJsxAttributeValue(
1580
+ newNodePath,
1581
+ "$loadDictionary",
1582
+ t21.arrowFunctionExpression(
1583
+ [t21.identifier("locale")],
1584
+ t21.callExpression(t21.identifier(loadDictionaryImport.importedName), [
1585
+ t21.identifier("locale")
1586
+ ])
1576
1587
  )
1577
1588
  );
1578
1589
  }
1579
- const newNode = t21.jsxElement(
1580
- t21.jsxOpeningElement(
1581
- t21.jsxIdentifier(lingoComponentImport.importedName),
1582
- originalAttributes,
1583
- true
1584
- // selfClosing
1585
- ),
1586
- null,
1587
- // no closing element
1588
- [],
1589
- // no children
1590
- true
1591
- // selfClosing
1592
- );
1593
1590
  jsxScope.replaceWith(newNode);
1594
1591
  }
1595
1592
  return payload;
@@ -403,6 +403,20 @@ function getJsxAttributeValue(nodePath, attributeName) {
403
403
  }
404
404
  return extractAttributeValue(attribute);
405
405
  }
406
+ function setJsxAttributeValue(nodePath, attributeName, value) {
407
+ const attributes = nodePath.node.openingElement.attributes;
408
+ const attributeIndex = _3.findIndex(
409
+ attributes,
410
+ (attr) => attr.type === "JSXAttribute" && attr.name.type === "JSXIdentifier" && attr.name.name === attributeName
411
+ );
412
+ const jsxValue = createAttributeValue(value);
413
+ const jsxAttribute7 = t.jsxAttribute(t.jsxIdentifier(attributeName), jsxValue);
414
+ if (attributeIndex >= 0) {
415
+ attributes[attributeIndex] = jsxAttribute7;
416
+ } else {
417
+ attributes.push(jsxAttribute7);
418
+ }
419
+ }
406
420
  function extractAttributeValue(attribute) {
407
421
  if (!attribute.value) {
408
422
  return true;
@@ -424,6 +438,24 @@ function extractAttributeValue(attribute) {
424
438
  }
425
439
  return null;
426
440
  }
441
+ function createAttributeValue(value) {
442
+ if (value === null || value === void 0) {
443
+ return null;
444
+ }
445
+ if (typeof value === "string") {
446
+ return t.stringLiteral(value);
447
+ }
448
+ if (typeof value === "boolean") {
449
+ return t.jsxExpressionContainer(t.booleanLiteral(value));
450
+ }
451
+ if (typeof value === "number") {
452
+ return t.jsxExpressionContainer(t.numericLiteral(value));
453
+ }
454
+ if (t.isExpression(value)) {
455
+ return t.jsxExpressionContainer(value);
456
+ }
457
+ return t.jsxExpressionContainer(t.stringLiteral(JSON.stringify(value)));
458
+ }
427
459
 
428
460
  // src/utils/index.ts
429
461
  function getJsxRoots(node) {
@@ -615,13 +647,17 @@ import * as t5 from "@babel/types";
615
647
  // src/_utils.ts
616
648
  import path4 from "path";
617
649
  var getDictionaryPath = (params) => {
618
- const absolute = path4.resolve(
650
+ const toFile = path4.resolve(
619
651
  params.sourceRoot,
620
652
  params.lingoDir,
621
653
  LCP_DICTIONARY_FILE_NAME
622
654
  );
623
- const rel = path4.relative(params.relativeFilePath, absolute);
624
- return rel.split(path4.sep).join(path4.posix.sep);
655
+ const fromDir = path4.dirname(
656
+ path4.resolve(params.sourceRoot, params.relativeFilePath)
657
+ );
658
+ const relativePath = path4.relative(fromDir, toFile);
659
+ const normalizedPath = relativePath.split(path4.sep).join(path4.posix.sep);
660
+ return `./${normalizedPath}`;
625
661
  };
626
662
 
627
663
  // src/utils/create-locale-import-map.ts
@@ -877,26 +913,18 @@ var lingoJsxAttributeScopeInjectMutation = createCodeMutation(
877
913
  jsxScope.node.openingElement.attributes.push(
878
914
  t10.jsxAttribute(t10.jsxIdentifier("$attrAs"), as)
879
915
  );
880
- jsxScope.node.openingElement.attributes.push(
881
- t10.jsxAttribute(
882
- t10.jsxIdentifier("$fileKey"),
883
- t10.stringLiteral(payload.relativeFilePath)
884
- )
885
- );
886
- jsxScope.node.openingElement.attributes.push(
887
- t10.jsxAttribute(
888
- t10.jsxIdentifier("$attributes"),
889
- t10.jsxExpressionContainer(
890
- t10.objectExpression(
891
- attributes.map((attributeDefinition) => {
892
- const [attribute, key = ""] = attributeDefinition.split(":");
893
- return t10.objectProperty(
894
- t10.stringLiteral(attribute),
895
- t10.stringLiteral(key)
896
- );
897
- })
898
- )
899
- )
916
+ setJsxAttributeValue(jsxScope, "$fileKey", payload.relativeFilePath);
917
+ setJsxAttributeValue(
918
+ jsxScope,
919
+ "$attributes",
920
+ t10.objectExpression(
921
+ attributes.map((attributeDefinition) => {
922
+ const [attribute, key = ""] = attributeDefinition.split(":");
923
+ return t10.objectProperty(
924
+ t10.stringLiteral(attribute),
925
+ t10.stringLiteral(key)
926
+ );
927
+ })
900
928
  )
901
929
  );
902
930
  if (mode === "server") {
@@ -904,18 +932,14 @@ var lingoJsxAttributeScopeInjectMutation = createCodeMutation(
904
932
  exportedName: "loadDictionary",
905
933
  moduleName: ModuleId.ReactRSC
906
934
  });
907
- jsxScope.node.openingElement.attributes.push(
908
- t10.jsxAttribute(
909
- t10.jsxIdentifier("$loadDictionary"),
910
- t10.jsxExpressionContainer(
911
- t10.arrowFunctionExpression(
912
- [t10.identifier("locale")],
913
- t10.callExpression(
914
- t10.identifier(loadDictionaryImport.importedName),
915
- [t10.identifier("locale")]
916
- )
917
- )
918
- )
935
+ setJsxAttributeValue(
936
+ jsxScope,
937
+ "$loadDictionary",
938
+ t10.arrowFunctionExpression(
939
+ [t10.identifier("locale")],
940
+ t10.callExpression(t10.identifier(loadDictionaryImport.importedName), [
941
+ t10.identifier("locale")
942
+ ])
919
943
  )
920
944
  );
921
945
  }
@@ -1505,91 +1529,64 @@ var lingoJsxScopeInjectMutation = createCodeMutation((payload) => {
1505
1529
  if (!originalJsxElementName) {
1506
1530
  continue;
1507
1531
  }
1508
- const originalAttributes = jsxScope.node.openingElement.attributes.slice();
1509
- const as = /^[A-Z]/.test(originalJsxElementName) ? t21.jsxExpressionContainer(t21.identifier(originalJsxElementName)) : t21.stringLiteral(originalJsxElementName);
1510
- originalAttributes.push(t21.jsxAttribute(t21.jsxIdentifier("$as"), as));
1511
- originalAttributes.push(
1512
- t21.jsxAttribute(
1513
- t21.jsxIdentifier("$fileKey"),
1514
- t21.stringLiteral(payload.relativeFilePath)
1515
- )
1532
+ const newNode = t21.jsxElement(
1533
+ t21.jsxOpeningElement(
1534
+ t21.jsxIdentifier(lingoComponentImport.importedName),
1535
+ jsxScope.node.openingElement.attributes.slice(),
1536
+ // original attributes
1537
+ true
1538
+ // selfClosing
1539
+ ),
1540
+ null,
1541
+ // no closing element
1542
+ [],
1543
+ // no children
1544
+ true
1545
+ // selfClosing
1516
1546
  );
1517
- originalAttributes.push(
1518
- t21.jsxAttribute(
1519
- t21.jsxIdentifier("$entryKey"),
1520
- t21.stringLiteral(getJsxScopeAttribute(jsxScope))
1521
- )
1547
+ const newNodePath = {
1548
+ node: newNode
1549
+ };
1550
+ const as = /^[A-Z]/.test(originalJsxElementName) ? t21.identifier(originalJsxElementName) : originalJsxElementName;
1551
+ setJsxAttributeValue(newNodePath, "$as", as);
1552
+ setJsxAttributeValue(newNodePath, "$fileKey", payload.relativeFilePath);
1553
+ setJsxAttributeValue(
1554
+ newNodePath,
1555
+ "$entryKey",
1556
+ getJsxScopeAttribute(jsxScope)
1522
1557
  );
1523
1558
  const $variables = getJsxVariables(jsxScope);
1524
1559
  if ($variables.properties.length > 0) {
1525
- originalAttributes.push(
1526
- t21.jsxAttribute(
1527
- t21.jsxIdentifier("$variables"),
1528
- t21.jsxExpressionContainer($variables)
1529
- )
1530
- );
1560
+ setJsxAttributeValue(newNodePath, "$variables", $variables);
1531
1561
  }
1532
1562
  const $elements = getNestedJsxElements(jsxScope);
1533
1563
  if ($elements.elements.length > 0) {
1534
- originalAttributes.push(
1535
- t21.jsxAttribute(
1536
- t21.jsxIdentifier("$elements"),
1537
- t21.jsxExpressionContainer($elements)
1538
- )
1539
- );
1564
+ setJsxAttributeValue(newNodePath, "$elements", $elements);
1540
1565
  }
1541
1566
  const $functions = getJsxFunctions(jsxScope);
1542
1567
  if ($functions.properties.length > 0) {
1543
- originalAttributes.push(
1544
- t21.jsxAttribute(
1545
- t21.jsxIdentifier("$functions"),
1546
- t21.jsxExpressionContainer($functions)
1547
- )
1548
- );
1568
+ setJsxAttributeValue(newNodePath, "$functions", $functions);
1549
1569
  }
1550
1570
  const $expressions = getJsxExpressions(jsxScope);
1551
1571
  if ($expressions.elements.length > 0) {
1552
- originalAttributes.push(
1553
- t21.jsxAttribute(
1554
- t21.jsxIdentifier("$expressions"),
1555
- t21.jsxExpressionContainer($expressions)
1556
- )
1557
- );
1572
+ setJsxAttributeValue(newNodePath, "$expressions", $expressions);
1558
1573
  }
1559
1574
  if (mode === "server") {
1560
1575
  const loadDictionaryImport = getOrCreateImport(payload.ast, {
1561
1576
  exportedName: "loadDictionary",
1562
1577
  moduleName: ModuleId.ReactRSC
1563
1578
  });
1564
- originalAttributes.push(
1565
- t21.jsxAttribute(
1566
- t21.jsxIdentifier("$loadDictionary"),
1567
- t21.jsxExpressionContainer(
1568
- t21.arrowFunctionExpression(
1569
- [t21.identifier("locale")],
1570
- t21.callExpression(
1571
- t21.identifier(loadDictionaryImport.importedName),
1572
- [t21.identifier("locale")]
1573
- )
1574
- )
1575
- )
1579
+ setJsxAttributeValue(
1580
+ newNodePath,
1581
+ "$loadDictionary",
1582
+ t21.arrowFunctionExpression(
1583
+ [t21.identifier("locale")],
1584
+ t21.callExpression(t21.identifier(loadDictionaryImport.importedName), [
1585
+ t21.identifier("locale")
1586
+ ])
1576
1587
  )
1577
1588
  );
1578
1589
  }
1579
- const newNode = t21.jsxElement(
1580
- t21.jsxOpeningElement(
1581
- t21.jsxIdentifier(lingoComponentImport.importedName),
1582
- originalAttributes,
1583
- true
1584
- // selfClosing
1585
- ),
1586
- null,
1587
- // no closing element
1588
- [],
1589
- // no children
1590
- true
1591
- // selfClosing
1592
- );
1593
1590
  jsxScope.replaceWith(newNode);
1594
1591
  }
1595
1592
  return payload;
package/build/index.cjs CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
 
19
19
 
20
- var _chunkTMJ2TCIWcjs = require('./chunk-TMJ2TCIW.cjs');
20
+ var _chunk6THPNIY5cjs = require('./chunk-6THPNIY5.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.7.5",
28
+ version: "0.7.7",
29
29
  description: "Lingo.dev Compiler",
30
30
  private: false,
31
31
  publishConfig: {
@@ -132,7 +132,7 @@ async function trackEvent(event, properties) {
132
132
  }
133
133
  }
134
134
  async function getActualId() {
135
- const rc = _chunkTMJ2TCIWcjs.getRc.call(void 0, );
135
+ const rc = _chunk6THPNIY5cjs.getRc.call(void 0, );
136
136
  const apiKey = process.env.LINGODOTDEV_API_KEY || _optionalChain([rc, 'optionalAccess', _3 => _3.auth, 'optionalAccess', _4 => _4.apiKey]);
137
137
  const apiUrl = process.env.LINGODOTDEV_API_URL || _optionalChain([rc, 'optionalAccess', _5 => _5.auth, 'optionalAccess', _6 => _6.apiUrl]) || "https://engine.lingo.dev";
138
138
  if (apiKey) {
@@ -160,20 +160,20 @@ async function getActualId() {
160
160
  // src/index.ts
161
161
  var keyCheckers = {
162
162
  groq: {
163
- checkEnv: _chunkTMJ2TCIWcjs.getGroqKeyFromEnv,
164
- checkRc: _chunkTMJ2TCIWcjs.getGroqKeyFromRc
163
+ checkEnv: _chunk6THPNIY5cjs.getGroqKeyFromEnv,
164
+ checkRc: _chunk6THPNIY5cjs.getGroqKeyFromRc
165
165
  },
166
166
  google: {
167
- checkEnv: _chunkTMJ2TCIWcjs.getGoogleKeyFromEnv,
168
- checkRc: _chunkTMJ2TCIWcjs.getGoogleKeyFromRc
167
+ checkEnv: _chunk6THPNIY5cjs.getGoogleKeyFromEnv,
168
+ checkRc: _chunk6THPNIY5cjs.getGoogleKeyFromRc
169
169
  },
170
170
  mistral: {
171
- checkEnv: _chunkTMJ2TCIWcjs.getMistralKeyFromEnv,
172
- checkRc: _chunkTMJ2TCIWcjs.getMistralKeyFromRc
171
+ checkEnv: _chunk6THPNIY5cjs.getMistralKeyFromEnv,
172
+ checkRc: _chunk6THPNIY5cjs.getMistralKeyFromRc
173
173
  },
174
174
  "lingo.dev": {
175
- checkEnv: _chunkTMJ2TCIWcjs.getLingoDotDevKeyFromEnv,
176
- checkRc: _chunkTMJ2TCIWcjs.getLingoDotDevKeyFromRc
175
+ checkEnv: _chunk6THPNIY5cjs.getLingoDotDevKeyFromEnv,
176
+ checkRc: _chunk6THPNIY5cjs.getLingoDotDevKeyFromRc
177
177
  }
178
178
  };
179
179
  var alreadySentBuildEvent = { value: false };
@@ -189,14 +189,14 @@ function sendBuildEvent(framework, config, isDev) {
189
189
  var unplugin = _unplugin.createUnplugin.call(void 0,
190
190
  (_params, _meta) => {
191
191
  console.log("\u2139\uFE0F Starting Lingo.dev compiler...");
192
- const params = _lodash2.default.defaults(_params, _chunkTMJ2TCIWcjs.defaultParams);
193
- if (!_chunkTMJ2TCIWcjs.isRunningInCIOrDocker.call(void 0, )) {
192
+ const params = _lodash2.default.defaults(_params, _chunk6THPNIY5cjs.defaultParams);
193
+ if (!_chunk6THPNIY5cjs.isRunningInCIOrDocker.call(void 0, )) {
194
194
  if (params.models === "lingo.dev") {
195
195
  validateLLMKeyDetails(["lingo.dev"]);
196
196
  } else {
197
197
  const configuredProviders = getConfiguredProviders(params.models);
198
198
  validateLLMKeyDetails(configuredProviders);
199
- const invalidLocales = _chunkTMJ2TCIWcjs.getInvalidLocales.call(void 0,
199
+ const invalidLocales = _chunk6THPNIY5cjs.getInvalidLocales.call(void 0,
200
200
  params.models,
201
201
  params.sourceLocale,
202
202
  params.targetLocales
@@ -219,7 +219,7 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
219
219
  }
220
220
  }
221
221
  }
222
- _chunkTMJ2TCIWcjs.LCPCache.ensureDictionaryFile({
222
+ _chunk6THPNIY5cjs.LCPCache.ensureDictionaryFile({
223
223
  sourceRoot: params.sourceRoot,
224
224
  lingoDir: params.lingoDir
225
225
  });
@@ -227,9 +227,9 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
227
227
  sendBuildEvent("unplugin", params, isDev);
228
228
  return {
229
229
  name: package_default.name,
230
- loadInclude: (id) => !!id.match(_chunkTMJ2TCIWcjs.LCP_DICTIONARY_FILE_NAME),
230
+ loadInclude: (id) => !!id.match(_chunk6THPNIY5cjs.LCP_DICTIONARY_FILE_NAME),
231
231
  async load(id) {
232
- const dictionary = await _chunkTMJ2TCIWcjs.loadDictionary.call(void 0, {
232
+ const dictionary = await _chunk6THPNIY5cjs.loadDictionary.call(void 0, {
233
233
  resourcePath: id,
234
234
  resourceQuery: "",
235
235
  params: {
@@ -253,7 +253,7 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
253
253
  enforce: "pre",
254
254
  transform(code, id) {
255
255
  try {
256
- const result = _chunkTMJ2TCIWcjs.transformComponent.call(void 0, {
256
+ const result = _chunk6THPNIY5cjs.transformComponent.call(void 0, {
257
257
  code,
258
258
  params,
259
259
  resourcePath: id,
@@ -295,7 +295,7 @@ var src_default = {
295
295
  next: (compilerParams) => (nextConfig = {}) => {
296
296
  const mergedParams = _lodash2.default.merge(
297
297
  {},
298
- _chunkTMJ2TCIWcjs.defaultParams,
298
+ _chunk6THPNIY5cjs.defaultParams,
299
299
  {
300
300
  rsc: true,
301
301
  turbopack: {
@@ -346,7 +346,7 @@ var src_default = {
346
346
  turbopackConfigPath.rules ??= {};
347
347
  const rules = turbopackConfigPath.rules;
348
348
  const lingoGlob = `**/*.{ts,tsx,js,jsx}`;
349
- const lingoLoaderPath = _chunkTMJ2TCIWcjs.__require.resolve("./lingo-turbopack-loader.cjs");
349
+ const lingoLoaderPath = _chunk6THPNIY5cjs.__require.resolve("./lingo-turbopack-loader.cjs");
350
350
  rules[lingoGlob] = {
351
351
  loaders: [
352
352
  {
@@ -406,7 +406,7 @@ var src_default = {
406
406
  vite: (compilerParams) => (config) => {
407
407
  const mergedParams = _lodash2.default.merge(
408
408
  {},
409
- _chunkTMJ2TCIWcjs.defaultParams,
409
+ _chunk6THPNIY5cjs.defaultParams,
410
410
  { rsc: false },
411
411
  compilerParams
412
412
  );
@@ -420,7 +420,7 @@ var src_default = {
420
420
  };
421
421
  function getConfiguredProviders(models) {
422
422
  return _lodash2.default.chain(Object.values(models)).map((modelString) => modelString.split(":")[0]).filter(Boolean).uniq().filter(
423
- (providerId) => _chunkTMJ2TCIWcjs.providerDetails.hasOwnProperty(providerId) && keyCheckers.hasOwnProperty(providerId)
423
+ (providerId) => _chunk6THPNIY5cjs.providerDetails.hasOwnProperty(providerId) && keyCheckers.hasOwnProperty(providerId)
424
424
  ).value();
425
425
  }
426
426
  function validateLLMKeyDetails(configuredProviders) {
@@ -431,7 +431,7 @@ function validateLLMKeyDetails(configuredProviders) {
431
431
  const missingProviders = [];
432
432
  const foundProviders = [];
433
433
  for (const providerId of configuredProviders) {
434
- const details = _chunkTMJ2TCIWcjs.providerDetails[providerId];
434
+ const details = _chunk6THPNIY5cjs.providerDetails[providerId];
435
435
  const checkers = keyCheckers[providerId];
436
436
  if (!details || !checkers) continue;
437
437
  const foundInEnv = !!checkers.checkEnv();
package/build/index.mjs CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  loadDictionary,
18
18
  providerDetails,
19
19
  transformComponent
20
- } from "./chunk-ANLZ4QTT.mjs";
20
+ } from "./chunk-VD3GXCZS.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.7.5",
28
+ version: "0.7.7",
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 _chunkTMJ2TCIWcjs = require('./chunk-TMJ2TCIW.cjs');
4
+ var _chunk6THPNIY5cjs = require('./chunk-6THPNIY5.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 _chunkTMJ2TCIWcjs.loadDictionary.call(void 0, {
12
+ const dictionary = await _chunk6THPNIY5cjs.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 = _chunkTMJ2TCIWcjs.transformComponent.call(void 0, {
24
+ const result = _chunk6THPNIY5cjs.transformComponent.call(void 0, {
25
25
  code: source,
26
26
  params,
27
27
  resourcePath: this.resourcePath,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  loadDictionary,
3
3
  transformComponent
4
- } from "./chunk-ANLZ4QTT.mjs";
4
+ } from "./chunk-VD3GXCZS.mjs";
5
5
 
6
6
  // src/lingo-turbopack-loader.ts
7
7
  async function lingo_turbopack_loader_default(source) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingo.dev/_compiler",
3
- "version": "0.7.5",
3
+ "version": "0.7.7",
4
4
  "description": "Lingo.dev Compiler",
5
5
  "private": false,
6
6
  "publishConfig": {