npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

importly

v0.2.3

Published

importly generates import maps

Downloads

227

Readme

📦📡 importly — import map generator

importly is a command-line utility that generates import maps.

so your apps can load es module packages without a bundler.

works nicely with es-module-shims.

🛸 importly basic usage

npx importly < package-lock.json > importmap.json

--host=node_modules
specify where the import map points to.
where the dependencies will be loaded from.

  • --host=node_modules (default) — point to your node_modules directory
  • --host=unpkg — point to the unpkg cdn
  • --host=jsdelivr — point to the jsdelivr cdn

--dev
include your package's devDependencies.

--lookup=node_modules
tell importly where to seek information about packages.
it needs to inspect each package json.

  • --lookup=node_modules (default) — look in your local node_modules directory
  • --lookup=unpkg — query the unpkg cdn
  • --lookup=jsdelivr — query the jsdelivr cdn

--root=/
the url prefix that leads to your node_modules directory.
this affects where the importmap is pointing to.
only applies when --host=node_modules.

  • --root=/ (default) — find node_modules at your server root
  • --root="" — find node_modules in the current directory
  • --root=/my/special/path/ — find node_modules at /my/special/path/node_modules

--semver=exact
the semver prefix to use on the import map versions.
only applies when pointing to a cloud cdn.

  • --semver=exact or --semver="" (default) no prefix, use pinned versions
  • --semver=major or --semver=^ pin major version, with caret prefix
  • --semver=minor or --semver=~ pin minor version, with tilde prefix

--mini
minify importmap output.
eliminates whitespace.

🌠 the more you know, about importly

you don't have to use a package-lock.json

  • a package.json will work.
  • actually, any json that has dependencies will work.
  • however, the package-lock.json is better because it includes subdependencies (and they're scoped, which means your dependencies can use different versions of a single subdependency)

scoped subdependencies only work when

  • you're using a package-lock.json
  • and you're using --host=node_modules

works offline when

  • you're using --host=node_modules
  • and you're using --lookup=node_modules

🍻 importly is open source

  • ask any questions in the issues or discussions tab
  • fix that bug, send me those pull requests
  • show me some love with your sweet github stars