Repository navigation
[APPS-2961] Update: warn that Vite below 6.4 is deprecated and run the repo on Node 24 #627
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
Merged
gh-worker-dd-mergequeue-cf854d
merged 2 commits into
master
from
tiffany.trinh/apps-2961-vite-deprecation-warning
Oct 28, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| // Unless explicitly stated otherwise all files in this repository are licensed under the MIT License. | ||
| // This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
| // Copyright 2019-Present Datadog, Inc. | ||
|
|
||
| import vitePluginPackage from '../../../published/vite-plugin/package.json'; | ||
|
|
||
| import { getUnsupportedViteWarning, MAX_VITE_MAJOR, MIN_VITE_VERSION } from './vite-version'; | ||
|
|
||
| const floor = MIN_VITE_VERSION.split('.').slice(0, 2).join('.'); | ||
| const deprecated = (version: string) => | ||
| `Vite ${version} is deprecated in Datadog's Vite plugin: please upgrade to Vite ${floor} or later.`; | ||
| const untested = (version: string) => | ||
| `Datadog's Vite plugin is tested up to Vite ${MAX_VITE_MAJOR}.x (found ${version}).`; | ||
|
|
||
| describe('getUnsupportedViteWarning', () => { | ||
| const cases: { version: unknown; expected: string | undefined }[] = [ | ||
| { version: '4.5.3', expected: deprecated('4.5.3') }, | ||
| { version: '5.4.21', expected: deprecated('5.4.21') }, | ||
| { version: '6.0.0', expected: deprecated('6.0.0') }, | ||
| { version: '6.3.9', expected: deprecated('6.3.9') }, | ||
| { version: '6.4.0-beta.1', expected: deprecated('6.4.0-beta.1') }, | ||
| { version: MIN_VITE_VERSION, expected: undefined }, | ||
| { version: '6.4.3', expected: undefined }, | ||
| { version: '6.10.0', expected: undefined }, | ||
| { version: '7.0.0-beta.1', expected: undefined }, | ||
| { version: '8.3.4', expected: undefined }, | ||
| { version: '9.0.0', expected: untested('9.0.0') }, | ||
| { version: '9.0.0-beta.1', expected: untested('9.0.0-beta.1') }, | ||
| { version: '10.1.0', expected: untested('10.1.0') }, | ||
| { version: 'v5.4.21', expected: deprecated('v5.4.21') }, | ||
| { version: '6.3', expected: undefined }, | ||
| { version: '', expected: undefined }, | ||
| { version: 'not-a-version', expected: undefined }, | ||
| { version: undefined, expected: undefined }, | ||
| { version: 5, expected: undefined }, | ||
| ]; | ||
|
|
||
| test.each(cases)('Should return the expected warning for $version', ({ version, expected }) => { | ||
| const warning = getUnsupportedViteWarning(version); | ||
| expect(warning).toBe(expected); | ||
| }); | ||
|
|
||
| // Versions below the floor stay in the peer range while deprecated. | ||
| test('Should share its upper bound with the peer range the Vite plugin declares', () => { | ||
| const upperBound = new RegExp(`<= ?${MAX_VITE_MAJOR}\\.x$`); | ||
| expect(vitePluginPackage.peerDependencies.vite).toMatch(upperBound); | ||
| }); | ||
| }); |
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,29 @@ | ||
| // Unless explicitly stated otherwise all files in this repository are licensed under the MIT License. | ||
| // This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
| // Copyright 2019-Present Datadog, Inc. | ||
|
|
||
| import semver from 'semver'; | ||
|
|
||
| // The oldest line Vite still patches: https://vite.dev/releases#supported-versions | ||
| export const MIN_VITE_VERSION = '6.4.0'; | ||
| export const MAX_VITE_MAJOR = 8; | ||
|
|
||
| const MIN_VITE_LINE = `${semver.major(MIN_VITE_VERSION)}.${semver.minor(MIN_VITE_VERSION)}`; | ||
|
|
||
| // An unreadable version is left alone: the warning is advice, not a gate. | ||
| export const getUnsupportedViteWarning = (version: unknown): string | undefined => { | ||
| const parsed = typeof version === 'string' ? semver.parse(version) : null; | ||
| if (!parsed) { | ||
| return undefined; | ||
| } | ||
|
|
||
| if (semver.lt(parsed, MIN_VITE_VERSION)) { | ||
| return `Vite ${version} is deprecated in Datadog's Vite plugin: please upgrade to Vite ${MIN_VITE_LINE} or later.`; | ||
| } | ||
|
|
||
| if (parsed.major > MAX_VITE_MAJOR) { | ||
| return `Datadog's Vite plugin is tested up to Vite ${MAX_VITE_MAJOR}.x (found ${version}).`; | ||
| } | ||
|
|
||
| return undefined; | ||
| }; |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.