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

feat: support <script setup> in Vue 2.7 #483

Closed
wants to merge 5 commits into from

Conversation

FelixGraf
Copy link
Contributor

@FelixGraf FelixGraf commented Jul 5, 2022

This PR:

@FelixGraf FelixGraf changed the title DRAFT: feat: support <script setup> in Vue 2.7 feat: support <script setup> in Vue 2.7 Jul 17, 2022
@FelixGraf FelixGraf marked this pull request as ready for review July 17, 2022 15:37
@@ -11,8 +11,9 @@ const stripInlineSourceMap = require('./utils').stripInlineSourceMap
const getCustomTransformer = require('./utils').getCustomTransformer
const loadSrc = require('./utils').loadSrc
const babelTransformer = require('babel-jest').default
const compilerUtils = require('@vue/component-compiler-utils')
const { parse, compileTemplate, compileScript } = require('@vue/compiler-sfc')
Copy link
Contributor

@thebanjomatic thebanjomatic Jul 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vue/compiler-sfc isn't listed as a dependency of this package, so this import is unsound. There is a similar existing issue for the vue-template-compiler import as well (which should probably have been listed as an optional peer dependency).

I know there are other changes in vue 2.7 that make vue-template-compiler no longer necessary, so there might be larger refactors in the works for that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't @vue/compiler-sfc Vue 3 only? I'm really surprised this works at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also looks like tests are failing - you may need to update a snapshot.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see, they now have a v2.7 for this module: https://www.npmjs.com/package/@vue/compiler-sfc

@ebisbe
Copy link

ebisbe commented Aug 4, 2022

Are those changes moving forward?

@lmiller1990
Copy link
Member

Sorry about the delay. Need to fix CI, then we can. @FelixGraf are you able to take a look? 🙏

Again sorry about the slow response - I am not really working on Vue Jest now, but we don't really have any other maintainer, so happy to help push things forward for now.

@FelixGraf
Copy link
Contributor Author

Sorry about the delay. Need to fix CI, then we can. @FelixGraf are you able to take a look? 🙏

Again sorry about the slow response - I am not really working on Vue Jest now, but we don't really have any other maintainer, so happy to help push things forward for now.

Yes, I will be able to take a look at it again this week.

@kiroushi
Copy link
Contributor

@FelixGraf are you finally moving this forward? If not, I might be able to take a look at it.

@lmiller1990
Copy link
Member

@kiroushi I say just go for it, I think we are all aligned in what we want - 2.7 support.

@kiroushi
Copy link
Contributor

@lmiller1990 can you take a look at #489?

@lmiller1990
Copy link
Member

Done, pinged you there! Let's close this in favour of #489.

lmiller1990 added a commit that referenced this pull request Sep 15, 2022
* feat: support <script setup> in Vue 2.7

* refactor: remove unnecessary bindingMetadata

* refactor: remove unnecessary refTransform

* feat: add setup to generateSourceMap

* chore: update Vue dependencies

* fix: remove inline sourceMap in vue2 setup scripts

* fix: update 2.x snapshot

* fix: use appropriate package according to vue version

* fix: rebase typo

* fix: make script setup & script blocks work together

* Update test.js.snap

* fixing snapshots

Co-authored-by: Felix Graf <[email protected]>
Co-authored-by: Lachlan Miller <[email protected]>
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.

5 participants