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

nv-cli-expt-strlit

v1.0.0

Published

cli tool, export string-literal in js/ts/json of a dir

Downloads

7

Readme

nv-cli-expt-strlit

  • cli-tool
  • expt all strlit in js/ts/json of a dir
  • for paramiterize a project (hoist all literal)
  • the fixed string(normally irregulable AND not well-defined) of a project is boring when do automation-generate

install

  • npm install nv-cli-expt-strlit -g

usage

    Usage: nv_cli_expt_strlit [options]
    Options:
        -p, --path            path to search ,default ./
        -m, --max_size        estimated max_size of ast-nodes ,default 20000
        -u, --suffixes        default js ts json
        -h, --help            usage

example

for example, find all string in nodejs/lib source code

        nv_cli_expt_strlit -p "../node/lib"

        will generate 3 files:
                root@dev:/opt/JS/nd18/WORK# ls -l | egrep str
                -rw-r--r--   1 root root  104712 Nov 12 10:22 str.brief.json
                -rw-r--r--   1 root root 1133599 Nov 12 10:22 str.pas.json
                -rw-r--r--   1 root root 1919232 Nov 12 10:22 str.tbl.json
                root@dev:/opt/JS/nd18/WORK#       

brief is a array of string

      ......

      "timers._unrefActive() is deprecated.",
      "timers.active() is deprecated. Please use timeout.refresh() instead.",
      "timers.enroll() is deprecated. Please use setTimeout instead.",
      "timers.unenroll() is deprecated. Please use clearTimeout instead.",
      "timers/promises",
      "tis-620",
      "tls",
      "tls.TLSSocket instead.",
      "tls.createSecurePair() is deprecated. Please use ",
      "tlsClientError",
      "tls_wrap",
      "to",
      "to '",
      "to use the '.cjs' file extension.",
      "toASCII",
      "toString",
      "toUnicode",
      "traceDeprecation",
      "traceProcessWarnings",
      "trailer",
      "trailer content",
      "trailers",
      "transfer-encoding",
      "transform.readable",
      "transform.writable",
      "transformSource",
      "transformer.readableType",
      "transformer.writableType",  
      .....               

pas is a dict

   {
       【<file-path> : {
           【<ast-path> : String】 +
       }】 +
       
   }


      "/opt/JS/nd18/lib/_http_outgoing.js": {
        "body/1/declarations/0/init/arguments/0": "internal/streams/state",
        "body/2/declarations/0/init/arguments/0": "internal/assert",
        "body/3/declarations/0/init/arguments/0": "events",
        "body/4/declarations/0/init/arguments/0": "stream",
        "body/5/declarations/0/init/arguments/0": "internal/util",
        "body/6/declarations/0/init/arguments/0": "internal/http",
        "body/7/declarations/0/init/arguments/0": "buffer",
        "body/8/declarations/0/init/arguments/0": "_http_common",
        "body/9/declarations/0/init/arguments/0": "internal/async_hooks",
        "body/10/declarations/0/init/arguments/0": "internal/errors",
        "body/11/declarations/0/init/arguments/0": "internal/validators",
        "body/12/declarations/0/init/arguments/0": "internal/util/types",
        "body/13/declarations/0/init/callee/object/arguments/0": "internal/util/debuglog",
        "body/13/declarations/0/init/arguments/0": "http",
        "body/15/declarations/0/init/arguments/0": "corked",
        "body/18/body/body/0/argument/right/right": "cookie",
       ....
      }

tbl is a array of 3-tuple

      Array<[path,ast-path,String]> 
        ...
          [
            "/opt/JS/nd18/lib/internal/modules/esm/translators.js",
            "body/36/expression/arguments/1/body/body/0/expression/arguments/0",
            "Importing JSON modules"
          ],
          [
            "/opt/JS/nd18/lib/internal/modules/esm/translators.js",
            "body/36/expression/arguments/1/body/body/1/expression/arguments/2",
            "load"
          ],
          [
            "/opt/JS/nd18/lib/internal/modules/esm/translators.js",
            "body/36/expression/arguments/1/body/body/3/declarations/0/init/test/arguments/1",
            "file:"
          ],
        ...

LICENSE

  • ISC