Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jul 1, 2024
Merged

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

merged 1 commit into from
Jul 1, 2024

Conversation

ferdynator
Copy link
Contributor

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?

  • Manually testing the fix in a local project
  • green ci

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation only change
  • Refactor (non-breaking change which fixes an issue without changing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • 📖 My change doesn't require a documentation update
  • ⚖️
    • The contribution will be subject to The MIT license, and I'm OK with that.
    • The contribution is my own original work.
    • I am ok with the stuff in CONTRIBUTING.md.

Copy link

codeclimate bot commented Jul 1, 2024

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

View more on Code Climate.

@sverweij
Copy link
Owner

sverweij commented Jul 1, 2024

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 sverweij merged commit 8196c9e into sverweij:main Jul 1, 2024
9 checks passed
@sverweij
Copy link
Owner

sverweij commented Jul 1, 2024

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 ferdynator deleted the fix-transpile-vue2-setup-script branch July 1, 2024 12:37
@ferdynator
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants