@lingo.dev/_compiler 0.8.12 → 0.9.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-OAQHCRD4.mjs → chunk-B6UBZSM3.mjs} +1 -1
- package/build/{chunk-NKMWW3RS.cjs → chunk-DZX4HCIU.cjs} +2 -2
- package/build/index.cjs +68 -71
- package/build/index.mjs +48 -51
- package/build/lingo-turbopack-loader.cjs +3 -3
- package/build/lingo-turbopack-loader.mjs +1 -1
- package/package.json +10 -10
|
@@ -21586,7 +21586,7 @@ import _10 from "lodash";
|
|
|
21586
21586
|
import { createGroq } from "@ai-sdk/groq";
|
|
21587
21587
|
import { createGoogleGenerativeAI } from "@ai-sdk/google";
|
|
21588
21588
|
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
|
|
21589
|
-
import { createOllama } from "ollama-ai-provider";
|
|
21589
|
+
import { createOllama } from "ollama-ai-provider-v2";
|
|
21590
21590
|
import { createMistral } from "@ai-sdk/mistral";
|
|
21591
21591
|
import { createOpenAI } from "@ai-sdk/openai";
|
|
21592
21592
|
import { createAnthropic } from "@ai-sdk/anthropic";
|
|
@@ -21587,7 +21587,7 @@ function jsxScopesExportMutation(payload) {
|
|
|
21587
21587
|
var _groq = require('@ai-sdk/groq');
|
|
21588
21588
|
var _google = require('@ai-sdk/google');
|
|
21589
21589
|
var _aisdkprovider = require('@openrouter/ai-sdk-provider');
|
|
21590
|
-
var
|
|
21590
|
+
var _ollamaaiproviderv2 = require('ollama-ai-provider-v2');
|
|
21591
21591
|
var _mistral = require('@ai-sdk/mistral');
|
|
21592
21592
|
var _openai = require('@ai-sdk/openai');
|
|
21593
21593
|
var _anthropic = require('@ai-sdk/anthropic');
|
|
@@ -22055,7 +22055,7 @@ var LCPAPI = class {
|
|
|
22055
22055
|
console.log(
|
|
22056
22056
|
`Creating Ollama client for ${targetLocale} using model ${modelId} at default Ollama address`
|
|
22057
22057
|
);
|
|
22058
|
-
return
|
|
22058
|
+
return _ollamaaiproviderv2.createOllama.call(void 0, )(modelId);
|
|
22059
22059
|
}
|
|
22060
22060
|
case "mistral": {
|
|
22061
22061
|
if (isRunningInCIOrDocker()) {
|
package/build/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkDZX4HCIUcjs = require('./chunk-DZX4HCIU.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
var _chunkO75UYLMXcjs = require('./chunk-O75UYLMX.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.
|
|
30
|
+
version: "0.9.1",
|
|
31
31
|
description: "Lingo.dev Compiler",
|
|
32
32
|
private: false,
|
|
33
33
|
repository: {
|
|
@@ -78,19 +78,19 @@ var package_default = {
|
|
|
78
78
|
vitest: "4.0.13"
|
|
79
79
|
},
|
|
80
80
|
dependencies: {
|
|
81
|
-
"@ai-sdk/anthropic": "
|
|
82
|
-
"@ai-sdk/google": "
|
|
83
|
-
"@ai-sdk/groq": "
|
|
84
|
-
"@ai-sdk/mistral": "
|
|
85
|
-
"@ai-sdk/openai": "
|
|
81
|
+
"@ai-sdk/anthropic": "3.0.9",
|
|
82
|
+
"@ai-sdk/google": "3.0.6",
|
|
83
|
+
"@ai-sdk/groq": "3.0.4",
|
|
84
|
+
"@ai-sdk/mistral": "3.0.5",
|
|
85
|
+
"@ai-sdk/openai": "3.0.7",
|
|
86
86
|
"@babel/generator": "7.28.5",
|
|
87
87
|
"@babel/parser": "7.28.5",
|
|
88
88
|
"@babel/traverse": "7.28.5",
|
|
89
89
|
"@babel/types": "7.28.5",
|
|
90
90
|
"@lingo.dev/_sdk": "workspace:*",
|
|
91
91
|
"@lingo.dev/_spec": "workspace:*",
|
|
92
|
-
"@openrouter/ai-sdk-provider": "0.
|
|
93
|
-
ai: "
|
|
92
|
+
"@openrouter/ai-sdk-provider": "6.0.0-alpha.1",
|
|
93
|
+
ai: "6.0.25",
|
|
94
94
|
dedent: "1.7.0",
|
|
95
95
|
dotenv: "16.4.5",
|
|
96
96
|
"fast-xml-parser": "5.3.2",
|
|
@@ -98,10 +98,10 @@ var package_default = {
|
|
|
98
98
|
lodash: "4.17.21",
|
|
99
99
|
"node-machine-id": "1.1.12",
|
|
100
100
|
"object-hash": "3.0.0",
|
|
101
|
-
"ollama-ai-provider": "
|
|
101
|
+
"ollama-ai-provider-v2": "2.0.0",
|
|
102
102
|
"posthog-node": "5.14.0",
|
|
103
103
|
unplugin: "2.3.11",
|
|
104
|
-
zod: "
|
|
104
|
+
zod: "4.1.12"
|
|
105
105
|
},
|
|
106
106
|
packageManager: "pnpm@9.12.3"
|
|
107
107
|
};
|
|
@@ -113,44 +113,41 @@ var _dedent = require('dedent'); var _dedent2 = _interopRequireDefault(_dedent);
|
|
|
113
113
|
// src/utils/observability.ts
|
|
114
114
|
var _nodemachineid = require('node-machine-id'); var machineIdLib = _interopRequireWildcard(_nodemachineid);
|
|
115
115
|
|
|
116
|
-
// src/utils/
|
|
116
|
+
// src/utils/org-id.ts
|
|
117
117
|
var _child_process = require('child_process');
|
|
118
|
-
var
|
|
119
|
-
|
|
120
|
-
function hashProjectName(fullPath) {
|
|
118
|
+
var cachedGitOrgId = void 0;
|
|
119
|
+
function extractOrg(fullPath) {
|
|
121
120
|
const parts = fullPath.split("/");
|
|
122
|
-
if (parts.length
|
|
123
|
-
return
|
|
121
|
+
if (parts.length < 1) {
|
|
122
|
+
return null;
|
|
124
123
|
}
|
|
125
|
-
|
|
126
|
-
const hashedProject = _crypto.createHash.call(void 0, "sha256").update(project).digest("hex").slice(0, 8);
|
|
127
|
-
return `${org}/${hashedProject}`;
|
|
124
|
+
return parts[0];
|
|
128
125
|
}
|
|
129
|
-
function
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
126
|
+
function getOrgId() {
|
|
127
|
+
const ciOrgId = getCIOrgId();
|
|
128
|
+
if (ciOrgId) return ciOrgId;
|
|
129
|
+
const gitOrgId = getGitOrgId();
|
|
130
|
+
if (gitOrgId) return gitOrgId;
|
|
134
131
|
return null;
|
|
135
132
|
}
|
|
136
|
-
function
|
|
133
|
+
function getCIOrgId() {
|
|
137
134
|
if (process.env.GITHUB_REPOSITORY) {
|
|
138
|
-
const
|
|
139
|
-
return `github:${
|
|
135
|
+
const org = extractOrg(process.env.GITHUB_REPOSITORY);
|
|
136
|
+
if (org) return `github:${org}`;
|
|
140
137
|
}
|
|
141
138
|
if (process.env.CI_PROJECT_PATH) {
|
|
142
|
-
const
|
|
143
|
-
return `gitlab:${
|
|
139
|
+
const org = extractOrg(process.env.CI_PROJECT_PATH);
|
|
140
|
+
if (org) return `gitlab:${org}`;
|
|
144
141
|
}
|
|
145
142
|
if (process.env.BITBUCKET_REPO_FULL_NAME) {
|
|
146
|
-
const
|
|
147
|
-
return `bitbucket:${
|
|
143
|
+
const org = extractOrg(process.env.BITBUCKET_REPO_FULL_NAME);
|
|
144
|
+
if (org) return `bitbucket:${org}`;
|
|
148
145
|
}
|
|
149
146
|
return null;
|
|
150
147
|
}
|
|
151
|
-
function
|
|
152
|
-
if (
|
|
153
|
-
return
|
|
148
|
+
function getGitOrgId() {
|
|
149
|
+
if (cachedGitOrgId !== void 0) {
|
|
150
|
+
return cachedGitOrgId;
|
|
154
151
|
}
|
|
155
152
|
try {
|
|
156
153
|
const remoteUrl = _child_process.execSync.call(void 0, "git config --get remote.origin.url", {
|
|
@@ -158,13 +155,13 @@ function getGitRepositoryId() {
|
|
|
158
155
|
stdio: ["pipe", "pipe", "ignore"]
|
|
159
156
|
}).trim();
|
|
160
157
|
if (!remoteUrl) {
|
|
161
|
-
|
|
158
|
+
cachedGitOrgId = null;
|
|
162
159
|
return null;
|
|
163
160
|
}
|
|
164
|
-
|
|
165
|
-
return
|
|
161
|
+
cachedGitOrgId = parseGitUrl(remoteUrl);
|
|
162
|
+
return cachedGitOrgId;
|
|
166
163
|
} catch (e) {
|
|
167
|
-
|
|
164
|
+
cachedGitOrgId = null;
|
|
168
165
|
return null;
|
|
169
166
|
}
|
|
170
167
|
}
|
|
@@ -182,11 +179,12 @@ function parseGitUrl(url) {
|
|
|
182
179
|
const httpsMatch = cleanUrl.match(/\/([^/]+\/[^/]+)$/);
|
|
183
180
|
const repoPath = _optionalChain([sshMatch, 'optionalAccess', _2 => _2[1]]) || _optionalChain([httpsMatch, 'optionalAccess', _3 => _3[1]]);
|
|
184
181
|
if (!repoPath) return null;
|
|
185
|
-
const
|
|
182
|
+
const org = extractOrg(repoPath);
|
|
183
|
+
if (!org) return null;
|
|
186
184
|
if (platform) {
|
|
187
|
-
return `${platform}:${
|
|
185
|
+
return `${platform}:${org}`;
|
|
188
186
|
}
|
|
189
|
-
return `git:${
|
|
187
|
+
return `git:${org}`;
|
|
190
188
|
}
|
|
191
189
|
|
|
192
190
|
// src/utils/observability.ts
|
|
@@ -219,7 +217,7 @@ async function trackEvent(event, properties) {
|
|
|
219
217
|
isByokMode: _optionalChain([properties, 'optionalAccess', _4 => _4.models]) !== "lingo.dev",
|
|
220
218
|
tracking_version: TRACKING_VERSION,
|
|
221
219
|
distinct_id_source: identityInfo.distinct_id_source,
|
|
222
|
-
|
|
220
|
+
org_id: identityInfo.org_id,
|
|
223
221
|
meta: {
|
|
224
222
|
version: process.env.npm_package_version,
|
|
225
223
|
isCi: process.env.CI === "true"
|
|
@@ -234,21 +232,20 @@ async function trackEvent(event, properties) {
|
|
|
234
232
|
}
|
|
235
233
|
}
|
|
236
234
|
async function getDistinctId() {
|
|
235
|
+
const orgId = getOrgId();
|
|
237
236
|
const email = await tryGetEmail();
|
|
238
237
|
if (email) {
|
|
239
|
-
const projectId = getRepositoryId();
|
|
240
238
|
return {
|
|
241
239
|
distinct_id: email,
|
|
242
240
|
distinct_id_source: "email",
|
|
243
|
-
|
|
241
|
+
org_id: orgId
|
|
244
242
|
};
|
|
245
243
|
}
|
|
246
|
-
|
|
247
|
-
if (repoId) {
|
|
244
|
+
if (orgId) {
|
|
248
245
|
return {
|
|
249
|
-
distinct_id:
|
|
250
|
-
distinct_id_source: "
|
|
251
|
-
|
|
246
|
+
distinct_id: orgId,
|
|
247
|
+
distinct_id_source: "git_org",
|
|
248
|
+
org_id: orgId
|
|
252
249
|
};
|
|
253
250
|
}
|
|
254
251
|
const deviceId = `device-${await machineIdLib.machineId()}`;
|
|
@@ -260,11 +257,11 @@ async function getDistinctId() {
|
|
|
260
257
|
return {
|
|
261
258
|
distinct_id: deviceId,
|
|
262
259
|
distinct_id_source: "device",
|
|
263
|
-
|
|
260
|
+
org_id: null
|
|
264
261
|
};
|
|
265
262
|
}
|
|
266
263
|
async function tryGetEmail() {
|
|
267
|
-
const rc =
|
|
264
|
+
const rc = _chunkDZX4HCIUcjs.getRc.call(void 0, );
|
|
268
265
|
const apiKey = process.env.LINGODOTDEV_API_KEY || _optionalChain([rc, 'optionalAccess', _5 => _5.auth, 'optionalAccess', _6 => _6.apiKey]);
|
|
269
266
|
const apiUrl = process.env.LINGODOTDEV_API_URL || _optionalChain([rc, 'optionalAccess', _7 => _7.auth, 'optionalAccess', _8 => _8.apiUrl]) || "https://engine.lingo.dev";
|
|
270
267
|
if (!apiKey) {
|
|
@@ -292,20 +289,20 @@ async function tryGetEmail() {
|
|
|
292
289
|
// src/index.ts
|
|
293
290
|
var keyCheckers = {
|
|
294
291
|
groq: {
|
|
295
|
-
checkEnv:
|
|
296
|
-
checkRc:
|
|
292
|
+
checkEnv: _chunkDZX4HCIUcjs.getGroqKeyFromEnv,
|
|
293
|
+
checkRc: _chunkDZX4HCIUcjs.getGroqKeyFromRc
|
|
297
294
|
},
|
|
298
295
|
google: {
|
|
299
|
-
checkEnv:
|
|
300
|
-
checkRc:
|
|
296
|
+
checkEnv: _chunkDZX4HCIUcjs.getGoogleKeyFromEnv,
|
|
297
|
+
checkRc: _chunkDZX4HCIUcjs.getGoogleKeyFromRc
|
|
301
298
|
},
|
|
302
299
|
mistral: {
|
|
303
|
-
checkEnv:
|
|
304
|
-
checkRc:
|
|
300
|
+
checkEnv: _chunkDZX4HCIUcjs.getMistralKeyFromEnv,
|
|
301
|
+
checkRc: _chunkDZX4HCIUcjs.getMistralKeyFromRc
|
|
305
302
|
},
|
|
306
303
|
"lingo.dev": {
|
|
307
|
-
checkEnv:
|
|
308
|
-
checkRc:
|
|
304
|
+
checkEnv: _chunkDZX4HCIUcjs.getLingoDotDevKeyFromEnv,
|
|
305
|
+
checkRc: _chunkDZX4HCIUcjs.getLingoDotDevKeyFromRc
|
|
309
306
|
}
|
|
310
307
|
};
|
|
311
308
|
var alreadySentBuildEvent = { value: false };
|
|
@@ -321,14 +318,14 @@ function sendBuildEvent(framework, config, isDev) {
|
|
|
321
318
|
var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
322
319
|
(_params, _meta) => {
|
|
323
320
|
console.log("\u2139\uFE0F Starting Lingo.dev compiler...");
|
|
324
|
-
const params = _lodash2.default.defaults(_params,
|
|
325
|
-
if (!
|
|
321
|
+
const params = _lodash2.default.defaults(_params, _chunkDZX4HCIUcjs.defaultParams);
|
|
322
|
+
if (!_chunkDZX4HCIUcjs.isRunningInCIOrDocker.call(void 0, )) {
|
|
326
323
|
if (params.models === "lingo.dev") {
|
|
327
324
|
validateLLMKeyDetails(["lingo.dev"]);
|
|
328
325
|
} else {
|
|
329
326
|
const configuredProviders = getConfiguredProviders(params.models);
|
|
330
327
|
validateLLMKeyDetails(configuredProviders);
|
|
331
|
-
const invalidLocales =
|
|
328
|
+
const invalidLocales = _chunkDZX4HCIUcjs.getInvalidLocales.call(void 0,
|
|
332
329
|
params.models,
|
|
333
330
|
params.sourceLocale,
|
|
334
331
|
params.targetLocales
|
|
@@ -347,7 +344,7 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
|
347
344
|
}
|
|
348
345
|
}
|
|
349
346
|
}
|
|
350
|
-
|
|
347
|
+
_chunkDZX4HCIUcjs.LCPCache.ensureDictionaryFile({
|
|
351
348
|
sourceRoot: params.sourceRoot,
|
|
352
349
|
lingoDir: params.lingoDir
|
|
353
350
|
});
|
|
@@ -355,9 +352,9 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
|
355
352
|
sendBuildEvent("unplugin", params, isDev);
|
|
356
353
|
return {
|
|
357
354
|
name: package_default.name,
|
|
358
|
-
loadInclude: (id) => !!id.match(
|
|
355
|
+
loadInclude: (id) => !!id.match(_chunkDZX4HCIUcjs.LCP_DICTIONARY_FILE_NAME),
|
|
359
356
|
async load(id) {
|
|
360
|
-
const dictionary = await
|
|
357
|
+
const dictionary = await _chunkDZX4HCIUcjs.loadDictionary.call(void 0, {
|
|
361
358
|
resourcePath: id,
|
|
362
359
|
resourceQuery: "",
|
|
363
360
|
params: {
|
|
@@ -381,7 +378,7 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
|
|
|
381
378
|
enforce: "pre",
|
|
382
379
|
transform(code, id) {
|
|
383
380
|
try {
|
|
384
|
-
const result =
|
|
381
|
+
const result = _chunkDZX4HCIUcjs.transformComponent.call(void 0, {
|
|
385
382
|
code,
|
|
386
383
|
params,
|
|
387
384
|
resourcePath: id,
|
|
@@ -423,7 +420,7 @@ var index_default = {
|
|
|
423
420
|
next: (compilerParams) => (nextConfig = {}) => {
|
|
424
421
|
const mergedParams = _lodash2.default.merge(
|
|
425
422
|
{},
|
|
426
|
-
|
|
423
|
+
_chunkDZX4HCIUcjs.defaultParams,
|
|
427
424
|
{
|
|
428
425
|
rsc: true,
|
|
429
426
|
turbopack: {
|
|
@@ -534,7 +531,7 @@ var index_default = {
|
|
|
534
531
|
vite: (compilerParams) => (config) => {
|
|
535
532
|
const mergedParams = _lodash2.default.merge(
|
|
536
533
|
{},
|
|
537
|
-
|
|
534
|
+
_chunkDZX4HCIUcjs.defaultParams,
|
|
538
535
|
{ rsc: false },
|
|
539
536
|
compilerParams
|
|
540
537
|
);
|
|
@@ -548,7 +545,7 @@ var index_default = {
|
|
|
548
545
|
};
|
|
549
546
|
function getConfiguredProviders(models) {
|
|
550
547
|
return _lodash2.default.chain(Object.values(models)).map((modelString) => modelString.split(":")[0]).filter(Boolean).uniq().filter(
|
|
551
|
-
(providerId) =>
|
|
548
|
+
(providerId) => _chunkDZX4HCIUcjs.providerDetails.hasOwnProperty(providerId) && keyCheckers.hasOwnProperty(providerId)
|
|
552
549
|
).value();
|
|
553
550
|
}
|
|
554
551
|
function validateLLMKeyDetails(configuredProviders) {
|
|
@@ -559,7 +556,7 @@ function validateLLMKeyDetails(configuredProviders) {
|
|
|
559
556
|
const missingProviders = [];
|
|
560
557
|
const foundProviders = [];
|
|
561
558
|
for (const providerId of configuredProviders) {
|
|
562
|
-
const details =
|
|
559
|
+
const details = _chunkDZX4HCIUcjs.providerDetails[providerId];
|
|
563
560
|
const checkers = keyCheckers[providerId];
|
|
564
561
|
if (!details || !checkers) continue;
|
|
565
562
|
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-B6UBZSM3.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.
|
|
30
|
+
version: "0.9.1",
|
|
31
31
|
description: "Lingo.dev Compiler",
|
|
32
32
|
private: false,
|
|
33
33
|
repository: {
|
|
@@ -78,19 +78,19 @@ var package_default = {
|
|
|
78
78
|
vitest: "4.0.13"
|
|
79
79
|
},
|
|
80
80
|
dependencies: {
|
|
81
|
-
"@ai-sdk/anthropic": "
|
|
82
|
-
"@ai-sdk/google": "
|
|
83
|
-
"@ai-sdk/groq": "
|
|
84
|
-
"@ai-sdk/mistral": "
|
|
85
|
-
"@ai-sdk/openai": "
|
|
81
|
+
"@ai-sdk/anthropic": "3.0.9",
|
|
82
|
+
"@ai-sdk/google": "3.0.6",
|
|
83
|
+
"@ai-sdk/groq": "3.0.4",
|
|
84
|
+
"@ai-sdk/mistral": "3.0.5",
|
|
85
|
+
"@ai-sdk/openai": "3.0.7",
|
|
86
86
|
"@babel/generator": "7.28.5",
|
|
87
87
|
"@babel/parser": "7.28.5",
|
|
88
88
|
"@babel/traverse": "7.28.5",
|
|
89
89
|
"@babel/types": "7.28.5",
|
|
90
90
|
"@lingo.dev/_sdk": "workspace:*",
|
|
91
91
|
"@lingo.dev/_spec": "workspace:*",
|
|
92
|
-
"@openrouter/ai-sdk-provider": "0.
|
|
93
|
-
ai: "
|
|
92
|
+
"@openrouter/ai-sdk-provider": "6.0.0-alpha.1",
|
|
93
|
+
ai: "6.0.25",
|
|
94
94
|
dedent: "1.7.0",
|
|
95
95
|
dotenv: "16.4.5",
|
|
96
96
|
"fast-xml-parser": "5.3.2",
|
|
@@ -98,10 +98,10 @@ var package_default = {
|
|
|
98
98
|
lodash: "4.17.21",
|
|
99
99
|
"node-machine-id": "1.1.12",
|
|
100
100
|
"object-hash": "3.0.0",
|
|
101
|
-
"ollama-ai-provider": "
|
|
101
|
+
"ollama-ai-provider-v2": "2.0.0",
|
|
102
102
|
"posthog-node": "5.14.0",
|
|
103
103
|
unplugin: "2.3.11",
|
|
104
|
-
zod: "
|
|
104
|
+
zod: "4.1.12"
|
|
105
105
|
},
|
|
106
106
|
packageManager: "pnpm@9.12.3"
|
|
107
107
|
};
|
|
@@ -113,44 +113,41 @@ import dedent from "dedent";
|
|
|
113
113
|
// src/utils/observability.ts
|
|
114
114
|
import * as machineIdLib from "node-machine-id";
|
|
115
115
|
|
|
116
|
-
// src/utils/
|
|
116
|
+
// src/utils/org-id.ts
|
|
117
117
|
import { execSync } from "child_process";
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
function hashProjectName(fullPath) {
|
|
118
|
+
var cachedGitOrgId = void 0;
|
|
119
|
+
function extractOrg(fullPath) {
|
|
121
120
|
const parts = fullPath.split("/");
|
|
122
|
-
if (parts.length
|
|
123
|
-
return
|
|
121
|
+
if (parts.length < 1) {
|
|
122
|
+
return null;
|
|
124
123
|
}
|
|
125
|
-
|
|
126
|
-
const hashedProject = createHash("sha256").update(project).digest("hex").slice(0, 8);
|
|
127
|
-
return `${org}/${hashedProject}`;
|
|
124
|
+
return parts[0];
|
|
128
125
|
}
|
|
129
|
-
function
|
|
130
|
-
const
|
|
131
|
-
if (
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
126
|
+
function getOrgId() {
|
|
127
|
+
const ciOrgId = getCIOrgId();
|
|
128
|
+
if (ciOrgId) return ciOrgId;
|
|
129
|
+
const gitOrgId = getGitOrgId();
|
|
130
|
+
if (gitOrgId) return gitOrgId;
|
|
134
131
|
return null;
|
|
135
132
|
}
|
|
136
|
-
function
|
|
133
|
+
function getCIOrgId() {
|
|
137
134
|
if (process.env.GITHUB_REPOSITORY) {
|
|
138
|
-
const
|
|
139
|
-
return `github:${
|
|
135
|
+
const org = extractOrg(process.env.GITHUB_REPOSITORY);
|
|
136
|
+
if (org) return `github:${org}`;
|
|
140
137
|
}
|
|
141
138
|
if (process.env.CI_PROJECT_PATH) {
|
|
142
|
-
const
|
|
143
|
-
return `gitlab:${
|
|
139
|
+
const org = extractOrg(process.env.CI_PROJECT_PATH);
|
|
140
|
+
if (org) return `gitlab:${org}`;
|
|
144
141
|
}
|
|
145
142
|
if (process.env.BITBUCKET_REPO_FULL_NAME) {
|
|
146
|
-
const
|
|
147
|
-
return `bitbucket:${
|
|
143
|
+
const org = extractOrg(process.env.BITBUCKET_REPO_FULL_NAME);
|
|
144
|
+
if (org) return `bitbucket:${org}`;
|
|
148
145
|
}
|
|
149
146
|
return null;
|
|
150
147
|
}
|
|
151
|
-
function
|
|
152
|
-
if (
|
|
153
|
-
return
|
|
148
|
+
function getGitOrgId() {
|
|
149
|
+
if (cachedGitOrgId !== void 0) {
|
|
150
|
+
return cachedGitOrgId;
|
|
154
151
|
}
|
|
155
152
|
try {
|
|
156
153
|
const remoteUrl = execSync("git config --get remote.origin.url", {
|
|
@@ -158,13 +155,13 @@ function getGitRepositoryId() {
|
|
|
158
155
|
stdio: ["pipe", "pipe", "ignore"]
|
|
159
156
|
}).trim();
|
|
160
157
|
if (!remoteUrl) {
|
|
161
|
-
|
|
158
|
+
cachedGitOrgId = null;
|
|
162
159
|
return null;
|
|
163
160
|
}
|
|
164
|
-
|
|
165
|
-
return
|
|
161
|
+
cachedGitOrgId = parseGitUrl(remoteUrl);
|
|
162
|
+
return cachedGitOrgId;
|
|
166
163
|
} catch {
|
|
167
|
-
|
|
164
|
+
cachedGitOrgId = null;
|
|
168
165
|
return null;
|
|
169
166
|
}
|
|
170
167
|
}
|
|
@@ -182,11 +179,12 @@ function parseGitUrl(url) {
|
|
|
182
179
|
const httpsMatch = cleanUrl.match(/\/([^/]+\/[^/]+)$/);
|
|
183
180
|
const repoPath = sshMatch?.[1] || httpsMatch?.[1];
|
|
184
181
|
if (!repoPath) return null;
|
|
185
|
-
const
|
|
182
|
+
const org = extractOrg(repoPath);
|
|
183
|
+
if (!org) return null;
|
|
186
184
|
if (platform) {
|
|
187
|
-
return `${platform}:${
|
|
185
|
+
return `${platform}:${org}`;
|
|
188
186
|
}
|
|
189
|
-
return `git:${
|
|
187
|
+
return `git:${org}`;
|
|
190
188
|
}
|
|
191
189
|
|
|
192
190
|
// src/utils/observability.ts
|
|
@@ -219,7 +217,7 @@ async function trackEvent(event, properties) {
|
|
|
219
217
|
isByokMode: properties?.models !== "lingo.dev",
|
|
220
218
|
tracking_version: TRACKING_VERSION,
|
|
221
219
|
distinct_id_source: identityInfo.distinct_id_source,
|
|
222
|
-
|
|
220
|
+
org_id: identityInfo.org_id,
|
|
223
221
|
meta: {
|
|
224
222
|
version: process.env.npm_package_version,
|
|
225
223
|
isCi: process.env.CI === "true"
|
|
@@ -234,21 +232,20 @@ async function trackEvent(event, properties) {
|
|
|
234
232
|
}
|
|
235
233
|
}
|
|
236
234
|
async function getDistinctId() {
|
|
235
|
+
const orgId = getOrgId();
|
|
237
236
|
const email = await tryGetEmail();
|
|
238
237
|
if (email) {
|
|
239
|
-
const projectId = getRepositoryId();
|
|
240
238
|
return {
|
|
241
239
|
distinct_id: email,
|
|
242
240
|
distinct_id_source: "email",
|
|
243
|
-
|
|
241
|
+
org_id: orgId
|
|
244
242
|
};
|
|
245
243
|
}
|
|
246
|
-
|
|
247
|
-
if (repoId) {
|
|
244
|
+
if (orgId) {
|
|
248
245
|
return {
|
|
249
|
-
distinct_id:
|
|
250
|
-
distinct_id_source: "
|
|
251
|
-
|
|
246
|
+
distinct_id: orgId,
|
|
247
|
+
distinct_id_source: "git_org",
|
|
248
|
+
org_id: orgId
|
|
252
249
|
};
|
|
253
250
|
}
|
|
254
251
|
const deviceId = `device-${await machineIdLib.machineId()}`;
|
|
@@ -260,7 +257,7 @@ async function getDistinctId() {
|
|
|
260
257
|
return {
|
|
261
258
|
distinct_id: deviceId,
|
|
262
259
|
distinct_id_source: "device",
|
|
263
|
-
|
|
260
|
+
org_id: null
|
|
264
261
|
};
|
|
265
262
|
}
|
|
266
263
|
async function tryGetEmail() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkDZX4HCIUcjs = require('./chunk-DZX4HCIU.cjs');
|
|
5
5
|
require('./chunk-O75UYLMX.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 _chunkDZX4HCIUcjs.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 = _chunkDZX4HCIUcjs.transformComponent.call(void 0, {
|
|
26
26
|
code: source,
|
|
27
27
|
params,
|
|
28
28
|
resourcePath: this.resourcePath,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lingo.dev/_compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Lingo.dev Compiler",
|
|
5
5
|
"private": false,
|
|
6
6
|
"repository": {
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"vitest": "4.0.13"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@ai-sdk/anthropic": "
|
|
47
|
-
"@ai-sdk/google": "
|
|
48
|
-
"@ai-sdk/groq": "
|
|
49
|
-
"@ai-sdk/mistral": "
|
|
50
|
-
"@ai-sdk/openai": "
|
|
46
|
+
"@ai-sdk/anthropic": "3.0.9",
|
|
47
|
+
"@ai-sdk/google": "3.0.6",
|
|
48
|
+
"@ai-sdk/groq": "3.0.4",
|
|
49
|
+
"@ai-sdk/mistral": "3.0.5",
|
|
50
|
+
"@ai-sdk/openai": "3.0.7",
|
|
51
51
|
"@babel/generator": "7.28.5",
|
|
52
52
|
"@babel/parser": "7.28.5",
|
|
53
53
|
"@babel/traverse": "7.28.5",
|
|
54
54
|
"@babel/types": "7.28.5",
|
|
55
|
-
"@openrouter/ai-sdk-provider": "0.
|
|
56
|
-
"ai": "
|
|
55
|
+
"@openrouter/ai-sdk-provider": "6.0.0-alpha.1",
|
|
56
|
+
"ai": "6.0.25",
|
|
57
57
|
"dedent": "1.7.0",
|
|
58
58
|
"dotenv": "16.4.5",
|
|
59
59
|
"fast-xml-parser": "5.3.2",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"lodash": "4.17.21",
|
|
62
62
|
"node-machine-id": "1.1.12",
|
|
63
63
|
"object-hash": "3.0.0",
|
|
64
|
-
"ollama-ai-provider": "
|
|
64
|
+
"ollama-ai-provider-v2": "2.0.0",
|
|
65
65
|
"posthog-node": "5.14.0",
|
|
66
66
|
"unplugin": "2.3.11",
|
|
67
|
-
"zod": "
|
|
67
|
+
"zod": "4.1.12",
|
|
68
68
|
"@lingo.dev/_sdk": "0.13.7",
|
|
69
69
|
"@lingo.dev/_spec": "0.46.0"
|
|
70
70
|
},
|