Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8d9649e
feat: improve Lingo.dev Compiler init
davidturnbull Oct 9, 2025
2e2b8c5
feat: rename to withLingo
davidturnbull Oct 9, 2025
07acc0d
chore: format
davidturnbull Oct 9, 2025
9b49e9c
chore: format
davidturnbull Oct 20, 2025
547c19d
fix: type error
davidturnbull Oct 21, 2025
c3d9c8f
docs: changeset
davidturnbull Oct 22, 2025
2691834
fix: ts errors
davidturnbull Oct 22, 2025
1bd83fd
fix: vite types
davidturnbull Oct 22, 2025
fe93e6d
Merge origin/main into davidt-compiler-init-api
davidturnbull Oct 22, 2025
35ed2d8
chore: downgrade vite to v6 for Node 20.12.2 compatibility
davidturnbull Oct 22, 2025
1fd597b
fix: use dynamic import for node-machine-id to resolve ESM/CommonJS i…
davidturnbull Oct 22, 2025
5153629
fix: resolve vite type incompatibilities across monorepo
davidturnbull Oct 22, 2025
d8b65b7
fix: resolve vite type incompatibilities by enforcing single @types/n…
davidturnbull Oct 22, 2025
57a0278
fix: use any return type for vite plugin to avoid cross-package type …
davidturnbull Oct 22, 2025
e45f5b8
fix: add @noble/hashes override for Node 20.12.2 compatibility
davidturnbull Oct 22, 2025
5bd0773
fix: formatting
davidturnbull Oct 22, 2025
587fc6c
fix: add dependency overrides to prevent incompatible upgrades
davidturnbull Oct 22, 2025
74f6973
test(compiler): mock CI env in vite/next specs
davidturnbull Oct 22, 2025
ad0b7f1
chore: ignore generated compiler dictionary cache file
davidturnbull Oct 22, 2025
e452427
refactor(compiler/next): drop lingo alias export; tests already use w…
davidturnbull Oct 22, 2025
bfd4a4a
Revert "fix: formatting"
davidturnbull Oct 26, 2025
b0ff598
refactor(workspace): remove pnpm overrides
davidturnbull Oct 26, 2025
71b28ec
chore: merge origin/main
davidturnbull Oct 26, 2025
721f150
chore(lockfile): update pnpm-lock.yaml after merge
davidturnbull Oct 26, 2025
254b668
chore: update format check
davidturnbull Oct 26, 2025
41f400e
fix(compiler): normalize @babel/traverse import for SSR interop
davidturnbull Oct 26, 2025
6ad70f2
fix(compiler): normalize @babel/generator import for SSR interop
davidturnbull Oct 26, 2025
b306819
feat(compiler): restore Next alias export 'lingo'; relax Vite peer to…
davidturnbull Oct 26, 2025
6841979
chore(compiler): remove unused Next alias export to avoid API churn
davidturnbull Oct 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions demo/adonisjs/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@ import { getDirname } from '@adonisjs/core/helpers'
import inertia from '@adonisjs/inertia/client'
import adonisjs from '@adonisjs/vite/client'
import react from '@vitejs/plugin-react'
import lingoCompiler from 'lingo.dev/compiler'
import { lingo } from 'lingo.dev/compiler/vite'
import { type UserConfig, type PluginOption } from 'vite'

