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 🙏

© 2026 – Pkg Stats / Ryan Hefner

strip-wc-comments

v0.1.1

Published

Strip JSDoc, inline, and HTML comments from distributed web component JS files

Downloads

317

Readme

strip-wc-comments

Strip JSDoc, inline, and HTML comments from distributed web component JS files.

Web component libraries ship JS files that include JSDoc blocks, inline comments, and HTML comments inside template literals for slot documentation. These are useful during development but unnecessary in production. This tool removes them.

Install

npm install strip-wc-comments

Usage

npx strip-wc-comments [options] <file-or-dir> [...]

With no flags, all comment types are stripped.

npx strip-wc-comments ./node_modules/@my-lib/elements/

Strip only specific comment types:

npx strip-wc-comments --jsdoc --html ./node_modules/@my-lib/elements/

Preview changes without writing:

npx strip-wc-comments --dry-run ./node_modules/@my-lib/elements/

Write to a separate directory instead of modifying in place:

npx strip-wc-comments -o dist-clean/ ./node_modules/@my-lib/elements/

Options

| Flag | Description | | --- | --- | | -j, --jsdoc | Strip JSDoc comments (/** ... */) | | -i, --inline | Strip single-line comments (// ...) | | -H, --html | Strip HTML comments inside template literals (<!-- ... -->) | | -s, --sourcemap | Strip //# sourceMappingURL lines | | -a, --all | Strip all comment types (default if no flags given) | | -n, --dry-run | Print what would change without writing files | | -o, --out <dir> | Write cleaned files to <dir> instead of modifying in place | | -h, --help | Show help |

Comment types

JSDoc (--jsdoc) — class-level descriptions, @summary, @alias, property and method docs:

/**
 * Provides a styled link or button for prominent user actions.
 * @summary Styled link or button for prominent user actions
 */

Inline (--inline) — TODO notes, workaround comments, eslint directives:

// workaround for lit-ssr bugs
// TODO: remove in next major version

HTML (--html) — slot documentation embedded in tagged template literals:

html`<!--
  summary: Default slot
  description: |
    Slot an anchor or button as the first child.
--><slot></slot>`;

Source maps (--sourcemap) — trailing source map references:

//# sourceMappingURL=my-element.js.map

SSR + CDN hydration

[!WARNING] If you server-side render web components from local files and hydrate on the client from a CDN, the sources must match. Stripping comments from only your local copy creates a mismatch between the server-rendered declarative shadow DOM and the client-side component definitions. This can cause hydration errors, duplicated shadow roots, or broken interactivity.

Either strip comments from both sources or neither. If you only control the local files, do not strip comments unless the CDN serves the same modified build.

CI/CD

Run as an explicit build step in your pipeline:

strip-wc-comments -o dist/ ./node_modules/@my-lib/elements/

License

MIT