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: supported type of vue@2.7+ #28818

Merged
merged 6 commits into from
Mar 12, 2024

Conversation

baboon-king
Copy link
Contributor

@baboon-king baboon-king commented Jan 29, 2024

Additional details

Add support for vue@2.7+ types.

Steps to test

none

How has the user experience changed?

Better type support in Vue@2.7

PR Tasks

@CLAassistant
Copy link

CLAassistant commented Jan 29, 2024

CLA assistant check
All committers have signed the CLA.

@cypress-app-bot
Copy link
Collaborator

@jennifer-shehane
Copy link
Member

@baboon-king Looks like there's an error being thrown in our build job.
Screenshot 2024-01-29 at 10 44 35 AM

@baboon-king
Copy link
Contributor Author

@baboon-king Looks like there's an error being thrown in our build job. Screenshot 2024-01-29 at 10 44 35 AM

All right. Let's me look look!

@baboon-king
Copy link
Contributor Author

@jennifer-shehane

After my examination.

TBH.
This is a problem that comes from upstream. In "umd.d.ts" he imported an unexported type.
import: /~https://github.com/vuejs/vue/blob/main/types/umd.d.ts#L3
unexported: /~https://github.com/vuejs/vue/blob/main/types/options.d.ts#L163
But /~https://github.com/vuejs/vue?tab=readme-ov-file#vue-2-has-reached-end-of-life lol.

So. I need more time to try and fix it.

@baboon-king
Copy link
Contributor Author

@baboon-king
Copy link
Contributor Author

baboon-king commented Feb 2, 2024

@jennifer-shehane Hi!
Excuse me.

In a nutshell, this is because rollup-plugin-dts has respectExternal: true.
This option is false by default, do you know why you set respectExternal to true.
For npm/vue2 build tasks can I turn off this option, or is it possible?

All external dependencies from node_modules are automatically excluded from bundling. This can be overridden using the respectExternal setting, but it is generally not recommended. While rollup of external @types generally works, it is not recommended.
/~https://github.com/Swatinem/rollup-plugin-dts?tab=readme-ov-file#what-to-expect

@jennifer-shehane
Copy link
Member

@baboon-king I don't recall the context on that one.

@baboon-king
Copy link
Contributor Author

@baboon-king I don't recall the context on that one.

it's Ok!.
Can you review my last commit. it's fixed #28818 (comment)
image

@baboon-king
Copy link
Contributor Author

Hi! @jennifer-shehane

The branch has been rebase , it's clean.

@@ -3,6 +3,9 @@ import json from '@rollup/plugin-json'
import replace from '@rollup/plugin-replace'

const config = {
dtsOptions: {
respectExternal: false
Copy link
Contributor

Choose a reason for hiding this comment

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

was the issue that were were rolling up the vue .d.ts files from 2.6.12 and that was causing issues?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, the issue is not related to rolling up the Vue .d.ts files from 2.6.12. This problem occurs in versions "2.7+" instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

it sounds like we were bundling the declaration types previously which sounded like it caused a collision. Would this change use the declaration files for whatever version of vue2 is installed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This won't affect Vue 2. In most cases, this option (respectExternal) doesn't need to be enabled, at least not for Vue as Vue itself already includes its own types. The documentation of rollup-plugin-dts also specifies that this option is disabled by default.

The main issue is that after upgrading to Vue 2.7+, the respectExternal option of rollup-plugin-dts was causing the npm/vue2 build task to fail. That's why I disabled this option for npm/vue2.

Copy link
Contributor

@AtofStryker AtofStryker left a comment

Choose a reason for hiding this comment

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

@baboon-king can you help me reproduce the type error you were seeing in vue 2.7.16? I created a reproduction repository here but I can't seem to produce a type error under test. Is there something I am missing or forgetting to do here?

@baboon-king
Copy link
Contributor Author

baboon-king commented Mar 1, 2024

@baboon-king can you help me reproduce the type error you were seeing in vue 2.7.16? I created a reproduction repository here but I can't seem to produce a type error under test. Is there something I am missing or forgetting to do here?

@AtofStryker see here.

I created a reproduction case here.
/~https://github.com/baboon-king/typescript-cypress-issue-28591
For Terminal

  1. pnpm install
  2. pnpm run type-check

For vscode

  1. Enable the Vue.vscode-typescript-vue-plugin plugin.
  2. Look at lines 5 and 9 of HelloWorld.cy.ts.

Copy link
Contributor

@AtofStryker AtofStryker left a comment

Choose a reason for hiding this comment

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

The current method of passing in dtsOptions causes warnings in the build. I recommended a work around to at least avoid this

npm/mount-utils/create-rollup-entry.mjs Outdated Show resolved Hide resolved
npm/mount-utils/create-rollup-entry.mjs Show resolved Hide resolved
npm/vue2/rollup.config.mjs Outdated Show resolved Hide resolved
npm/vue2/rollup.config.mjs Show resolved Hide resolved
npm/vue2/rollup.config.mjs Outdated Show resolved Hide resolved
@baboon-king baboon-king force-pushed the develop branch 2 times, most recently from fce145c to fb32750 Compare March 2, 2024 03:19
Copy link
Contributor Author

@baboon-king baboon-king left a comment

Choose a reason for hiding this comment

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

right!MVP

@AtofStryker
I think it's great, but do I need to review your changes?

@AtofStryker
Copy link
Contributor

right!MVP

@AtofStryker I think it's great, but do I need to review your changes?

@baboon-king currently these are just suggestions in the review, which you should be able to apply and test out!

@baboon-king
Copy link
Contributor Author

right!MVP
@AtofStryker I think it's great, but do I need to review your changes?

@baboon-king currently these are just suggestions in the review, which you should be able to apply and test out!

Ok, I see.
And
I've applied and tested it.
at latest commit

Copy link
Contributor

@AtofStryker AtofStryker left a comment

Choose a reason for hiding this comment

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

This seems correct based on /~https://github.com/vuejs/vue/blob/main/CHANGELOG.md#typescript-changes. Though it does feel weird that v3 types would live inside an installed version of vue@2. Tested and things seem appropriate on my end

npm/vue2/rollup.config.mjs Outdated Show resolved Hide resolved
@baboon-king baboon-king force-pushed the develop branch 2 times, most recently from b7d8992 to 8675d4c Compare March 8, 2024 07:14
@jennifer-shehane jennifer-shehane merged commit 854a649 into cypress-io:develop Mar 12, 2024
67 checks passed
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 13, 2024

Released in 13.7.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v13.7.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Mar 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Vue 2.7.16
6 participants