const viteConfig: UserConfig = {
plugins: [
// Place Lingo.dev first so it runs before other transforms
lingo({
sourceRoot: 'inertia',
lingoDir: 'lingo',
sourceLocale: 'en',
targetLocales: ['es'],
rsc: false,
useDirective: false,
debug: false,
models: 'lingo.dev',
}) as unknown as PluginOption,
inertia({
ssr: {
enabled: true,
Expand All @@ -26,15 +37,4 @@ const viteConfig: UserConfig = {
},
}

const withLingo = lingoCompiler.vite({
sourceRoot: 'inertia',
lingoDir: 'lingo',
sourceLocale: 'en',
targetLocales: ['es'],
rsc: false,
useDirective: false,
debug: false,
models: 'lingo.dev',
})

export default withLingo(viteConfig)
export default viteConfig
4 changes: 2 additions & 2 deletions demo/next-app/next.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { NextConfig } from "next";
import lingoCompiler from "lingo.dev/compiler";
import { withLingo } from "lingo.dev/compiler/next";

const nextConfig: NextConfig = {
/* config options here */
};

export default lingoCompiler.next({
export default withLingo({
sourceLocale: "en",
targetLocales: ["es", "ja", "fr", "ru", "de", "zh", "ar", "ko"],
models: "lingo.dev",
Expand Down
28 changes: 16 additions & 12 deletions demo/react-router-app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@ import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";

// Compiler: import
import lingoCompiler from "lingo.dev/compiler";
// Compiler: public export path
import { lingo } from "lingo.dev/compiler/vite";

export default defineConfig(({ isSsrBuild }) =>
lingoCompiler.vite({
sourceRoot: "app",
targetLocales: ["es", "fr", "de"],
useDirective: false,
models: "lingo.dev",
})({
plugins: [tailwindcss(), reactRouter(), tsconfigPaths()],
}),
);
export default defineConfig(({ isSsrBuild }) => ({
plugins: [
// Place Lingo.dev first so it runs before other transforms
lingo({
sourceRoot: "app",
targetLocales: ["es", "fr", "de"],
useDirective: false,
models: "lingo.dev",
}),
tailwindcss(),
reactRouter(),
tsconfigPaths(),
],
}));
30 changes: 13 additions & 17 deletions demo/vite-project/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";

// Compiler: add import
import lingoCompiler from "lingo.dev/compiler";

const viteConfig = {
plugins: [react()],
};
// Compiler: public export path
import { lingo } from "lingo.dev/compiler/vite";

// https://vite.dev/config/
export default defineConfig(() =>
// Compiler: add lingoCompiler.vite
lingoCompiler.vite({
sourceRoot: "src",
targetLocales: ["es", "fr", "ru", "de", "ja", "zh", "ar", "ko"],
models: "lingo.dev",
})(viteConfig),
);
// export default defineConfig({
// plugins: [react()],
// })
export default defineConfig(() => ({
plugins: [
// Place Lingo.dev first so it runs before other transforms
lingo({
sourceRoot: "src",
targetLocales: ["es", "fr", "ru", "de", "ja", "zh", "ar", "ko"],
models: "lingo.dev",
}),
react(),
],
}));
16 changes: 16 additions & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@
"import": "./build/compiler.mjs",
"require": "./build/compiler.cjs"
},
"./compiler/vite": {
"types": "./build/compiler/vite.d.ts",
"import": "./build/compiler/vite.mjs",
"require": "./build/compiler/vite.cjs"
},
"./compiler/next": {
"types": "./build/compiler/next.d.ts",
"import": "./build/compiler/next.mjs",
"require": "./build/compiler/next.cjs"
},
"./react": {
"types": "./build/react.d.ts",
"import": "./build/react.mjs",
Expand Down Expand Up @@ -84,6 +94,12 @@
"compiler": [
"./build/compiler.d.ts"
],
"compiler/vite": [
"./build/compiler/vite.d.ts"
],
"compiler/next": [
"./build/compiler/next.d.ts"
],
"react": [
"./build/react.d.ts"
],
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/compiler/next.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export type * from "@lingo.dev/_compiler/next";
export { default, withLingo } from "@lingo.dev/_compiler/next";
2 changes: 2 additions & 0 deletions packages/cli/src/compiler/vite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export type * from "@lingo.dev/_compiler/vite";
export { default, lingo } from "@lingo.dev/_compiler/vite";
2 changes: 2 additions & 0 deletions packages/cli/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export default defineConfig({
"react/rsc": "src/react/rsc.ts",
"react/react-router": "src/react/react-router.ts",
compiler: "src/compiler/index.ts",
"compiler/vite": "src/compiler/vite.ts",
"compiler/next": "src/compiler/next.ts",
"locale-codes": "src/locale-codes/index.ts",
},
outDir: "build",
Expand Down
17 changes: 17 additions & 0 deletions packages/compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@
"main": "build/index.cjs",
"types": "build/index.d.ts",
"module": "build/index.mjs",
"exports": {
".": {
"types": "./build/index.d.ts",
"import": "./build/index.mjs",
"require": "./build/index.cjs"
},
"./vite": {
"types": "./build/vite.d.ts",
"import": "./build/vite.mjs",
"require": "./build/vite.cjs"
},
"./next": {
"types": "./build/next.d.ts",
"import": "./build/next.mjs",
"require": "./build/next.cjs"
}
},
"files": [
"build"
],
Expand Down
1 change: 1 addition & 0 deletions packages/compiler/src/core/unplugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { unplugin } from "../unplugin";
Loading
Loading