Skip to content
LogoLogo

Oxcruise

Oxcruise checks the module graph of a JavaScript or TypeScript project and draws it. It is an alternative to dependency-cruiser. It uses the oxc toolchain.

Run it in your project:

npx oxcruise src

When a rule finds a violation, Oxcruise shows the source line, the dependency and the rule. This output is from the tests/fixtures/monorepo fixture of the repository:

error[circular-dependencies]: circular dependency: packages/app/src/cycle-a.ts → packages/app/src/cycle-b.ts → packages/app/src/cycle-a.ts
  --> packages/app/src/cycle-a.ts:1:19
   |
 1 | import { b } from "./cycle-b";
   |                   ^^^^^^^^^^^
   = cycle:
     ╭─▶ packages/app/src/cycle-a.ts
     ╰── packages/app/src/cycle-b.ts

✖ 10 problems (7 errors, 3 warnings) in 21 modules, 24 dependencies
  1 suppressed by comments

Why use Oxcruise

  • Fast. Oxcruise reads, parses, extracts and resolves files in parallel on every core. It searches for cycles in each group of modules that import each other.
  • One parser. It supports TS, TSX, MTS, CTS, JSX, Vue, Svelte and Astro. It knows exactly which imports are type-only. You do not install typescript.
  • Monorepo aware. Each module uses its nearest tsconfig.json. Oxcruise finds workspace packages and #imports.
  • Good defaults. Rules are in categories. The correctness category is on as error, and the suspicious category is on as warn.
  • A small config. A glob is the only pattern language. A forbid rule says what you mean, with {name} captures and ! negation.
  • Plugins in TypeScript. A plugin sees the finished graph. A plugin can also add a reporter.
  • Unused code. Rules find unused exports, dependencies and files, as Knip does.
  • A migration path. The oxcruise --migrate command converts a dependency-cruiser config file.

Where to go next