markdown-it / mdurl

URL utilities for markdown-it

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESM version

Konakona-chan opened this issue · comments

Hello there.

As for 2021, NodeJS versions <12 without ESM support (are deprecated)[https://nodejs.org/en/about/releases/]. To use modern standard spec and features like top-level await natively, dependencies should be converted to ESM. There are some solutions in specific packers like Vite/Snowpack, but they are unreliable (because they, for example, are trying to traverse through the codebase with regular expressions and replace module. with exports , etc.), see vitejs/vite#3024. Moreover, as a developer, I want to be able to use mdurl (indirectly) in tests and cmd utilities without extra bundlers/packers. Other benefits include:

  • ESM packages can be imported by Deno, Browser and Node.
  • ESM in NodeJS can import cjs packages as well (the reverse is not true for cjs unless you don't use async import(..))
  • ESM are more secure by design in a way that it can't be tamper because ESM exports are frozen/immutable by default

This package is done specially for markdown-it (as said in readme), and not recommended for other use. I don't like to change development process "just for fun". markdown-it itself already has ESM build.

With some other tools/modules now using mdurl (in my case nuxt/content), could you please reconsider this and provide an esm version?