File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,11 @@ if (!process.argv.includes('--lsp')) {
1111}
1212
1313import { createRequire } from 'node:module' ;
14+ import { dirname , join } from 'node:path' ;
1415import { pathToFileURL } from 'node:url' ;
1516
1617const require = createRequire ( import . meta. url ) ;
17- const oxfmtBin = require . resolve ( 'oxfmt/bin/oxfmt' ) ;
18+ const oxfmtMainPath = require . resolve ( 'oxfmt' ) ;
19+ const oxfmtBin = join ( dirname ( dirname ( oxfmtMainPath ) ) , 'bin' , 'oxfmt' ) ;
1820
1921await import ( pathToFileURL ( oxfmtBin ) . href ) ;
Original file line number Diff line number Diff line change 1111 * provides high-performance code formatting capabilities.
1212 */
1313
14+ import { dirname , join } from 'node:path' ;
15+
1416import { DEFAULT_ENVS , resolve } from './utils/constants.ts' ;
1517
1618/**
@@ -27,8 +29,13 @@ export async function fmt(): Promise<{
2729 binPath : string ;
2830 envs : Record < string , string > ;
2931} > {
30- // Resolve the oxfmt binary directly (it's a native executable)
31- const binPath = resolve ( 'oxfmt/bin/oxfmt' ) ;
32+ // Resolve the oxfmt package path first, then navigate to the bin file.
33+ // The bin/oxfmt subpath is not exported in package.json exports, so we
34+ // resolve the main entry point and derive the bin path from it.
35+ // resolve('oxfmt') returns .../oxfmt/dist/index.js, so we need to go up
36+ // two directories (past 'dist') to reach the package root.
37+ const oxfmtMainPath = resolve ( 'oxfmt' ) ;
38+ const binPath = join ( dirname ( dirname ( oxfmtMainPath ) ) , 'bin' , 'oxfmt' ) ;
3239
3340 return {
3441 binPath,
You can’t perform that action at this time.
0 commit comments