Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions packages/cli/bin/oxfmt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ if (!process.argv.includes('--lsp')) {
import { createRequire } from 'node:module';
import { dirname, join } from 'node:path';
import { pathToFileURL } from 'node:url';
import pkg from '../package.json' with { type: 'json' };

const require = createRequire(import.meta.url);
const oxfmtMainPath = require.resolve('oxfmt');
const oxfmtBin = join(dirname(dirname(oxfmtMainPath)), 'bin', 'oxfmt');

// This allows oxfmt to load vite.config.ts
// For `vp check` and `vp fmt`, it is injected by `merge_resolved_envs_with_version()` in `cli.rs`
process.env.VP_VERSION = pkg.version;
await import(pathToFileURL(oxfmtBin).href);
4 changes: 4 additions & 0 deletions packages/cli/bin/oxlint
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ if (!process.argv.includes('--lsp')) {
import { createRequire } from 'node:module';
import { dirname, join } from 'node:path';
import { pathToFileURL } from 'node:url';
import pkg from '../package.json' with { type: 'json' };

const require = createRequire(import.meta.url);
const oxlintMainPath = require.resolve('oxlint');
const oxlintBin = join(dirname(dirname(oxlintMainPath)), 'bin', 'oxlint');

// This allows oxlint to load vite.config.ts
// For `vp check` and `vp lint`, it is injected by `merge_resolved_envs_with_version()` in `cli.rs`
process.env.VP_VERSION = pkg.version;
await import(pathToFileURL(oxlintBin).href);
4 changes: 2 additions & 2 deletions packages/cli/binding/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ impl SubcommandResolver {
untracked_env: None,
input: None,
}),
envs: merge_resolved_envs(envs, resolved.envs),
envs: merge_resolved_envs_with_version(envs, resolved.envs),
})
}
SynthesizableSubcommand::Fmt { mut args } => {
Expand Down Expand Up @@ -309,7 +309,7 @@ impl SubcommandResolver {
untracked_env: None,
input: None,
}),
envs: merge_resolved_envs(envs, resolved.envs),
envs: merge_resolved_envs_with_version(envs, resolved.envs),
})
}
SynthesizableSubcommand::Build { args } => {
Expand Down
Loading