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

@qmuse/component-tagger-taro-plugin

v1.0.2

Published

QMuse JSX source tagging for Taro H5 previews

Readme

@qmuse/component-tagger-taro-plugin

在 Taro React + Vite 的 H5 预览中,为 JSX 注入 QMuse 源码定位、属性 manifest 和循环元数据,供元素选择器定位业务源码。复用 @qmuse/component-tagger-webpack-loader,不包含 Host UI、element-selector 实现或源码写回服务。

安装与接入

ut install -D @qmuse/component-tagger-taro-plugin

在 Taro config/index.ts 中接入:

import { defineConfig } from '@tarojs/cli';
import path from 'node:path';
import { taroTweakPlugin } from '@qmuse/component-tagger-taro-plugin';

export default defineConfig<'vite'>({
  framework: 'react',
  sourceRoot: 'src',
  compiler: {
    type: 'vite',
    vitePlugins: [
      taroTweakPlugin({
        projectRoot: path.resolve(__dirname, '..'),
        enabled:
          process.argv.includes('--watch') ||
          process.env.QMUSE_TWEAK_PREVIEW === 'true',
      }),
    ],
  },
});

同时满足 TARO_ENV === 'h5' 与 enabled === true 才启用。Taro 会设置 TARO_ENV;支付宝、微信等原生小程序构建返回空插件列表。不要只用 NODE_ENV 判断预览模式,Taro 的 watch 服务也可能使用 production 环境。

taroTweakPlugin() 可以直接作为 vitePlugins 数组的一项,与现有插件并列,无需 ...。内部的插件组合由 Vite 自动展平。

配置

| 选项 | 默认值 | 说明 | | ------------- | --------------- | --------------------------------------------------------------- | | enabled | false | 显式启用 H5 预览打标 | | projectRoot | process.cwd() | Taro 项目根目录,源码路径相对此目录生成 | | sourceRoot | 'src' | 相对项目根目录或绝对源码目录;自定义 Taro sourceRoot 时同步传入 |

仅处理 sourceRoot 内的 .js、.jsx、.ts、.tsx,排除 node_modules 和其他目录。Taro 将 Vite root 设为 src 时,元数据仍保留 src/pages/...,避免定位路径少一层。

打标沿用现有协议:data-source、data-source-line、data-source-column、data-pro-source、data-pro-manifest、data-pro-iter* 和组件上的 _PRO_COMPONENT_TAG_。行号从 1 开始,列号从 0 开始,指向 JSX 开始位置。

识别 @tarojs/components 的导入绑定及别名,为 View、Text、Image 等生成原生元素的 manifest,保留原始 Taro JSX 组件名。支持静态文本、常量引用、保存后的字面量和本地 import 图片。含变量或嵌套 JSX 的混合文本标为只读,避免生成无法写回的修改;内层独立文本仍可编辑,源码定位不受影响。普通 .ts 文件按 TypeScript 解析,支持尖括号类型断言。

选择运行时

本包仅负责源码打标,不注入或删除 HTML 脚本。元素选择器与通信运行时由沙箱提供;独立 demo 自行接入。

只应在可信的开发预览环境启用;带标记的 H5 产物包含业务源码路径和变量信息。打标本身不提供属性编辑、AI 请求或源码保存能力。解析失败会中断转换并暴露错误。

开发验证

已验证 Node 20、Taro 4.2.1、React 18 与 Vite 4.5。采用相邻包的 Father 构建约定,同时提供 ESM、CommonJS 和类型声明。

ut install
ut run lint
ut run typecheck
ut run test

test 会先构建发布目录,再验证包入口、打标边界、原始行列、alias/循环和真实 Vite 构建。发布前的 prepublishOnly 执行相同检查;本仓库中的源码创建或构建不会自动发布到 registry。