Skip to content

Commit 1bd958d

Browse files
committed
feat: load config for the translation server for easier setup
1 parent a9ac8bb commit 1bd958d

6 files changed

Lines changed: 818 additions & 192 deletions

File tree

cmp/compiler/src/plugin/next.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ function buildLingoConfig(
276276
return modifiedConfig;
277277
};
278278

279-
return {
279+
const finalConfig = {
280280
...userNextConfig,
281281
...turbopackConfig,
282282
compiler: {
@@ -285,6 +285,12 @@ function buildLingoConfig(
285285
},
286286
webpack,
287287
};
288+
289+
// Attach Lingo config for CLI extraction
290+
// @ts-expect-error - Internal property for CLI access
291+
finalConfig._lingoConfig = lingoOptions;
292+
293+
return finalConfig;
288294
}
289295

290296
/**

cmp/compiler/src/plugin/vite.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,18 @@ import { lingoUnplugin, type LingoPluginOptions } from "./unplugin";
2424
* Vite plugin with framework automatically set
2525
*/
2626
export function lingoCompilerPlugin(options: Partial<LingoPluginOptions> = {}) {
27-
return lingoUnplugin.vite({
27+
const fullOptions = {
2828
...options,
2929
framework: "vite",
30-
} as LingoPluginOptions);
30+
} as LingoPluginOptions;
31+
32+
const plugin = lingoUnplugin.vite(fullOptions);
33+
34+
// Attach Lingo config for CLI extraction
35+
// @ts-expect-error - Internal property for CLI access
36+
plugin._lingoConfig = fullOptions;
37+
38+
return plugin;
3139
}
3240

3341
export type { LingoPluginOptions };

0 commit comments

Comments
 (0)