dependency-cruiser icon indicating copy to clipboard operation
dependency-cruiser copied to clipboard

Feature request: Support processing Astro files

Open sushichan044 opened this issue 5 months ago • 3 comments

Context

Once this library can track module dependencies in Astro projects, I can perform static analysis based on import relationships, similar to the existing support for Vue and Svelte.

Expected Behavior

dependency-cruiser can process .astro files and track dependencies

Current Behavior

dependency-cruiser does not support processing .astro files

Possible Solution

Using @astrojs/compiler/sync to process .astro files. https://github.com/withastro/compiler/blob/main/packages/compiler/README.md

Using convertToTSX() method is better since transform exposes imports from Astro's internal modules.

Considered alternatives

sushichan044 avatar Aug 02 '25 11:08 sushichan044

I have a draft implementation that seems to be working.

sushichan044 avatar Aug 02 '25 11:08 sushichan044

Hi @sushichan044 - thanks for the suggestion. I'd never heard of astro, but it does seem to be sorta popular 😄 . And yes, for sure a transpile and/ or an extraction option would be very welcome.

If you think the implementation you have is ready for a PR, know that it is welcome!

sverweij avatar Aug 04 '25 17:08 sverweij

@sverweij I uploaded an untested implementation to #1009. Testing will take some time, but I'll notify you when it's ready for review!

sushichan044 avatar Aug 05 '25 14:08 sushichan044