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

@bcdesign/source-loc-vite

v0.1.4

Published

Inject source location metadata into Vue SFC elements for visual editing tools.

Downloads

318

Readme

@bcdesign/source-loc-vite

一个 Vite 插件,在开发期向 Vue SFC 元素注入源码位置元数据,方便可视化编辑工具把渲染出来的 DOM 节点映射回源文件。

<template> 中的每个元素,插件会添加:

  • data-source-loc="<相对文件路径>:<行>:<列>"

同时支持 Vue 3 和 Vue 2:用户项目根据 Vue 版本配合 @vitejs/plugin-vue@vitejs/plugin-vue2 使用;本插件内部对两种版本都使用同一套 @vue/compiler-sfc + @vue/compiler-dom 管道处理,不依赖 vue-template-compiler。注入仅在开发模式(vite serve)生效,生产构建不受影响。

安装

npm install -D @bcdesign/source-loc-vite

使用

Vue 3

// vite.config.js
import vue from '@vitejs/plugin-vue'
import sourceLoc from '@bcdesign/source-loc-vite'

export default {
  plugins: [
    sourceLoc(),
    vue(),
  ],
}

Vue 2

// vite.config.js
import vue2 from '@vitejs/plugin-vue2'
import sourceLoc from '@bcdesign/source-loc-vite'

export default {
  plugins: [
    sourceLoc(),
    vue2(),
  ],
}

本插件会通过查找 Vite 配置中是否存在 name 为 vite:vue2 的插件来自动识别 Vue 2 项目,无需额外配置。两种版本都走同一套 @vue/compiler-sfc + @vue/compiler-dom 管道。

插件以 enforce: 'pre' 运行,必须注册在 @vitejs/plugin-vue(或 @vitejs/plugin-vue2)之前,否则 template AST 的行列偏移量会不准确。

说明

  • 只处理 .vue 文件。
  • 内置标签会被跳过:templateslottransitiontransition-groupkeep-aliveteleportsuspense
  • NODE_ENV === 'production' 时插件不做任何事。