You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Describe the bug
While using Shiki, I encountered some issues that prevented me from correctly introducing certain type information into Shiki derivatives. Firstly, when I attempted to pass the correct type to the transformer, I found that Shiki/Core does not export the relevant types (related to 'hast'). The types I needed were bundled into the output instead of being an external dependency, although this behavior differs in other secondary applications. Here, I briefly investigated the package dependencies and potential issues involved.
@shikijs/rehyp -> hast-util-to-string has a dependency on 'hast'.
@shikijs/transformers -> @shiki -> @shiki/core all use 'hast' in the dependency chain but do not have a direct dependency on 'hast'.
@shikijs/twoslash does not have a 'hast' dependency but depends on 'shikijs core', which bundles 'hast' types.
@shikijs/vitepress-twoslash has a dependency on 'hast' through 'mdast-util-to-hast'.
These cases can be categorized as follows:
Using 'hast' types without marking them as dependencies, only as development dependencies, which may cause type-related issues when used independently.
Using 'hast' types with corresponding 'hast' dependencies in sub-dependencies, which are ghost dependencies that are not detected. It is not entirely safe but not a significant problem. (Why are there ghost dependencies even with pnpm? Because '@types/hast' is marked as a global dependency in the workspace.)
Using 'hast' types without marking them as external dependencies, resulting in bundling 'hast' types directly into the final output and making it impossible to use the exported types. Version issues may arise.
For the above three cases, I suggest using peerDependencies to mark '@types/hast' and removing the workspace's '@types/hast' dependency to ensure proper detection of ghost dependencies.
I would like to see if there is a better way to handle this or if there are any other suggestions. If possible, I would like to fix this issue myself.
Reproduction
undefined
Contributes
I am willing to submit a PR to fix this issue
I am willing to submit a PR with failing tests
The text was updated successfully, but these errors were encountered:
Validations
Describe the bug
While using Shiki, I encountered some issues that prevented me from correctly introducing certain type information into Shiki derivatives. Firstly, when I attempted to pass the correct type to the transformer, I found that Shiki/Core does not export the relevant types (related to 'hast'). The types I needed were bundled into the output instead of being an external dependency, although this behavior differs in other secondary applications. Here, I briefly investigated the package dependencies and potential issues involved.
@shikijs/rehyp -> hast-util-to-string
has a dependency on 'hast'.@shikijs/transformers -> @shiki -> @shiki/core
all use 'hast' in the dependency chain but do not have a direct dependency on 'hast'.@shikijs/twoslash
does not have a 'hast' dependency but depends on 'shikijs core', which bundles 'hast' types.@shikijs/vitepress-twoslash
has a dependency on 'hast' through 'mdast-util-to-hast'.These cases can be categorized as follows:
For the above three cases, I suggest using peerDependencies to mark '@types/hast' and removing the workspace's '@types/hast' dependency to ensure proper detection of ghost dependencies.
I would like to see if there is a better way to handle this or if there are any other suggestions. If possible, I would like to fix this issue myself.
Reproduction
undefined
Contributes
The text was updated successfully, but these errors were encountered: