@ecosyste-ms/critical

中文文档
1.3.20261113发布于 2026/11/13CC-BY-SA-4.0TypeScriptES Module构建来源已验证近 30 天下载 4451

SQLite database of critical packages from ecosyste.ms

原始使用文档
文档目录13 节
  1. Install
  2. Download
  3. Building
  4. Development
  5. Schema
  6. packages
  7. versions
  8. advisories
  9. repo_metadata
  10. packages_fts
  11. build_info
  12. Example Queries
  13. License

@ecosyste-ms/critical

SQLite database of critical open source packages from ecosyste.ms.

The database is rebuilt daily and published to npm and as a GitHub release. Versions use MAJOR.MINOR.YYYYMMDD where major/minor track schema changes and patch is the build date.

Install

npm install @ecosyste-ms/critical

The package includes a pre-built critical-packages.db file:

import { databasePath } from "@ecosyste-ms/critical";
import { DatabaseSync } from "node:sqlite";

const db = new DatabaseSync(databasePath);
const pkg = db.prepare("SELECT * FROM packages WHERE name = ?").get("lodash");

Written in TypeScript and published with type declarations; the row shapes the build side works with (ApiPackage, ApiAdvisory, ApiRepoMetadata, BuildInfo) are exported as types.

Since 1.3.0 the package has one runtime dependency, @ecosyste-ms/ecosystems-ts, the typed client for the ecosyste.ms API. The build talks to the API through it rather than through a hand-rolled fetch layer, so retries, rate limiting and registry routing live in one place across the ecosyste.ms packages. The version is pinned exactly, since the daily job publishes unattended. Reading the bundled database still touches nothing but node:sqlite.

See ecosyste-ms/mcp for a full example.

Download

You can also grab the database directly from the releases page:

  • critical-packages.db - uncompressed SQLite
  • critical-packages.db.gz - gzip compressed

Building

To build the database yourself:

import { build, createDatabase } from "@ecosyste-ms/critical";

await build({
  dbPath: "critical-packages.db",
  fetchVersionsData: true,
  onProgress: console.log,
});

From the command line:

npx @ecosyste-ms/critical                    # full build with versions
npx @ecosyste-ms/critical --skip-versions    # faster, packages only
npx @ecosyste-ms/critical -o my-db.db        # custom output path
npx @ecosyste-ms/critical --stats            # show database statistics

Set ECOSYSTEMS_MAILTO to a contact address before a full build. The ecosyste.ms API allows anonymous callers roughly 5,000 requests an hour and a full build makes around 9,700; a build that identifies itself gets roughly 15,000. Without it most of the version fetches are rate-limited away, and build() throws rather than publish a database that lost more than 5% of its versions.

[email protected] npx @ecosyste-ms/critical

Development

npm ci
npm run build          # tsc: lib/*.ts -> dist/
npm test               # vitest, against lib/ sources -- no build needed
npm run test:packaged  # packs the tarball and tests what it ships
npm run lint           # biome check + tsc --noEmit
npm run format         # biome check --write
npm run build:db       # build critical-packages.db from the API (what the daily job runs)

The default suite runs against lib/ and needs no build step. test:packaged is separate because it builds, runs npm pack, and exercises the extracted tarball's entrypoint, export surface and bin — the checks that catch a broken exports map rather than broken logic.

The published package is plain JavaScript, so consumers stay on the Node >= 22.5.0 floor that node:sqlite sets.

Schema

packages

ColumnTypeDescription
idINTEGERPrimary key from ecosyste.ms
ecosystemTEXTPackage ecosystem (npm, pypi, rubygems, etc.)
nameTEXTPackage name
purlTEXTPackage URL (pkg:npm/lodash)
namespaceTEXTPackage namespace if applicable
descriptionTEXTPackage description
homepageTEXTProject homepage URL
repository_urlTEXTSource repository URL
licensesTEXTSPDX license identifier
normalized_licensesTEXTJSON array of normalized license identifiers
latest_versionTEXTLatest release version number
versions_countINTEGERTotal number of versions
downloadsINTEGERDownload count
downloads_periodTEXTPeriod for download count (e.g., last-month)
dependent_packages_countINTEGERNumber of packages depending on this
dependent_repos_countINTEGERNumber of repositories depending on this
first_release_atTEXTISO 8601 timestamp of first release
latest_release_atTEXTISO 8601 timestamp of latest release
last_synced_atTEXTWhen ecosyste.ms last synced this package
keywordsTEXTSpace-separated keywords for FTS

