[ ] ๐ 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)
[x] โจ 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
Adds declarationExt option that allows customizing extensions of .d.ts files.
The option behaves like this:
declarationExt: undefined
keeps the previous behavior (follows the sources' module format prefix (c|m) if available, otherwise .d.ts)
declarationExt: "d.ts" | "d.mts" | "d.cts"
forces every declaration file emitted to have the configured extension.
declarationExt: "infer"
infers the desired extension of declaration files based on other options like ext and format.
if ext is set, follows its module format prefix (c | m) if available, otherwise .d.ts
if format is set to "cjs", .d.ts
if format is not set or set to "esm", .d.mts
By introducing this option, it enables users to get declaration files with the correct extensions they should be. It was previously impossible to achieve when emitting multiple format of modules from a single source, since it would always emit .d.ts in that case. Now users can explicitly set declarationExt to have desired extensions, or use "infer" to let mkdist decide the best one.
๐ Linked issue
โ Type of change
๐ Description
Adds
declarationExt
option that allows customizing extensions of.d.ts
files.The option behaves like this:
declarationExt: undefined
c|m
) if available, otherwise.d.ts
)declarationExt: "d.ts" | "d.mts" | "d.cts"
declarationExt: "infer"
ext
andformat
.ext
is set, follows its module format prefix (c | m
) if available, otherwise.d.ts
format
is set to"cjs"
,.d.ts
format
is not set or set to"esm"
,.d.mts
By introducing this option, it enables users to get declaration files with the correct extensions they should be. It was previously impossible to achieve when emitting multiple format of modules from a single source, since it would always emit
.d.ts
in that case. Now users can explicitly setdeclarationExt
to have desired extensions, or use"infer"
to let mkdist decide the best one.๐ Checklist