โ— PHANTOM
๐Ÿ‡ฎ๐Ÿ‡ณ IN
โœ•
Skip to content

Blazing fast ESM compiler and importmap generator

License

Notifications You must be signed in to change notification settings

codingjoe/esimport

esimport: Blazing fast ESM compiler and importmap generator

Baseline: Newly available

Why

ESM is the future. No bundling, no bullsh*t.

esimport is fast ๐Ÿ”ฅ, simpel ๐Ÿงƒ, secure ๐Ÿดโ€โ˜ ๏ธ, and backwards compatible โ˜Ž๏ธ.

Comparison esimport vs esh.sh vs jsDelivr
esimport esm.sh jsDelivr
private package support โœ… โŒ โŒ
offline development โœ… โš ๏ธ โŒ
dependabot support โœ… โŒ โŒ
integrity support โœ… โŒ โŒ
supply chain attacks protection โœ… โŒ โŒ
highly efficient client caching โœ… โœ… โœ…

Usage

# esimport <package-root> <output-dir> [--watch,--serve,--path-prefix,--verbose,--help]
npx esimport . ./public/static/  --serve

That's it!

Output

Let's assume we have a project with Lit and a custom component defined via imports. After running esimport we have the following output:

# the folder containing browser ready ESM files
$ tree -d out
out
โ”œโ”€โ”€ src
โ””โ”€โ”€ node_modules
    โ”œโ”€โ”€ lit
    โ”‚   โ”œโ”€โ”€ decorators
    โ”‚   โ””โ”€โ”€ directives
# a fully resolved importmap with sha512 hashes
$ jq '.' out/importmap.json
{
  "imports": {
    "#js/components/myWidget": "src/js/components/myWidget-KWLRK5KY.js",
    "lit": "node_modules/lit/index-W3JFEEGS.js",
    "lit/async-directive.js": "node_modules/lit/async-directive-C4RAQ6VS.js",
    "lit/decorators.js": "node_modules/lit/decorators-RLPUYE5L.js",
    // โ€ฆ
  },
  "integrity": {
    "src/js/components/myWidget-KWLRK5KY.js": "sha512-AcfJS2+aGBtNqX5ZPJFJPySC+bmDKC7I64mExuSJM+qnWmSrahd/a94XnsdpyeQWry9DaivErfhxu8avQ3Tiow==",
    "node_modules/lit/index-W3JFEEGS.js": "sha512-CxSTqZXCqTYvL7K0JJtFT5NJdVYp8fJnjXR6pVt/IcC3VAcr+J5EtQsgLR9Q30C0SJD/QmeX+cd6C4T8cbdihg==",
    "node_modules/lit/async-directive-C4RAQ6VS.js": "sha512-bftcjSsligJFPy44umcVoBR8A5Gnaosp6uLUett18w9zNaqfC6BgSFzIErq0Npb1tNUPwwCQckIMjKFyYKAGBg==",
    "node_modules/lit/decorators-RLPUYE5L.js": "sha512-zDE+J+OhoRU8Lle7jSxZVojj8JoWZuqWf2QzvFfF2CWgk4lGycTj8c7rZ3p24OLVDAhe/vUTWsb3gbt5m8JLgw==",
    // โ€ฆ
  }
}

About

Blazing fast ESM compiler and importmap generator

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •