speed-highlight / core

A lightweight syntax highlighter written in JavaScript
https://speed-highlight.github.io/core/examples/
Creative Commons Zero v1.0 Universal
268 stars 15 forks source link

Add Typescript definitions #34

Closed BearToCode closed 1 year ago

BearToCode commented 1 year ago

I added custom d.ts types definitions for the main entrypoints, closing #32. I also changed the build process as following:

matubu commented 1 year ago

Thanks for your pull request! Looks great! 👍

matubu commented 1 year ago

It looks like adding the dist folder to the gitignore has caused problems with the Deno package functionality. To resolve this, we may need to consider reversing that particular change.

Additionally, after merging the PR, the bundle size has increased significantly due to the dynamicImportVars plugin and the large switch case it creates. To make sure this doesn't negatively impact users who are not using Vite, we should work on separating the Vite version of the build from the main build.

BearToCode commented 1 year ago

Regarding dynamicImportVars: if you prefer a smaller bundle size you can remove that plugin, but maybe add a mention of the issue in the readme so users can get a workaround. Could you be more specific about the Deno problem? I might also look into that.

I also noticed a few options that need to be changed regarding types that I forgot to put in my previous PR, so you may want to wait so that I can add them in a new PR.

BearToCode commented 1 year ago

@matubu I created a new PR for the fixes I mentioned (#35).

I think the problem with Deno is that the .zip file bundled in the GitHub release does not contain the dist folder. I did not understand how the release is created in the action, but I think that you to have to make the runner execute npm run build, zip the dist folder and use that in the release. (At least, that's my guess but you better check yourself)

matubu commented 1 year ago

Thanks for your PR, @BearToCode. I will work on fixing the deno package issue