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

@iyowei/js-module-dependencies-to-be-installed

v1.0.1

Published

JavaScript 模块(esm, cjs, amd, ts, tsx, jsx)说明符过滤器:需要额外安装的的模块。

Downloads

1

Readme

jsModuleDependenciesToBeInstalled(specifiers)

JavaScript 模块(esm, cjs, amd, ts, tsx, jsx)说明符过滤器:需要额外安装的的模块。

依赖(说明符)收集器,见 Precinct

使用

  • specifiers {Array} Precinct 收集器收集到的模块说明符集合,默认 []
  • 返回 {Array} 需要额外安装的的模块名称。
import { readFileSync } from "fs";
import { log } from "console";

import precinct from "detective-es6";
import jsModuleDependenciesToBeInstalled from "@iyowei/js-module-dependencies-to-be-installed";

/**
 * "/Users/iyowei/Development/iyowei/create-esm/cli.js" 片段,
 *
 * import { existsSync } from "fs";
 * import { Listr } from "listr2";
 * import shell from "shelljs";
 * import meow from "meow";
 * import chalk from "chalk";
 * import { banner, mainHelp, setupHelp, COMMAND_SET, COMMAND_DEFAULTS, getReport } from "./src/messages.js";
 * import pressAnyKeyToContinue from "./src/pressAnyKeyToContinue.js";
 * import { updateGlobalConfigurations, getGlobalConfigurations } from "./src/options/global.js";
 * import makeOptions from "./src/options/make.js";
 * import prerequisites from "./src/prerequisites.js";
 */
const specifiers = precinct(
  readFileSync("/Users/iyowei/Development/iyowei/create-esm/cli.js", "utf-8")
);

const read = jsModuleDependenciesToBeInstalled(specifiers);
console.log("read", read);
// read: [ 'listr2', 'shelljs', 'meow', 'chalk' ]

const given = jsModuleDependenciesToBeInstalled([
  "./startup.js",
  "../config.mjs",

  "file:///opt/nodejs/config.js",

  "/opt/nodejs/config.mjs",

  "fs",
  "node:fs",
  "node:fs/promise",

  "some-package",

  "@others/test",
  "@npmcli/package-json",

  "@npmcli/package-json/promise",
  "some-package/lib/shuffle.mjs",
]);
console.log("given", given);
// given: given [ 'some-package', '@others/test', '@npmcli/package-json' ]

安装

Node version

# Pnpm
pnpm add @iyowei/js-module-dependencies-to-be-installed

# yarn
yarn add @iyowei/js-module-dependencies-to-be-installed

# npm
npm add @iyowei/js-module-dependencies-to-be-installed

设计

ESM, CJS, AMD, TS, TSX, JSX,等等,模块定义很多,对应了不同依赖(说明符)收集器,但说明符规范是一致的,所以将过滤器部分提取出来,方便复用。

参与贡献

PRs Welcome