{"_id":"@arocnies/fitc4-dependency-cruiser","name":"@arocnies/fitc4-dependency-cruiser","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@arocnies/fitc4-dependency-cruiser","version":"0.1.0","description":"dependency-cruiser as a FitC4 scan provider — JS/CJS/ESM dependency observations for the LikeC4 model to judge","license":"MIT","author":{"name":"Aaron Nies"},"repository":{"type":"git","url":"git+https://github.com/arocnies/fitc4.git","directory":"packages/fitc4-dependency-cruiser"},"homepage":"https://github.com/arocnies/fitc4#readme","bugs":{"url":"https://github.com/arocnies/fitc4/issues"},"keywords":["architecture","likec4","c4","dependency-cruiser","fitc4","boundaries"],"type":"module","sideEffects":false,"engines":{"node":">=22.22.3"},"main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"check":"npm run typecheck && npm run build && npm run test","build":"node -e \"fs.rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.build.json","prepack":"npm run build","typecheck":"tsc --noEmit","test":"vitest run"},"dependencies":{"dependency-cruiser":"^18.2.0"},"peerDependencies":{"@arocnies/fitc4":"^0.1.0"},"devDependencies":{"@types/node":"^26.2.0","@arocnies/fitc4":"^0.1.0","typescript":"^6.0.3","vitest":"^4.1.10"},"gitHead":"8df7ef8a59c078730c87884a9c98f0b6a22ac9a1","_id":"@arocnies/fitc4-dependency-cruiser@0.1.0","_nodeVersion":"26.4.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-QGiuGd3PgKi6eXsKCOEcz7UybJ2AyoXs+uOQBEbOM8MolFq3Mo48mdcN5YYM+LzFppi7CEP+pkEDiIgqaObvDQ==","shasum":"ed46741f9b571896c31d01c94482b600db132702","tarball":"https://registry.npmjs.org/@arocnies/fitc4-dependency-cruiser/-/fitc4-dependency-cruiser-0.1.0.tgz","fileCount":5,"unpackedSize":24994,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCt7w0HJkinz9jOxAiJ0Gwp2V6ZJxdn87XgYAW9Bc4MzQIgetMCK8pfKFw0CEEHHYm8VOs+A830INQ1sh+YPAwPBX8="}]},"_npmUser":{"name":"arocnies","email":"arocnies@gmail.com"},"directories":{},"maintainers":[{"name":"arocnies","email":"arocnies@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fitc4-dependency-cruiser_0.1.0_1787589903029_0.9818163373313114"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-24T16:45:02.891Z","0.1.0":"2026-08-24T16:45:03.183Z","modified":"2026-08-24T16:45:03.355Z"},"maintainers":[{"name":"arocnies","email":"arocnies@gmail.com"}],"description":"dependency-cruiser as a FitC4 scan provider — JS/CJS/ESM dependency observations for the LikeC4 model to judge","homepage":"https://github.com/arocnies/fitc4#readme","keywords":["architecture","likec4","c4","dependency-cruiser","fitc4","boundaries"],"repository":{"type":"git","url":"git+https://github.com/arocnies/fitc4.git","directory":"packages/fitc4-dependency-cruiser"},"author":{"name":"Aaron Nies"},"bugs":{"url":"https://github.com/arocnies/fitc4/issues"},"license":"MIT","readme":"# @arocnies/fitc4-dependency-cruiser\n\n[dependency-cruiser](https://github.com/sverweij/dependency-cruiser) as a [FitC4](https://github.com/arocnies/fitc4) scan provider.\n\nFitC4's built-in scanner reads TypeScript sources with the TypeScript compiler API. This package covers what that scanner cannot. Plain JavaScript, CommonJS, ESM, mixed projects: anything dependency-cruiser can cruise. The division of labor stays the same: **dependency-cruiser observes, the LikeC4 model judges.** The adapter emits observations only; the standard resolve and validate providers turn them into findings, without knowing which scanner ran.\n\nUse the built-in `typescriptImports` scanner for pure-TypeScript projects (it has line-level evidence and tsconfig-alias awareness built in). Reach for this package when the code under architecture control is JavaScript, or a JS/TS mix.\n\nThis package is versioned and published separately from `@arocnies/fitc4` (it declares `@arocnies/fitc4` as a peer dependency).\n\n## Install\n\n```sh\nnpm i -D @arocnies/fitc4 @arocnies/fitc4-dependency-cruiser\n```\n\n## Usage\n\nA complete `fitc4.config.ts`:\n\n```ts\nimport { architectureRules, defineConfig, sourceRoot } from '@arocnies/fitc4'\nimport { dependencyCruiser } from '@arocnies/fitc4-dependency-cruiser'\n\nexport default defineConfig({\n  version: 1,\n  repositoryRoot: '.',\n  model: 'arch',\n  scan: [\n    dependencyCruiser({\n      roots: ['src'],\n      // Optional pass-throughs, when the host project resolves through them:\n      // tsconfigPath: 'tsconfig.json',       // paths/baseUrl aliases\n      // webpackConfigPath: 'webpack.config.js', // resolve.alias etc.\n    }),\n  ],\n  resolve: [sourceRoot()],\n  validate: [architectureRules()],\n})\n```\n\n`dependencyCruiser(options)` returns a `NamedProvider<ScanProvider>` with id `dependency-cruiser`, so it composes anywhere a scan provider does, whether that is a config file or a direct `runPipeline` call. It uses dependency-cruiser's programmatic `cruise()` API; nothing shells out.\n\nOptions:\n\n| Option | Default | Meaning |\n|---|---|---|\n| `roots` | `['.']` (the whole scan context) | Repository-relative directories to cruise. These bound what is under architecture control. |\n| `tsconfigPath` | none | tsconfig whose `paths`/`baseUrl` apply during resolution (requires `typescript` installed). |\n| `webpackConfigPath` | none | webpack config whose `resolve` options apply (requires `webpack` installed). |\n\n## Observation mapping\n\n| dependency-cruiser | FitC4 observation | Notes |\n|---|---|---|\n| a cruised module in this repository | `file` | `subject` is a `file` ref with the repository-relative POSIX path; id `file:<path>` |\n| a resolved dependency on repository code | `dependency` | `target` is a `file` ref; `data.external: false`; id `dependency:<from>-><specifier>` |\n| a resolved dependency on a Node builtin or an installed package | `dependency` | `target` is a `module` ref holding the specifier as written (`node:path`, `semver`); `data.external: true` |\n| an unresolvable specifier that is demonstrably not our code (builtin, or declared in a `package.json` between the file and the repository root) | `dependency` | `data.external: true`, `data.resolved: false` |\n| any other unresolvable specifier | `unresolved-dependency` | a broken relative path, a broken alias, or a phantom package must not silently drop out of the check |\n| each cruised root | `scan-root` | the coverage attestation; `data.files` counts the modules the cruise covered under that root |\n\n`data` carries `specifier`, `dependencyKind` (`import`, `require`, `dynamic-import`), `external`, and `resolved`, the same keys the built-in scanner emits.\n\n## Fail closed\n\nAnything that would make an empty result indistinguishable from a clean run throws instead, which the FitC4 core reports as a `provider-failure` finding:\n\n- no roots configured,\n- a root that is not a directory,\n- a root that exists but yields no modules,\n- any `cruise()` failure, including an unreadable tsconfig or webpack config.\n\n## Differences from the built-in scanner\n\n- **No line numbers.** dependency-cruiser reports module-level edges, so dependency ids are `dependency:<from>-><specifier>` (no `:line` component) and evidence has no `line`.\n- **Repeated references collapse.** dependency-cruiser reports one edge per specifier per file; the built-in scanner records each occurrence with its own line.\n- **Coverage can exceed the roots.** The roots are enumerated on disk, but modules outside them that the cruise reaches through imports are observed too; the built-in scanner observes only files under the roots.\n- **Test files are excluded the same way.** The filename and directory conventions also cover the JavaScript extensions (`*.test.js`, `__tests__/`, ...). A test crossing a boundary is a testing decision, not a declared architectural dependency.\n","readmeFilename":"README.md","_rev":"1-551cc1630ee540fa48b6e774a5e2071f"}