File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,13 @@ if (!process.argv.includes('--lsp')) {
1313import { createRequire } from 'node:module' ;
1414import { dirname , join } from 'node:path' ;
1515import { pathToFileURL } from 'node:url' ;
16+ import pkg from '../package.json' with { type : 'json' } ;
1617
1718const require = createRequire ( import . meta. url ) ;
1819const oxfmtMainPath = require . resolve ( 'oxfmt' ) ;
1920const oxfmtBin = join ( dirname ( dirname ( oxfmtMainPath ) ) , 'bin' , 'oxfmt' ) ;
2021
22+ // This allows oxfmt to load vite.config.ts
23+ // For `vp check` and `vp fmt`, it is injected by `merge_resolved_envs_with_version()` in `cli.rs`
24+ process . env . VP_VERSION = pkg . version ;
2125await import ( pathToFileURL ( oxfmtBin ) . href ) ;
Original file line number Diff line number Diff line change @@ -13,9 +13,13 @@ if (!process.argv.includes('--lsp')) {
1313import { createRequire } from 'node:module' ;
1414import { dirname , join } from 'node:path' ;
1515import { pathToFileURL } from 'node:url' ;
16+ import pkg from '../package.json' with { type : 'json' } ;
1617
1718const require = createRequire ( import . meta. url ) ;
1819const oxlintMainPath = require . resolve ( 'oxlint' ) ;
1920const oxlintBin = join ( dirname ( dirname ( oxlintMainPath ) ) , 'bin' , 'oxlint' ) ;
2021
22+ // This allows oxlint to load vite.config.ts
23+ // For `vp check` and `vp lint`, it is injected by `merge_resolved_envs_with_version()` in `cli.rs`
24+ process . env . VP_VERSION = pkg . version ;
2125await import ( pathToFileURL ( oxlintBin ) . href ) ;
Original file line number Diff line number Diff line change @@ -271,7 +271,7 @@ impl SubcommandResolver {
271271 untracked_env : None ,
272272 input : None ,
273273 } ) ,
274- envs : merge_resolved_envs ( envs, resolved. envs ) ,
274+ envs : merge_resolved_envs_with_version ( envs, resolved. envs ) ,
275275 } )
276276 }
277277 SynthesizableSubcommand :: Fmt { mut args } => {
@@ -309,7 +309,7 @@ impl SubcommandResolver {
309309 untracked_env : None ,
310310 input : None ,
311311 } ) ,
312- envs : merge_resolved_envs ( envs, resolved. envs ) ,
312+ envs : merge_resolved_envs_with_version ( envs, resolved. envs ) ,
313313 } )
314314 }
315315 SynthesizableSubcommand :: Build { args } => {
You can’t perform that action at this time.
0 commit comments