@lingo.dev/_compiler 0.10.0 → 0.10.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/README.md CHANGED
@@ -1,5 +1,92 @@
1
- # Lingo.dev Compiler
1
+ # Lingo.dev Compiler (Legacy)
2
2
 
3
- **Lingo.dev Compiler** is a free, open-source compiler middleware, that makes React apps multilingual at build time without requiring any changes to the existing React components.
3
+ > **DEPRECATED:** This package (`@lingo.dev/_compiler`) is deprecated. Please migrate to `@lingo.dev/compiler` (the new compiler).
4
4
 
5
- Documentation: https://lingo.dev/compiler
5
+ ## Migration
6
+
7
+ Install the new compiler:
8
+
9
+ ```bash
10
+ npm install @lingo.dev/compiler
11
+ ```
12
+
13
+ Update your configuration:
14
+
15
+ **Next.js (before):**
16
+ ```ts
17
+ import lingoCompiler from "@lingo.dev/_compiler";
18
+ import type { NextConfig } from "next";
19
+
20
+ const nextConfig: NextConfig = {};
21
+
22
+ export default lingoCompiler.next({
23
+ sourceRoot: "app",
24
+ models: "lingo.dev",
25
+ })(nextConfig);
26
+ ```
27
+
28
+ **Next.js (after):**
29
+ ```ts
30
+ import type { NextConfig } from "next";
31
+ import { withLingo } from "@lingo.dev/compiler/next";
32
+
33
+ const nextConfig: NextConfig = {};
34
+
35
+ export default async function (): Promise<NextConfig> {
36
+ return await withLingo(nextConfig, {
37
+ sourceLocale: "en",
38
+ targetLocales: ["es", "fr"],
39
+ models: "lingo.dev",
40
+ });
41
+ }
42
+ ```
43
+
44
+ **Vite (before):**
45
+ ```ts
46
+ import { defineConfig, type UserConfig } from "vite";
47
+ import react from "@vitejs/plugin-react";
48
+ import lingoCompiler from "@lingo.dev/_compiler";
49
+
50
+ const viteConfig: UserConfig = {
51
+ plugins: [react()],
52
+ };
53
+
54
+ export default defineConfig(() =>
55
+ lingoCompiler.vite({
56
+ models: "lingo.dev",
57
+ })(viteConfig)
58
+ );
59
+ ```
60
+
61
+ **Vite (after):**
62
+ ```ts
63
+ import { defineConfig, type UserConfig } from "vite";
64
+ import react from "@vitejs/plugin-react";
65
+ import { withLingo } from "@lingo.dev/compiler/vite";
66
+
67
+ const viteConfig: UserConfig = {
68
+ plugins: [react()],
69
+ };
70
+
71
+ export default defineConfig(async () =>
72
+ await withLingo(viteConfig, {
73
+ sourceLocale: "en",
74
+ targetLocales: ["es", "fr"],
75
+ models: "lingo.dev",
76
+ })
77
+ );
78
+ ```
79
+
80
+ ## New Compiler Features
81
+
82
+ The new compiler (`@lingo.dev/compiler`) offers:
83
+
84
+ - Advanced virtual module system for better code splitting
85
+ - Built-in development translation server
86
+ - Pluralization detection with ICU MessageFormat support
87
+ - Improved metadata management for better caching
88
+ - Thread-safe concurrent build support
89
+
90
+ ## Documentation
91
+
92
+ Full documentation: [lingo.dev/compiler](https://lingo.dev/compiler)
@@ -9487,7 +9487,7 @@ var require_lib2 = __commonJS({
9487
9487
  }
9488
9488
  return highlighted;
9489
9489
  }
9490
- var deprecationWarningShown = false;
9490
+ var deprecationWarningShown2 = false;
9491
9491
  var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
9492
9492
  function getMarkerLines(loc, source2, opts) {
9493
9493
  const startLoc = Object.assign({
@@ -9589,8 +9589,8 @@ ${frame}`;
9589
9589
  }
9590
9590
  }
9591
9591
  function index(rawLines, lineNumber, colNumber, opts = {}) {
9592
- if (!deprecationWarningShown) {
9593
- deprecationWarningShown = true;
9592
+ if (!deprecationWarningShown2) {
9593
+ deprecationWarningShown2 = true;
9594
9594
  const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
9595
9595
  if (process.emitWarning) {
9596
9596
  process.emitWarning(message, "DeprecationWarning");
@@ -20190,6 +20190,29 @@ var providerDetails = {
20190
20190
  }
20191
20191
  };
20192
20192
 
20193
+ // src/_deprecation.ts
20194
+ var DEPRECATION_WARNING = `
20195
+ \u26A0\uFE0F DEPRECATION WARNING: @lingo.dev/_compiler is deprecated.
20196
+ Please migrate to @lingo.dev/compiler (the new compiler).
20197
+
20198
+ The new compiler offers:
20199
+ \u2022 Advanced virtual module system for better code splitting
20200
+ \u2022 Built-in development translation server
20201
+ \u2022 Pluralization detection with ICU MessageFormat support
20202
+ \u2022 Improved metadata management for better caching
20203
+ \u2022 Thread-safe concurrent build support
20204
+
20205
+ Migration guide: https://lingo.dev/compiler
20206
+
20207
+ This legacy compiler will be removed in a future release.
20208
+ `;
20209
+ var deprecationWarningShown = false;
20210
+ function showDeprecationWarning() {
20211
+ if (deprecationWarningShown) return;
20212
+ deprecationWarningShown = true;
20213
+ console.warn(DEPRECATION_WARNING);
20214
+ }
20215
+
20193
20216
  // src/_loader-utils.ts
20194
20217
 
20195
20218
 
@@ -22592,4 +22615,5 @@ function transformComponent(options8) {
22592
22615
 
22593
22616
 
22594
22617
 
22595
- exports.defaultParams = defaultParams; exports.LCP_DICTIONARY_FILE_NAME = LCP_DICTIONARY_FILE_NAME; exports.LCPCache = LCPCache; exports.getInvalidLocales = getInvalidLocales; exports.getRc = getRc; exports.getGroqKeyFromRc = getGroqKeyFromRc; exports.getGroqKeyFromEnv = getGroqKeyFromEnv; exports.getLingoDotDevKeyFromEnv = getLingoDotDevKeyFromEnv; exports.getLingoDotDevKeyFromRc = getLingoDotDevKeyFromRc; exports.getGoogleKeyFromRc = getGoogleKeyFromRc; exports.getGoogleKeyFromEnv = getGoogleKeyFromEnv; exports.getMistralKeyFromRc = getMistralKeyFromRc; exports.getMistralKeyFromEnv = getMistralKeyFromEnv; exports.isRunningInCIOrDocker = isRunningInCIOrDocker; exports.providerDetails = providerDetails; exports.loadDictionary = loadDictionary; exports.transformComponent = transformComponent;
22618
+
22619
+ exports.defaultParams = defaultParams; exports.LCP_DICTIONARY_FILE_NAME = LCP_DICTIONARY_FILE_NAME; exports.LCPCache = LCPCache; exports.getInvalidLocales = getInvalidLocales; exports.getRc = getRc; exports.getGroqKeyFromRc = getGroqKeyFromRc; exports.getGroqKeyFromEnv = getGroqKeyFromEnv; exports.getLingoDotDevKeyFromEnv = getLingoDotDevKeyFromEnv; exports.getLingoDotDevKeyFromRc = getLingoDotDevKeyFromRc; exports.getGoogleKeyFromRc = getGoogleKeyFromRc; exports.getGoogleKeyFromEnv = getGoogleKeyFromEnv; exports.getMistralKeyFromRc = getMistralKeyFromRc; exports.getMistralKeyFromEnv = getMistralKeyFromEnv; exports.isRunningInCIOrDocker = isRunningInCIOrDocker; exports.providerDetails = providerDetails; exports.showDeprecationWarning = showDeprecationWarning; exports.loadDictionary = loadDictionary; exports.transformComponent = transformComponent;
@@ -9486,7 +9486,7 @@ var require_lib2 = __commonJS({
9486
9486
  }
9487
9487
  return highlighted;
9488
9488
  }
9489
- var deprecationWarningShown = false;
9489
+ var deprecationWarningShown2 = false;
9490
9490
  var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
9491
9491
  function getMarkerLines(loc, source2, opts) {
9492
9492
  const startLoc = Object.assign({
@@ -9588,8 +9588,8 @@ ${frame}`;
9588
9588
  }
9589
9589
  }
9590
9590
  function index(rawLines, lineNumber, colNumber, opts = {}) {
9591
- if (!deprecationWarningShown) {
9592
- deprecationWarningShown = true;
9591
+ if (!deprecationWarningShown2) {
9592
+ deprecationWarningShown2 = true;
9593
9593
  const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
9594
9594
  if (process.emitWarning) {
9595
9595
  process.emitWarning(message, "DeprecationWarning");
@@ -20189,6 +20189,29 @@ var providerDetails = {
20189
20189
  }
20190
20190
  };
20191
20191
 
20192
+ // src/_deprecation.ts
20193
+ var DEPRECATION_WARNING = `
20194
+ \u26A0\uFE0F DEPRECATION WARNING: @lingo.dev/_compiler is deprecated.
20195
+ Please migrate to @lingo.dev/compiler (the new compiler).
20196
+
20197
+ The new compiler offers:
20198
+ \u2022 Advanced virtual module system for better code splitting
20199
+ \u2022 Built-in development translation server
20200
+ \u2022 Pluralization detection with ICU MessageFormat support
20201
+ \u2022 Improved metadata management for better caching
20202
+ \u2022 Thread-safe concurrent build support
20203
+
20204
+ Migration guide: https://lingo.dev/compiler
20205
+
20206
+ This legacy compiler will be removed in a future release.
20207
+ `;
20208
+ var deprecationWarningShown = false;
20209
+ function showDeprecationWarning() {
20210
+ if (deprecationWarningShown) return;
20211
+ deprecationWarningShown = true;
20212
+ console.warn(DEPRECATION_WARNING);
20213
+ }
20214
+
20192
20215
  // src/_loader-utils.ts
20193
20216
  import _11 from "lodash";
20194
20217
  import path19 from "path";
@@ -22589,6 +22612,7 @@ export {
22589
22612
  getMistralKeyFromEnv,
22590
22613
  isRunningInCIOrDocker,
22591
22614
  providerDetails,
22615
+ showDeprecationWarning,
22592
22616
  loadDictionary,
22593
22617
  transformComponent
22594
22618
  };
package/build/index.cjs CHANGED
@@ -16,7 +16,8 @@
16
16
 
17
17
 
18
18
 
19
- var _chunkDZX4HCIUcjs = require('./chunk-DZX4HCIU.cjs');
19
+
20
+ var _chunk5WTAUBGEcjs = require('./chunk-5WTAUBGE.cjs');
20
21
 
21
22
 
22
23
  var _chunkO75UYLMXcjs = require('./chunk-O75UYLMX.cjs');
@@ -27,7 +28,7 @@ var _unplugin = require('unplugin');
27
28
  // package.json
28
29
  var package_default = {
29
30
  name: "@lingo.dev/_compiler",
30
- version: "0.10.0",
31
+ version: "0.10.1",
31
32
  description: "Lingo.dev Compiler",
32
33
  private: false,
33
34
  repository: {
@@ -261,7 +262,7 @@ async function getDistinctId() {
261
262
  };
262
263
  }
263
264
  async function tryGetEmail() {
264
- const rc = _chunkDZX4HCIUcjs.getRc.call(void 0, );
265
+ const rc = _chunk5WTAUBGEcjs.getRc.call(void 0, );
265
266
  const apiKey = process.env.LINGODOTDEV_API_KEY || _optionalChain([rc, 'optionalAccess', _5 => _5.auth, 'optionalAccess', _6 => _6.apiKey]);
266
267
  const apiUrl = process.env.LINGODOTDEV_API_URL || _optionalChain([rc, 'optionalAccess', _7 => _7.auth, 'optionalAccess', _8 => _8.apiUrl]) || "https://engine.lingo.dev";
267
268
  if (!apiKey) {
@@ -289,20 +290,20 @@ async function tryGetEmail() {
289
290
  // src/index.ts
290
291
  var keyCheckers = {
291
292
  groq: {
292
- checkEnv: _chunkDZX4HCIUcjs.getGroqKeyFromEnv,
293
- checkRc: _chunkDZX4HCIUcjs.getGroqKeyFromRc
293
+ checkEnv: _chunk5WTAUBGEcjs.getGroqKeyFromEnv,
294
+ checkRc: _chunk5WTAUBGEcjs.getGroqKeyFromRc
294
295
  },
295
296
  google: {
296
- checkEnv: _chunkDZX4HCIUcjs.getGoogleKeyFromEnv,
297
- checkRc: _chunkDZX4HCIUcjs.getGoogleKeyFromRc
297
+ checkEnv: _chunk5WTAUBGEcjs.getGoogleKeyFromEnv,
298
+ checkRc: _chunk5WTAUBGEcjs.getGoogleKeyFromRc
298
299
  },
299
300
  mistral: {
300
- checkEnv: _chunkDZX4HCIUcjs.getMistralKeyFromEnv,
301
- checkRc: _chunkDZX4HCIUcjs.getMistralKeyFromRc
301
+ checkEnv: _chunk5WTAUBGEcjs.getMistralKeyFromEnv,
302
+ checkRc: _chunk5WTAUBGEcjs.getMistralKeyFromRc
302
303
  },
303
304
  "lingo.dev": {
304
- checkEnv: _chunkDZX4HCIUcjs.getLingoDotDevKeyFromEnv,
305
- checkRc: _chunkDZX4HCIUcjs.getLingoDotDevKeyFromRc
305
+ checkEnv: _chunk5WTAUBGEcjs.getLingoDotDevKeyFromEnv,
306
+ checkRc: _chunk5WTAUBGEcjs.getLingoDotDevKeyFromRc
306
307
  }
307
308
  };
308
309
  var alreadySentBuildEvent = { value: false };
@@ -317,15 +318,16 @@ function sendBuildEvent(framework, config, isDev) {
317
318
  }
318
319
  var unplugin = _unplugin.createUnplugin.call(void 0,
319
320
  (_params, _meta) => {
321
+ _chunk5WTAUBGEcjs.showDeprecationWarning.call(void 0, );
320
322
  console.log("\u2139\uFE0F Starting Lingo.dev compiler...");
321
- const params = _lodash2.default.defaults(_params, _chunkDZX4HCIUcjs.defaultParams);
322
- if (!_chunkDZX4HCIUcjs.isRunningInCIOrDocker.call(void 0, )) {
323
+ const params = _lodash2.default.defaults(_params, _chunk5WTAUBGEcjs.defaultParams);
324
+ if (!_chunk5WTAUBGEcjs.isRunningInCIOrDocker.call(void 0, )) {
323
325
  if (params.models === "lingo.dev") {
324
326
  validateLLMKeyDetails(["lingo.dev"]);
325
327
  } else {
326
328
  const configuredProviders = getConfiguredProviders(params.models);
327
329
  validateLLMKeyDetails(configuredProviders);
328
- const invalidLocales = _chunkDZX4HCIUcjs.getInvalidLocales.call(void 0,
330
+ const invalidLocales = _chunk5WTAUBGEcjs.getInvalidLocales.call(void 0,
329
331
  params.models,
330
332
  params.sourceLocale,
331
333
  params.targetLocales
@@ -344,7 +346,7 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
344
346
  }
345
347
  }
346
348
  }
347
- _chunkDZX4HCIUcjs.LCPCache.ensureDictionaryFile({
349
+ _chunk5WTAUBGEcjs.LCPCache.ensureDictionaryFile({
348
350
  sourceRoot: params.sourceRoot,
349
351
  lingoDir: params.lingoDir
350
352
  });
@@ -352,9 +354,9 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
352
354
  sendBuildEvent("unplugin", params, isDev);
353
355
  return {
354
356
  name: package_default.name,
355
- loadInclude: (id) => !!id.match(_chunkDZX4HCIUcjs.LCP_DICTIONARY_FILE_NAME),
357
+ loadInclude: (id) => !!id.match(_chunk5WTAUBGEcjs.LCP_DICTIONARY_FILE_NAME),
356
358
  async load(id) {
357
- const dictionary = await _chunkDZX4HCIUcjs.loadDictionary.call(void 0, {
359
+ const dictionary = await _chunk5WTAUBGEcjs.loadDictionary.call(void 0, {
358
360
  resourcePath: id,
359
361
  resourceQuery: "",
360
362
  params: {
@@ -378,7 +380,7 @@ var unplugin = _unplugin.createUnplugin.call(void 0,
378
380
  enforce: "pre",
379
381
  transform(code, id) {
380
382
  try {
381
- const result = _chunkDZX4HCIUcjs.transformComponent.call(void 0, {
383
+ const result = _chunk5WTAUBGEcjs.transformComponent.call(void 0, {
382
384
  code,
383
385
  params,
384
386
  resourcePath: id,
@@ -398,13 +400,32 @@ var index_default = {
398
400
  /**
399
401
  * Initializes Lingo.dev Compiler for Next.js (App Router).
400
402
  *
403
+ * @deprecated This legacy compiler is deprecated. Please migrate to `@lingo.dev/compiler`.
404
+ * See migration guide at https://lingo.dev/compiler
405
+ *
401
406
  * @param compilerParams - The compiler parameters.
402
407
  *
403
408
  * @returns The Next.js configuration.
404
409
  *
405
- * @example Configuration for Next.js's default template
410
+ * @example New compiler usage (recommended):
406
411
  * ```ts
407
- * import lingoCompiler from "lingo.dev/compiler";
412
+ * import type { NextConfig } from "next";
413
+ * import { withLingo } from "@lingo.dev/compiler/next";
414
+ *
415
+ * const nextConfig: NextConfig = {};
416
+ *
417
+ * export default async function (): Promise<NextConfig> {
418
+ * return await withLingo(nextConfig, {
419
+ * sourceLocale: "en",
420
+ * targetLocales: ["es", "fr"],
421
+ * models: "lingo.dev",
422
+ * });
423
+ * }
424
+ * ```
425
+ *
426
+ * @example Legacy compiler usage (deprecated):
427
+ * ```ts
428
+ * import lingoCompiler from "@lingo.dev/_compiler";
408
429
  * import type { NextConfig } from "next";
409
430
  *
410
431
  * const nextConfig: NextConfig = {
@@ -418,9 +439,10 @@ var index_default = {
418
439
  * ```
419
440
  */
420
441
  next: (compilerParams) => (nextConfig = {}) => {
442
+ _chunk5WTAUBGEcjs.showDeprecationWarning.call(void 0, );
421
443
  const mergedParams = _lodash2.default.merge(
422
444
  {},
423
- _chunkDZX4HCIUcjs.defaultParams,
445
+ _chunk5WTAUBGEcjs.defaultParams,
424
446
  {
425
447
  rsc: true,
426
448
  turbopack: {
@@ -486,17 +508,38 @@ var index_default = {
486
508
  /**
487
509
  * Initializes Lingo.dev Compiler for Vite.
488
510
  *
511
+ * @deprecated This legacy compiler is deprecated. Please migrate to `@lingo.dev/compiler`.
512
+ * See migration guide at https://lingo.dev/compiler
513
+ *
489
514
  * @param compilerParams - The compiler parameters.
490
515
  *
491
516
  * @returns The Vite configuration.
492
517
  *
493
- * @example Configuration for Vite's "react-ts" template
518
+ * @example New compiler usage (recommended):
519
+ * ```ts
520
+ * import { defineConfig, type UserConfig } from "vite";
521
+ * import react from "@vitejs/plugin-react";
522
+ * import { withLingo } from "@lingo.dev/compiler/vite";
523
+ *
524
+ * const viteConfig: UserConfig = {
525
+ * plugins: [react()],
526
+ * };
527
+ *
528
+ * export default defineConfig(async () =>
529
+ * await withLingo(viteConfig, {
530
+ * sourceLocale: "en",
531
+ * targetLocales: ["es", "fr"],
532
+ * models: "lingo.dev",
533
+ * })
534
+ * );
535
+ * ```
536
+ *
537
+ * @example Legacy Vite configuration (deprecated):
494
538
  * ```ts
495
539
  * import { defineConfig, type UserConfig } from "vite";
496
540
  * import react from "@vitejs/plugin-react";
497
- * import lingoCompiler from "lingo.dev/compiler";
541
+ * import lingoCompiler from "@lingo.dev/_compiler";
498
542
  *
499
- * // https://vite.dev/config/
500
543
  * const viteConfig: UserConfig = {
501
544
  * plugins: [react()],
502
545
  * };
@@ -508,11 +551,11 @@ var index_default = {
508
551
  * );
509
552
  * ```
510
553
  *
511
- * @example Configuration for React Router's default template
554
+ * @example Legacy React Router configuration (deprecated):
512
555
  * ```ts
513
556
  * import { reactRouter } from "@react-router/dev/vite";
514
557
  * import tailwindcss from "@tailwindcss/vite";
515
- * import lingoCompiler from "lingo.dev/compiler";
558
+ * import lingoCompiler from "@lingo.dev/_compiler";
516
559
  * import { defineConfig, type UserConfig } from "vite";
517
560
  * import tsconfigPaths from "vite-tsconfig-paths";
518
561
  *
@@ -529,9 +572,10 @@ var index_default = {
529
572
  * ```
530
573
  */
531
574
  vite: (compilerParams) => (config) => {
575
+ _chunk5WTAUBGEcjs.showDeprecationWarning.call(void 0, );
532
576
  const mergedParams = _lodash2.default.merge(
533
577
  {},
534
- _chunkDZX4HCIUcjs.defaultParams,
578
+ _chunk5WTAUBGEcjs.defaultParams,
535
579
  { rsc: false },
536
580
  compilerParams
537
581
  );
@@ -545,7 +589,7 @@ var index_default = {
545
589
  };
546
590
  function getConfiguredProviders(models) {
547
591
  return _lodash2.default.chain(Object.values(models)).map((modelString) => modelString.split(":")[0]).filter(Boolean).uniq().filter(
548
- (providerId) => _chunkDZX4HCIUcjs.providerDetails.hasOwnProperty(providerId) && keyCheckers.hasOwnProperty(providerId)
592
+ (providerId) => _chunk5WTAUBGEcjs.providerDetails.hasOwnProperty(providerId) && keyCheckers.hasOwnProperty(providerId)
549
593
  ).value();
550
594
  }
551
595
  function validateLLMKeyDetails(configuredProviders) {
@@ -556,7 +600,7 @@ function validateLLMKeyDetails(configuredProviders) {
556
600
  const missingProviders = [];
557
601
  const foundProviders = [];
558
602
  for (const providerId of configuredProviders) {
559
- const details = _chunkDZX4HCIUcjs.providerDetails[providerId];
603
+ const details = _chunk5WTAUBGEcjs.providerDetails[providerId];
560
604
  const checkers = keyCheckers[providerId];
561
605
  if (!details || !checkers) continue;
562
606
  const foundInEnv = !!checkers.checkEnv();
package/build/index.d.cts CHANGED
@@ -128,13 +128,32 @@ declare const _default: {
128
128
  /**
129
129
  * Initializes Lingo.dev Compiler for Next.js (App Router).
130
130
  *
131
+ * @deprecated This legacy compiler is deprecated. Please migrate to `@lingo.dev/compiler`.
132
+ * See migration guide at https://lingo.dev/compiler
133
+ *
131
134
  * @param compilerParams - The compiler parameters.
132
135
  *
133
136
  * @returns The Next.js configuration.
134
137
  *
135
- * @example Configuration for Next.js's default template
138
+ * @example New compiler usage (recommended):
136
139
  * ```ts
137
- * import lingoCompiler from "lingo.dev/compiler";
140
+ * import type { NextConfig } from "next";
141
+ * import { withLingo } from "@lingo.dev/compiler/next";
142
+ *
143
+ * const nextConfig: NextConfig = {};
144
+ *
145
+ * export default async function (): Promise<NextConfig> {
146
+ * return await withLingo(nextConfig, {
147
+ * sourceLocale: "en",
148
+ * targetLocales: ["es", "fr"],
149
+ * models: "lingo.dev",
150
+ * });
151
+ * }
152
+ * ```
153
+ *
154
+ * @example Legacy compiler usage (deprecated):
155
+ * ```ts
156
+ * import lingoCompiler from "@lingo.dev/_compiler";
138
157
  * import type { NextConfig } from "next";
139
158
  *
140
159
  * const nextConfig: NextConfig = {
@@ -156,17 +175,38 @@ declare const _default: {
156
175
  /**
157
176
  * Initializes Lingo.dev Compiler for Vite.
158
177
  *
178
+ * @deprecated This legacy compiler is deprecated. Please migrate to `@lingo.dev/compiler`.
179
+ * See migration guide at https://lingo.dev/compiler
180
+ *
159
181
  * @param compilerParams - The compiler parameters.
160
182
  *
161
183
  * @returns The Vite configuration.
162
184
  *
163
- * @example Configuration for Vite's "react-ts" template
185
+ * @example New compiler usage (recommended):
186
+ * ```ts
187
+ * import { defineConfig, type UserConfig } from "vite";
188
+ * import react from "@vitejs/plugin-react";
189
+ * import { withLingo } from "@lingo.dev/compiler/vite";
190
+ *
191
+ * const viteConfig: UserConfig = {
192
+ * plugins: [react()],
193
+ * };
194
+ *
195
+ * export default defineConfig(async () =>
196
+ * await withLingo(viteConfig, {
197
+ * sourceLocale: "en",
198
+ * targetLocales: ["es", "fr"],
199
+ * models: "lingo.dev",
200
+ * })
201
+ * );
202
+ * ```
203
+ *
204
+ * @example Legacy Vite configuration (deprecated):
164
205
  * ```ts
165
206
  * import { defineConfig, type UserConfig } from "vite";
166
207
  * import react from "@vitejs/plugin-react";
167
- * import lingoCompiler from "lingo.dev/compiler";
208
+ * import lingoCompiler from "@lingo.dev/_compiler";
168
209
  *
169
- * // https://vite.dev/config/
170
210
  * const viteConfig: UserConfig = {
171
211
  * plugins: [react()],
172
212
  * };
@@ -178,11 +218,11 @@ declare const _default: {
178
218
  * );
179
219
  * ```
180
220
  *
181
- * @example Configuration for React Router's default template
221
+ * @example Legacy React Router configuration (deprecated):
182
222
  * ```ts
183
223
  * import { reactRouter } from "@react-router/dev/vite";
184
224
  * import tailwindcss from "@tailwindcss/vite";
185
- * import lingoCompiler from "lingo.dev/compiler";
225
+ * import lingoCompiler from "@lingo.dev/_compiler";
186
226
  * import { defineConfig, type UserConfig } from "vite";
187
227
  * import tsconfigPaths from "vite-tsconfig-paths";
188
228
  *
package/build/index.d.ts CHANGED
@@ -128,13 +128,32 @@ declare const _default: {
128
128
  /**
129
129
  * Initializes Lingo.dev Compiler for Next.js (App Router).
130
130
  *
131
+ * @deprecated This legacy compiler is deprecated. Please migrate to `@lingo.dev/compiler`.
132
+ * See migration guide at https://lingo.dev/compiler
133
+ *
131
134
  * @param compilerParams - The compiler parameters.
132
135
  *
133
136
  * @returns The Next.js configuration.
134
137
  *
135
- * @example Configuration for Next.js's default template
138
+ * @example New compiler usage (recommended):
136
139
  * ```ts
137
- * import lingoCompiler from "lingo.dev/compiler";
140
+ * import type { NextConfig } from "next";
141
+ * import { withLingo } from "@lingo.dev/compiler/next";
142
+ *
143
+ * const nextConfig: NextConfig = {};
144
+ *
145
+ * export default async function (): Promise<NextConfig> {
146
+ * return await withLingo(nextConfig, {
147
+ * sourceLocale: "en",
148
+ * targetLocales: ["es", "fr"],
149
+ * models: "lingo.dev",
150
+ * });
151
+ * }
152
+ * ```
153
+ *
154
+ * @example Legacy compiler usage (deprecated):
155
+ * ```ts
156
+ * import lingoCompiler from "@lingo.dev/_compiler";
138
157
  * import type { NextConfig } from "next";
139
158
  *
140
159
  * const nextConfig: NextConfig = {
@@ -156,17 +175,38 @@ declare const _default: {
156
175
  /**
157
176
  * Initializes Lingo.dev Compiler for Vite.
158
177
  *
178
+ * @deprecated This legacy compiler is deprecated. Please migrate to `@lingo.dev/compiler`.
179
+ * See migration guide at https://lingo.dev/compiler
180
+ *
159
181
  * @param compilerParams - The compiler parameters.
160
182
  *
161
183
  * @returns The Vite configuration.
162
184
  *
163
- * @example Configuration for Vite's "react-ts" template
185
+ * @example New compiler usage (recommended):
186
+ * ```ts
187
+ * import { defineConfig, type UserConfig } from "vite";
188
+ * import react from "@vitejs/plugin-react";
189
+ * import { withLingo } from "@lingo.dev/compiler/vite";
190
+ *
191
+ * const viteConfig: UserConfig = {
192
+ * plugins: [react()],
193
+ * };
194
+ *
195
+ * export default defineConfig(async () =>
196
+ * await withLingo(viteConfig, {
197
+ * sourceLocale: "en",
198
+ * targetLocales: ["es", "fr"],
199
+ * models: "lingo.dev",
200
+ * })
201
+ * );
202
+ * ```
203
+ *
204
+ * @example Legacy Vite configuration (deprecated):
164
205
  * ```ts
165
206
  * import { defineConfig, type UserConfig } from "vite";
166
207
  * import react from "@vitejs/plugin-react";
167
- * import lingoCompiler from "lingo.dev/compiler";
208
+ * import lingoCompiler from "@lingo.dev/_compiler";
168
209
  *
169
- * // https://vite.dev/config/
170
210
  * const viteConfig: UserConfig = {
171
211
  * plugins: [react()],
172
212
  * };
@@ -178,11 +218,11 @@ declare const _default: {
178
218
  * );
179
219
  * ```
180
220
  *
181
- * @example Configuration for React Router's default template
221
+ * @example Legacy React Router configuration (deprecated):
182
222
  * ```ts
183
223
  * import { reactRouter } from "@react-router/dev/vite";
184
224
  * import tailwindcss from "@tailwindcss/vite";
185
- * import lingoCompiler from "lingo.dev/compiler";
225
+ * import lingoCompiler from "@lingo.dev/_compiler";
186
226
  * import { defineConfig, type UserConfig } from "vite";
187
227
  * import tsconfigPaths from "vite-tsconfig-paths";
188
228
  *
package/build/index.mjs CHANGED
@@ -15,8 +15,9 @@ import {
15
15
  isRunningInCIOrDocker,
16
16
  loadDictionary,
17
17
  providerDetails,
18
+ showDeprecationWarning,
18
19
  transformComponent
19
- } from "./chunk-B6UBZSM3.mjs";
20
+ } from "./chunk-TJ26WFK7.mjs";
20
21
  import {
21
22
  __require
22
23
  } from "./chunk-6BWS3CLP.mjs";
@@ -27,7 +28,7 @@ import { createUnplugin } from "unplugin";
27
28
  // package.json
28
29
  var package_default = {
29
30
  name: "@lingo.dev/_compiler",
30
- version: "0.10.0",
31
+ version: "0.10.1",
31
32
  description: "Lingo.dev Compiler",
32
33
  private: false,
33
34
  repository: {
@@ -317,6 +318,7 @@ function sendBuildEvent(framework, config, isDev) {
317
318
  }
318
319
  var unplugin = createUnplugin(
319
320
  (_params, _meta) => {
321
+ showDeprecationWarning();
320
322
  console.log("\u2139\uFE0F Starting Lingo.dev compiler...");
321
323
  const params = _.defaults(_params, defaultParams);
322
324
  if (!isRunningInCIOrDocker()) {
@@ -398,13 +400,32 @@ var index_default = {
398
400
  /**
399
401
  * Initializes Lingo.dev Compiler for Next.js (App Router).
400
402
  *
403
+ * @deprecated This legacy compiler is deprecated. Please migrate to `@lingo.dev/compiler`.
404
+ * See migration guide at https://lingo.dev/compiler
405
+ *
401
406
  * @param compilerParams - The compiler parameters.
402
407
  *
403
408
  * @returns The Next.js configuration.
404
409
  *
405
- * @example Configuration for Next.js's default template
410
+ * @example New compiler usage (recommended):
406
411
  * ```ts
407
- * import lingoCompiler from "lingo.dev/compiler";
412
+ * import type { NextConfig } from "next";
413
+ * import { withLingo } from "@lingo.dev/compiler/next";
414
+ *
415
+ * const nextConfig: NextConfig = {};
416
+ *
417
+ * export default async function (): Promise<NextConfig> {
418
+ * return await withLingo(nextConfig, {
419
+ * sourceLocale: "en",
420
+ * targetLocales: ["es", "fr"],
421
+ * models: "lingo.dev",
422
+ * });
423
+ * }
424
+ * ```
425
+ *
426
+ * @example Legacy compiler usage (deprecated):
427
+ * ```ts
428
+ * import lingoCompiler from "@lingo.dev/_compiler";
408
429
  * import type { NextConfig } from "next";
409
430
  *
410
431
  * const nextConfig: NextConfig = {
@@ -418,6 +439,7 @@ var index_default = {
418
439
  * ```
419
440
  */
420
441
  next: (compilerParams) => (nextConfig = {}) => {
442
+ showDeprecationWarning();
421
443
  const mergedParams = _.merge(
422
444
  {},
423
445
  defaultParams,
@@ -486,17 +508,38 @@ var index_default = {
486
508
  /**
487
509
  * Initializes Lingo.dev Compiler for Vite.
488
510
  *
511
+ * @deprecated This legacy compiler is deprecated. Please migrate to `@lingo.dev/compiler`.
512
+ * See migration guide at https://lingo.dev/compiler
513
+ *
489
514
  * @param compilerParams - The compiler parameters.
490
515
  *
491
516
  * @returns The Vite configuration.
492
517
  *
493
- * @example Configuration for Vite's "react-ts" template
518
+ * @example New compiler usage (recommended):
519
+ * ```ts
520
+ * import { defineConfig, type UserConfig } from "vite";
521
+ * import react from "@vitejs/plugin-react";
522
+ * import { withLingo } from "@lingo.dev/compiler/vite";
523
+ *
524
+ * const viteConfig: UserConfig = {
525
+ * plugins: [react()],
526
+ * };
527
+ *
528
+ * export default defineConfig(async () =>
529
+ * await withLingo(viteConfig, {
530
+ * sourceLocale: "en",
531
+ * targetLocales: ["es", "fr"],
532
+ * models: "lingo.dev",
533
+ * })
534
+ * );
535
+ * ```
536
+ *
537
+ * @example Legacy Vite configuration (deprecated):
494
538
  * ```ts
495
539
  * import { defineConfig, type UserConfig } from "vite";
496
540
  * import react from "@vitejs/plugin-react";
497
- * import lingoCompiler from "lingo.dev/compiler";
541
+ * import lingoCompiler from "@lingo.dev/_compiler";
498
542
  *
499
- * // https://vite.dev/config/
500
543
  * const viteConfig: UserConfig = {
501
544
  * plugins: [react()],
502
545
  * };
@@ -508,11 +551,11 @@ var index_default = {
508
551
  * );
509
552
  * ```
510
553
  *
511
- * @example Configuration for React Router's default template
554
+ * @example Legacy React Router configuration (deprecated):
512
555
  * ```ts
513
556
  * import { reactRouter } from "@react-router/dev/vite";
514
557
  * import tailwindcss from "@tailwindcss/vite";
515
- * import lingoCompiler from "lingo.dev/compiler";
558
+ * import lingoCompiler from "@lingo.dev/_compiler";
516
559
  * import { defineConfig, type UserConfig } from "vite";
517
560
  * import tsconfigPaths from "vite-tsconfig-paths";
518
561
  *
@@ -529,6 +572,7 @@ var index_default = {
529
572
  * ```
530
573
  */
531
574
  vite: (compilerParams) => (config) => {
575
+ showDeprecationWarning();
532
576
  const mergedParams = _.merge(
533
577
  {},
534
578
  defaultParams,
@@ -1,16 +1,18 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkDZX4HCIUcjs = require('./chunk-DZX4HCIU.cjs');
4
+
5
+ var _chunk5WTAUBGEcjs = require('./chunk-5WTAUBGE.cjs');
5
6
  require('./chunk-O75UYLMX.cjs');
6
7
 
7
8
  // src/lingo-turbopack-loader.ts
8
9
  async function lingo_turbopack_loader_default(source) {
10
+ _chunk5WTAUBGEcjs.showDeprecationWarning.call(void 0, );
9
11
  const callback = this.async();
10
12
  const params = this.getOptions();
11
13
  const isDev = process.env.NODE_ENV !== "production";
12
14
  try {
13
- const dictionary = await _chunkDZX4HCIUcjs.loadDictionary.call(void 0, {
15
+ const dictionary = await _chunk5WTAUBGEcjs.loadDictionary.call(void 0, {
14
16
  resourcePath: this.resourcePath,
15
17
  resourceQuery: this.resourceQuery,
16
18
  params,
@@ -22,7 +24,7 @@ async function lingo_turbopack_loader_default(source) {
22
24
  const code = `export default ${JSON.stringify(dictionary, null, 2)};`;
23
25
  return callback(null, code);
24
26
  }
25
- const result = _chunkDZX4HCIUcjs.transformComponent.call(void 0, {
27
+ const result = _chunk5WTAUBGEcjs.transformComponent.call(void 0, {
26
28
  code: source,
27
29
  params,
28
30
  resourcePath: this.resourcePath,
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @deprecated This loader is part of the legacy compiler. Please migrate to @lingo.dev/compiler.
3
+ * See migration guide at https://lingo.dev/compiler
4
+ */
1
5
  declare function export_default(this: any, source: string): Promise<any>;
2
6
 
3
7
  export { export_default as default };
@@ -1,3 +1,7 @@
1
+ /**
2
+ * @deprecated This loader is part of the legacy compiler. Please migrate to @lingo.dev/compiler.
3
+ * See migration guide at https://lingo.dev/compiler
4
+ */
1
5
  declare function export_default(this: any, source: string): Promise<any>;
2
6
 
3
7
  export { export_default as default };
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  loadDictionary,
3
+ showDeprecationWarning,
3
4
  transformComponent
4
- } from "./chunk-B6UBZSM3.mjs";
5
+ } from "./chunk-TJ26WFK7.mjs";
5
6
  import "./chunk-6BWS3CLP.mjs";
6
7
 
7
8
  // src/lingo-turbopack-loader.ts
8
9
  async function lingo_turbopack_loader_default(source) {
10
+ showDeprecationWarning();
9
11
  const callback = this.async();
10
12
  const params = this.getOptions();
11
13
  const isDev = process.env.NODE_ENV !== "production";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingo.dev/_compiler",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Lingo.dev Compiler",
5
5
  "private": false,
6
6
  "repository": {