Indexes: (ecosystem, name) unique, purl, licenses, ecosystem

versions

ColumnTypeDescription
package_idINTEGERForeign key to packages
numberTEXTVersion number

Primary key: (package_id, number)

advisories

ColumnTypeDescription
idINTEGERAuto-increment primary key
package_idINTEGERForeign key to packages
uuidTEXTAdvisory UUID (GHSA-xxxx-xxxx-xxxx)
urlTEXTAdvisory URL
titleTEXTAdvisory title
descriptionTEXTAdvisory description
severityTEXTSeverity level (LOW, MODERATE, HIGH, CRITICAL)
published_atTEXTISO 8601 publish timestamp
cvss_scoreREALCVSS score

Indexes: package_id, uuid, severity, (package_id, uuid) unique

repo_metadata

ColumnTypeDescription
package_idINTEGERPrimary key, foreign key to packages
ownerTEXTRepository owner/organization
repo_nameTEXTRepository name
full_nameTEXTFull name (owner/repo)
hostTEXTHost (github.com, gitlab.com, etc.)
languageTEXTPrimary language
stargazers_countINTEGERGitHub stars
forks_countINTEGERFork count
open_issues_countINTEGEROpen issues
archivedINTEGER1 if archived, 0 otherwise
forkINTEGER1 if a fork, 0 otherwise

Indexes: full_name, owner

packages_fts

FTS5 virtual table for full-text search on ecosystem, name, description, and keywords.

build_info

ColumnTypeDescription
idINTEGERAlways 1
built_atTEXTISO 8601 build timestamp
package_countINTEGERTotal packages
version_countINTEGERTotal versions
advisory_countINTEGERTotal advisories

Example Queries

SBOM enrichment by purl:

SELECT * FROM packages WHERE purl = 'pkg:npm/lodash';

-- Check if a specific version exists
SELECT * FROM versions v
JOIN packages p ON v.package_id = p.id
WHERE p.purl = 'pkg:npm/lodash' AND v.number = '4.17.21';

Find packages with known vulnerabilities:

SELECT p.ecosystem, p.name, a.uuid, a.severity, a.title
FROM packages p
JOIN advisories a ON p.id = a.package_id
WHERE a.severity IN ('HIGH', 'CRITICAL');

License audit:

SELECT ecosystem, name, licenses
FROM packages
WHERE licenses NOT IN ('MIT', 'Apache-2.0', 'BSD-3-Clause');

Full-text search:

SELECT p.* FROM packages p
JOIN packages_fts ON p.id = packages_fts.rowid
WHERE packages_fts MATCH 'http client';

Packages by ecosystem:

SELECT * FROM packages WHERE ecosystem = 'npm';

Most depended-on packages:

SELECT ecosystem, name, dependent_packages_count
FROM packages
ORDER BY dependent_packages_count DESC
LIMIT 100;

License

CC-BY-SA-4.0

版本与发布记录

@ecosyste-ms/critical 共发布 216 个版本,首次发布于 2025/12/31;过去 12 个月发布了 216 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.3.20261113latest2026/11/13今天
1.3.202611122026/11/12今天
1.3.202611112026/11/112 天前
1.3.202611102026/11/103 天前
1.3.202611092026/11/094 天前
1.3.202611082026/11/085 天前

关于 @ecosyste-ms/critical 的常见问题

@ecosyste-ms/critical 是什么?

SQLite database of critical packages from ecosyste.ms

如何安装 @ecosyste-ms/critical?

在项目目录运行 npm install @ecosyste-ms/critical,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 critical,可以用 npx critical 直接运行。

@ecosyste-ms/critical 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ecosyste-ms/critical 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@ecosyste-ms/critical 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.5.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ecosyste-ms/critical 可以商用吗?

@ecosyste-ms/critical 使用 CC-BY-SA-4.0 许可。声明的许可为 CC-BY-SA-4.0,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@ecosyste-ms/critical 的下载量有多少?

根据 npm 官方下载统计,@ecosyste-ms/critical 在 2026/10/13 – 2026/11/11 这 30 天内被下载 4,451 次,日均约 148 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ecosyste-ms/critical 还在维护吗?

最新版本 1.3.20261113 发布于 2026/11/13(今天);至今共发布 216 个版本,其中过去 12 个月发布了 216 个;首次发布于 2025/12/31。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。