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

@actview/plugin-babel

v2.2.0

Published

共享 Babel 宿主壳(排除规则/transformSync 参数统一,供 @actview/plugin-vite 与 @actview/plugin-scoped 复用)

Readme

@actview/plugin-babel

共享 Babel 宿主壳 —— 统一 transformSync 调用参数与排除规则,供 @actview/plugin-vite 与 @actview/plugin-scoped 复用。

(v1 的 defineComponentPlugin / solidPlugin 已随 ActView v2 移除——v2 的 JSX 编译由 @actview/plugin-jsx 承担。)

核心功能

  • 统一参数:parserOpts(jsx+typescript) / retainLines / sourceMaps / babelrc:false / configFile:false
  • 排除规则:node_modules 硬排除(include 不可覆盖)/ include 白名单 / exclude 黑名单
  • 性能:createBabelTransform 模块级创建一次 ConfigItem(Babel 8 同步),跨多次 transformSync 复用

安装

pnpm add -D @actview/plugin-babel

API

| 导出 | 说明 | |---|---| | createBabelTransform(plugin, options?) | 宿主壳工厂:模块级创建一次 ConfigItem,返回 (code, filename) => { code, map } \| null | | createBabelItem(plugin) | 把插件工厂预编译为 ConfigItem(Babel 8 同步) | | transformWithBabel(code, filename, pluginItem, options?) | 统一参数的 transformSync | | isExcludedTransform(filename, options?) | 排除判定:node_modules 硬排除 / 未命中 include / 命中 exclude | | 类型:BabelPlugin / BabelHostResult / BabelTransformOptions | 宿主壳类型 |

排除规则(node_modules 硬排除)

宿主壳硬排除 node_modules 下的文件(返回 null 不转换):依赖是第三方代码,属依赖管线(esbuild 预构建),不是源码管线。BabelTransformOptions:

{
  include?: Array<string | RegExp>,  // 白名单:命中任一才转换(默认不过滤;node_modules 硬排除优先)
  exclude?: Array<string | RegExp>,  // 黑名单:命中任一即跳过(优先于 include)
}

源码分发库包(node_modules 下)需要现场编译时,在宿主构建配置里做路径转换,让文件解析路径脱离 node_modules 段:

// vite.config.ts
resolve: {
  alias: { 'my-lib': 'node_modules/my-lib/src' }, // 路径不再含 node_modules 段 → 正常转换
},
optimizeDeps: { exclude: ['my-lib'] },

依赖关系

  • @babel/core(^8)
  • 被依赖方:@actview/plugin-vite、@actview/plugin-scoped(复用宿主壳)

开发

pnpm build   # tsup 打包 dist
pnpm test    # vitest(test/babel-host.test.ts:排除规则/宿主壳行为)

License

MIT