sverweij / dependency-cruiser

Validate and visualize dependencies. Your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.
https://npmjs.com/dependency-cruiser
MIT License
5.15k stars 249 forks source link

fix(extract/transpile): transpile script setup with vue 2 #942

Closed ferdynator closed 2 months ago

ferdynator commented 2 months ago

Description

Currently the vue2 template compiler only extracts content from the script section of single file components. Script setup SFCs are supported since version 2.17. This MR updates the implementation analogous to the vue 3 @vue/compiler-sfc to extract content from <setup script> components in case they exist

Motivation and Context

Without this change Vue 2 components using <script setup> appear empty to dependency cruiser leading to missing imports.

How Has This Been Tested?

Types of changes

Checklist

codeclimate[bot] commented 2 months ago

Code Climate has analyzed commit 6c43fa4b and detected 0 issues on this pull request.

View more on Code Climate.

sverweij commented 2 months ago

Hi @ferdynator thanks for this fix! I totally missed this was possible in vue2.

Code modification is clear & great to see additional unit tests to prevent regression

=> LGTM

sverweij commented 2 months ago

Hi @ferdynator (and @timleers) - when you're reading this dependency-cruiser@16.3.5, which includes this fix, is published on npmjs.

Thanks again for the well-documented and executed PR!

ferdynator commented 2 months ago

Thank you for merging it so quickly. I can confirm that the new version fixes our issue.