Skip to content

fix: correct dts generation for stub mode#314

Merged
pi0 merged 7 commits intounjs:mainfrom
xiaoxiangmoe:main
Jun 4, 2024
Merged

fix: correct dts generation for stub mode#314
pi0 merged 7 commits intounjs:mainfrom
xiaoxiangmoe:main

Conversation

@xiaoxiangmoe
Copy link
Contributor

@xiaoxiangmoe xiaoxiangmoe commented Sep 14, 2023

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

The document write:

/**
 * * `compatible` means "src/index.ts" will generate "dist/index.d.mts", "dist/index.d.cts" and "dist/index.d.ts".
 * * `node16` means "src/index.ts" will generate "dist/index.d.mts" and "dist/index.d.cts".
 * * `true` is equivalent to `compatible`.
 * * `false` will disable declaration generation.
 * * `undefined` will auto detect based on "package.json". If "package.json" has "types" field, it will be `"compatible"`, otherwise `false`.
 */

The behavior of the declaration option is inconsistent with the documentation.

  • If I write use 'node16', it will also convert to true.
  • If I write use false, it may convert to true if we have types or typing field in package.json. see declaration not work #313 (This is a reasonable requirement since we may use other tools to package .d.ts. Just use unbuild to package .js)

So I create a bug fix for it.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@xiaoxiangmoe xiaoxiangmoe marked this pull request as draft September 14, 2023 06:16
@xiaoxiangmoe xiaoxiangmoe force-pushed the main branch 3 times, most recently from 799443b to cd91e98 Compare September 14, 2023 06:28
@xiaoxiangmoe xiaoxiangmoe marked this pull request as ready for review September 14, 2023 06:28
@xiaoxiangmoe xiaoxiangmoe changed the title fix: declaration compatible option fix: declaration option Sep 14, 2023
@pi0 pi0 changed the title fix: declaration option fix: correct declaration option Oct 30, 2023
@pi0 pi0 changed the title fix: correct declaration option fix: correct declaration option behavior Oct 30, 2023
@Miofly
Copy link

Miofly commented Nov 9, 2023

i encounter this problem

@pi0 pi0 changed the title fix: correct declaration option behavior fix: correct dts generation for stub mode Jun 4, 2024
@pi0
Copy link
Member

pi0 commented Jun 4, 2024

Thanks for PR dear @xiaoxiangmoe and sorry for late merge. I've rebased it together with #371 to land

@pi0 pi0 merged commit 44fa118 into unjs:main Jun 4, 2024
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.

3 participants