Conversation
|
@ocavue, The desire to enable This PR must not be a breaking change. Existing scripts that call Temml must continue to work. Do you have any comments or changes to suggest? |
db9f2bf to
68c20e7
Compare
|
In the ESM file, you can have both default export See the following links if you want to learn more: https://rollupjs.org/configuration-options/#output-esmodule
I've updated the code in this PR so that only the ESM output is updated. CJS and IIFE are not affected. ESM ( No This ensures that we don't have any breaking changes for all users. |
This pull request introduces ESM named exports, similar to KaTeX/KaTeX#3992.
This allows users to import the API directly:
Named exports are also beneficial for tree shaking, helping to reduce code size in production applications.
Additionally, this pull request includes some fixes for the
.d.tsfile. For example, the previous.d.tsfile mentions a function callgenerateParseTree, but in reality, this function has been renamed to__parsein the JavaScript implementation.I believe this is because you want to import the type
@type {import('./temml').generateParseTree}in the.jsfile. Nowadays,typescriptallows users to write types in.jsfiles as JSDoc comments, which can then generate.d.tsfiles using.jsfiles as the source of truth. If you don't mind adding a few more dependencies (e.g.,typescriptandtsdown), I can open a separate pull request to move the type definitions into the.jsfiles and generate.d.tsfiles based on that.