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

@dshfly/mobile-plugin-schema

v0.1.0

Published

DSH 移动端插件规范 v0.1:manifest JSON Schema(单一事实源)+ 两级校验 + validate-mobile CLI

Readme

@dshfly/mobile-plugin-schema

DSH 移动端插件规范 v0.1 的校验实现:manifest JSON Schema(单一事实源)+ 两级校验 + CLI。 规范正文见 docs/mobile-plugin-spec.md(§3 manifest / §3.3 两级规则 / §9 校验 CLI)。

两级校验(spec §3.3)

| 级别 | 规则 | 结果 | |---|---|---| | 结构校验 | 必填缺失、类型/正则不符、未知顶层字段 | error → 插件不可见 | | 值校验 | capabilities/permissions/icon 未知枚举值、重复项 | warning → 忽略该项,插件可见 |

单一事实源原则:校验由 src/validator.js 的迷你 draft-07 解释器驱动 schema JSON(schemas/mobile-manifest.v1.schema.json),不复制字段规则。schema 若出现解释器未实现的关键字,校验直接抛错(fail-loud),绝不静默漏校验。

用法

# CLI(退出码:0 有效 / 1 结构无效 / 2 非移动端插件或用法错误)
node packages/mobile-plugin-schema/bin/dshfly.js validate-mobile <pkg-dir>
node packages/mobile-plugin-schema/bin/dshfly.js validate-mobile <pkg-dir> --json   # CI 用

# 作为库
import { validateMobileManifest, validateMobileManifestFile, KNOWN_CAPABILITIES } from '@dshfly/mobile-plugin-schema';

--json 输出(单行,供 CI 解析):

{"found":true,"ok":false,"errors":[{"path":"#/name","message":"缺少必填字段"}],"warnings":[]}

目录

schemas/mobile-manifest.v1.schema.json   # v1 manifest schema(单一事实源)
src/known-values.js                      # v1 已知枚举(capabilities/permissions/icons)
src/validator.js                         # 迷你 draft-07 解释器(fail-loud 守卫)
src/validate.js                          # 两级校验 + package.json 读取
bin/dshfly.js                            # CLI(当前子命令:validate-mobile)

演进规则

  • 新增枚举值(能力/权限/图标)→ 只改 src/known-values.js(+ 规范文档)。
  • 新增 schema 关键字 → 先在 src/validator.js 实现,否则校验抛错。
  • 新增 schema 版本 → 新增 schemas/mobile-manifest.vN.schema.json,保持 v1 兼容(spec §8 兼容矩阵)。

测试

pnpm --filter @dshfly/mobile-plugin-schema test