-
Notifications
You must be signed in to change notification settings - Fork 829
feat(compiler): add deprecation warnings for legacy compiler #1934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cherkanovart
wants to merge
1
commit into
main
Choose a base branch
from
chore/unify-deprecation-warning
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| "@lingo.dev/_compiler": patch | ||
| --- | ||
|
|
||
| Add deprecation warnings throughout legacy compiler | ||
|
|
||
| The legacy compiler (`@lingo.dev/_compiler`) now shows deprecation warnings when used. | ||
| Users are encouraged to migrate to the new compiler (`@lingo.dev/compiler`). | ||
|
|
||
| Changes: | ||
| - Added runtime deprecation warnings in `next()`, `vite()`, and the Turbopack loader | ||
| - Added `@deprecated` JSDoc tags to all public APIs | ||
| - Updated package README with migration guide and examples | ||
| - The deprecation warning includes information about new compiler features and migration guide link |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "permissions": { | ||
| "allow": [ | ||
| "Bash(pnpm build:*)" | ||
| ] | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,92 @@ | ||
| # Lingo.dev Compiler | ||
| # Lingo.dev Compiler (Legacy) | ||
|
|
||
| **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. | ||
| > **DEPRECATED:** This package (`@lingo.dev/_compiler`) is deprecated. Please migrate to `@lingo.dev/compiler` (the new compiler). | ||
|
|
||
| Documentation: https://lingo.dev/compiler | ||
| ## Migration | ||
|
|
||
| Install the new compiler: | ||
|
|
||
| ```bash | ||
| npm install @lingo.dev/compiler | ||
| ``` | ||
|
|
||
| Update your configuration: | ||
|
|
||
| **Next.js (before):** | ||
| ```ts | ||
| import lingoCompiler from "@lingo.dev/_compiler"; | ||
| import type { NextConfig } from "next"; | ||
|
|
||
| const nextConfig: NextConfig = {}; | ||
|
|
||
| export default lingoCompiler.next({ | ||
| sourceRoot: "app", | ||
| models: "lingo.dev", | ||
| })(nextConfig); | ||
| ``` | ||
|
|
||
| **Next.js (after):** | ||
| ```ts | ||
| import type { NextConfig } from "next"; | ||
| import { withLingo } from "@lingo.dev/compiler/next"; | ||
|
|
||
| const nextConfig: NextConfig = {}; | ||
|
|
||
| export default async function (): Promise<NextConfig> { | ||
| return await withLingo(nextConfig, { | ||
| sourceLocale: "en", | ||
| targetLocales: ["es", "fr"], | ||
| models: "lingo.dev", | ||
| }); | ||
| } | ||
| ``` | ||
|
|
||
| **Vite (before):** | ||
| ```ts | ||
| import { defineConfig, type UserConfig } from "vite"; | ||
| import react from "@vitejs/plugin-react"; | ||
| import lingoCompiler from "@lingo.dev/_compiler"; | ||
|
|
||
| const viteConfig: UserConfig = { | ||
| plugins: [react()], | ||
| }; | ||
|
|
||
| export default defineConfig(() => | ||
| lingoCompiler.vite({ | ||
| models: "lingo.dev", | ||
| })(viteConfig) | ||
| ); | ||
| ``` | ||
|
|
||
| **Vite (after):** | ||
| ```ts | ||
| import { defineConfig, type UserConfig } from "vite"; | ||
| import react from "@vitejs/plugin-react"; | ||
| import { withLingo } from "@lingo.dev/compiler/vite"; | ||
|
|
||
| const viteConfig: UserConfig = { | ||
| plugins: [react()], | ||
| }; | ||
|
|
||
| export default defineConfig(async () => | ||
| await withLingo(viteConfig, { | ||
| sourceLocale: "en", | ||
| targetLocales: ["es", "fr"], | ||
| models: "lingo.dev", | ||
| }) | ||
| ); | ||
| ``` | ||
|
|
||
| ## New Compiler Features | ||
|
|
||
| The new compiler (`@lingo.dev/compiler`) offers: | ||
|
|
||
| - Advanced virtual module system for better code splitting | ||
| - Built-in development translation server | ||
| - Pluralization detection with ICU MessageFormat support | ||
| - Improved metadata management for better caching | ||
| - Thread-safe concurrent build support | ||
|
|
||
| ## Documentation | ||
|
|
||
| Full documentation: https://lingo.dev/compiler | ||
|
Comment on lines
+90
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Format URL as markdown link. The bare URL should be formatted as a proper markdown link for better accessibility and consistency with markdown best practices. 📝 Proposed fix ## Documentation
-Full documentation: https://lingo.dev/compiler
+Full documentation: [https://lingo.dev/compiler](https://lingo.dev/compiler)🧰 Tools🪛 markdownlint-cli2 (0.20.0)92-92: Bare URL used (MD034, no-bare-urls) 🤖 Prompt for AI Agents |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| const DEPRECATION_WARNING = ` | ||
| ⚠️ DEPRECATION WARNING: @lingo.dev/_compiler is deprecated. | ||
| Please migrate to @lingo.dev/compiler (the new compiler). | ||
|
|
||
| The new compiler offers: | ||
| • Advanced virtual module system for better code splitting | ||
| • Built-in development translation server | ||
| • Pluralization detection with ICU MessageFormat support | ||
| • Improved metadata management for better caching | ||
| • Thread-safe concurrent build support | ||
|
|
||
| Migration guide: https://lingo.dev/compiler | ||
|
|
||
| This legacy compiler will be removed in a future release. | ||
| `; | ||
|
|
||
| let deprecationWarningShown = false; | ||
|
|
||
| export function showDeprecationWarning() { | ||
| if (deprecationWarningShown) return; | ||
| deprecationWarningShown = true; | ||
| console.warn(DEPRECATION_WARNING); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: lingodotdev/lingo.dev
Length of output: 153
🏁 Script executed:
Repository: lingodotdev/lingo.dev
Length of output: 517
🏁 Script executed:
Repository: lingodotdev/lingo.dev
Length of output: 164
🏁 Script executed:
Repository: lingodotdev/lingo.dev
Length of output: 131
🏁 Script executed:
Repository: lingodotdev/lingo.dev
Length of output: 47
🏁 Script executed:
# Check the content of the actual file cat .claude/settings.local.jsonRepository: lingodotdev/lingo.dev
Length of output: 139
🏁 Script executed:
Repository: lingodotdev/lingo.dev
Length of output: 14650
🏁 Script executed:
Repository: lingodotdev/lingo.dev
Length of output: 1788
Verify the breadth of the Bash permission allowlist.
The wildcard
pnpm build:*permits any build subcommand and arguments—confirm this scope is intentional for Claude IDE integration.🤖 Prompt for AI Agents