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

@agent-anvil-platform/build-tools

v0.7.2

Published

agent-anvil Platform 插件前端构建期工具集:vite 插件、plugin.yaml 校验(ajv)、产物契约检查

Readme

@agent-anvil-platform/build-tools

agent-anvil Platform 插件前端的构建期工具集(仅 devDependency,不进入运行期产物)。

安装

npm i -D @agent-anvil-platform/build-tools

仓库内开发无需安装:本包是 agent-anvil-frontend 的 npm workspace 成员, npm install 后 node_modules/@agent-anvil-platform/build-tools 会软链到 packages/build-tools 源码目录。

⚠️ CI 顺序约束:8 个插件前端以 "@agent-anvil-platform/build-tools": "^2.0.0" 声明依赖。 在仓库外独立构建插件时,必须先把本包发布到 registry,否则 npm install 无法解析。

导出内容

| 导出 | 用途 | |---|---| | createPluginViteConfig() | 插件前端多入口打包配置工厂,统一 external / 产物命名 / 目录约定 | | extractMetadata() | vite 插件,构建期扫描组件并产出 v2 前端元数据 | | collectComponentEntries() / collectDomainComponentEntries() | 组件入口扫描纯函数(单域 / 多域) | | aggregateFrontendMeta() | 元数据聚合纯函数 | | validateFrontendMeta() / assertValidFrontendMeta() | 基于 ajv 的 schema 校验 | | extractFileMeta() / collectExportedNames() 等 | 抽取器纯函数,供单测与脚本复用 | | 类型 | FrontendMetaV2、ComponentMetaV2、PluginDomainSource、PropMeta 等 |

典型用法(单域插件前端 vite.config.ts):

import { createPluginViteConfig } from '@agent-anvil-platform/build-tools';

export default createPluginViteConfig({ pluginName: 'user-mgmt' });

多域用法(system-suite 套件前端,v2.1 新增):

import { createPluginViteConfig } from '@agent-anvil-platform/build-tools';

export default createPluginViteConfig({
  pluginName: 'system-suite',
  domains: [
    { name: 'user-mgmt' },
    { name: 'file-mgmt' },
    { name: 'dict-mgmt' },
    // …
  ],
});
  • 组件源目录:src/domains/<域名>/<componentDir>/*.tsx(支持 src/domains/<域>/component/Xxx/index.tsx 目录布局);
  • 产物仍扁平输出:dist/component/{Name}.js(ComponentMetaV2.module 契约不变);
  • 跨域组件重名会在构建期显式报错(产物扁平契约要求组件名全局唯一);
  • 不传 domains 时行为与 v2.0 完全一致(只扫 src/<componentDir>/),存量 8 个插件零改动。

构建

npm run build      # tsc 编译 + copy-assets 搬运 src/schema/*.json 到 dist/schema/
npm run typecheck  # 仅类型检查
npm test           # 回到仓库根跑 jest packages/build-tools

validate 在运行期按文件路径读取 dist/schema/*.json(单一事实源), 因此本包不声明 exports 字段,避免限制子路径访问导致 schema 解析失败。

发布

npm version <patch|minor|major>
npm publish          # prepublishOnly 自动执行 build;registry 取 publishConfig