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

auto-lit-tag-name-map

v1.1.1

Published

Auto set TypeScript HTMLElementTagNameMap for lit-element

Downloads

18

Readme

auto-lit-tag-name-map

MEAN Module Build Status npm version Node.js Version

Auto set TypeScript HTMLElementTagNameMap for lit-element.

Limitations

auto-lit-tag-name-map has two modes:

Default mode

  • Pros:
    • Uses TypeScript AST to parse and write source code. Can handle all edge cases (e.g. declare global not declared, HTMLElementTagNameMap not declared, HTMLElementTagNameMap declared but does not contain the right custom element tags, etc).
  • Cons:
    • TypeScript compiler emit API does not preserve empty lines between classes or functions. issue.
    • Prettier does not add lines if they were removed. issue.

Safe mode

  • Pros:
    • To address the issue above, safe mode only uses TypeScript AST to analyze files, once it encounters an edge case mentioned above, it simply ignores the target file. Therefore, it can only handle one situation where there is no declare global declared in target file. In this case, it constructs a declare global block with HTMLElementTagNameMap inside and appends the block of code to the end of the target file.
  • Cons:
    • Cannot handle edge cases mentioned above.

Prettier

In both modes, auto-lit-tag-name-map will avoid rewriting files that look good. It's also recommended to use prettier (pass a prettier config file path via --prettier CLI option) to format rewritten files.

Usage

Usage
  $ npx auto-lit-tag-name-map@1 "<glob>" [options]

Inputs
  <glob> Glob search patterns (always quote the glob to avoid misinterpretation by the shell).

Options
  --prettier   Prettier config file used to format the files to be rewritten.
  --dry-run    Do not rewrite any file, but show a list of files to be rewritten.
  --safe-mode  Enable safe mode, see repo README.md for details.

Examples
  $ npx auto-lit-tag-name-map@1 "./src/components/**/*.ts" --safe-mode --prettier ./.prettierrc.js