@lingo.dev/_compiler 0.7.6 → 0.7.8

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.
@@ -647,13 +647,17 @@ function collectCallExpressions(path7, importNames, result, functionName) {
647
647
  // src/_utils.ts
648
648
 
649
649
  var getDictionaryPath = (params) => {
650
- const absolute = path.default.resolve(
650
+ const toFile = path.default.resolve(
651
651
  params.sourceRoot,
652
652
  params.lingoDir,
653
653
  LCP_DICTIONARY_FILE_NAME
654
654
  );
655
- const rel = path.default.relative(params.relativeFilePath, absolute);
656
- 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}`;
657
661
  };
658
662
 
659
663
  // src/utils/create-locale-import-map.ts
@@ -647,13 +647,17 @@ import * as t5 from "@babel/types";
647
647
  // src/_utils.ts
648
648
  import path4 from "path";
649
649
  var getDictionaryPath = (params) => {
650
- const absolute = path4.resolve(
650
+ const toFile = path4.resolve(
651
651
  params.sourceRoot,
652
652
  params.lingoDir,
653
653
  LCP_DICTIONARY_FILE_NAME
654
654
  );
655
- const rel = path4.relative(params.relativeFilePath, absolute);
656
- 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}`;
657
661
  };
658
662
 
659
663
  // src/utils/create-locale-import-map.ts
package/build/index.cjs CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
 
19
19
 
20
- var _chunkBX6IK562cjs = require('./chunk-BX6IK562.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.6",
28
+ version: "0.7.8",
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 = _chunkBX6IK562cjs.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: _chunkBX6IK562cjs.getGroqKeyFromEnv,
164
- checkRc: _chunkBX6IK562cjs.getGroqKeyFromRc
163
+ checkEnv: _chunk6THPNIY5cjs.getGroqKeyFromEnv,
164
+ checkRc: _chunk6THPNIY5cjs.getGroqKeyFromRc
165
165
  },
166
166
  google: {
167
- checkEnv: _chunkBX6IK562cjs.getGoogleKeyFromEnv,
168
- checkRc: _chunkBX6IK562cjs.getGoogleKeyFromRc
167
+ checkEnv: _chunk6THPNIY5cjs.getGoogleKeyFromEnv,
168
+ checkRc: _chunk6THPNIY5cjs.getGoogleKeyFromRc
169
169
  },
170
170
  mistral: {
171
- checkEnv: _chunkBX6IK562cjs.getMistralKeyFromEnv,
172
- checkRc: _chunkBX6IK562cjs.getMistralKeyFromRc
171
+ checkEnv: _chunk6THPNIY5cjs.getMistralKeyFromEnv,
172
+ checkRc: _chunk6THPNIY5cjs.getMistralKeyFromRc
173
173
  },
174
174
  "lingo.dev": {
175
- checkEnv: _chunkBX6IK562cjs.getLingoDotDevKeyFromEnv,
176
- checkRc: _chunkBX6IK562cjs.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, _chunkBX6IK562cjs.defaultParams);
193
- if (!_chunkBX6IK562cjs.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 = _chunkBX6IK562cjs.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
- _chunkBX6IK562cjs.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(_chunkBX6IK562cjs.LCP_DICTIONARY_FILE_NAME),
230
+ loadInclude: (id) => !!id.match(_chunk6THPNIY5cjs.LCP_DICTIONARY_FILE_NAME),
231
231
  async load(id) {
232
- const dictionary = await _chunkBX6IK562cjs.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 = _chunkBX6IK562cjs.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
- _chunkBX6IK562cjs.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 = _chunkBX6IK562cjs.__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
- _chunkBX6IK562cjs.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) => _chunkBX6IK562cjs.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 = _chunkBX6IK562cjs.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-3ZKCOBSO.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.6",
28
+ version: "0.7.8",
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 _chunkBX6IK562cjs = require('./chunk-BX6IK562.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 _chunkBX6IK562cjs.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 = _chunkBX6IK562cjs.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-3ZKCOBSO.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.6",
3
+ "version": "0.7.8",
4
4
  "description": "Lingo.dev Compiler",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -52,8 +52,8 @@
52
52
  "zod": "^3.25.76",
53
53
  "posthog-node": "^5.5.1",
54
54
  "node-machine-id": "^1.1.12",
55
- "@lingo.dev/_sdk": "0.12.0",
56
- "@lingo.dev/_spec": "0.40.0"
55
+ "@lingo.dev/_sdk": "0.12.1",
56
+ "@lingo.dev/_spec": "0.40.1"
57
57
  },
58
58
  "scripts": {
59
59
  "dev": "tsup --watch",