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

@padcom/vite-plugin-vue-sfc-transform

v0.0.5

Published

Vite plugin to transform Vue.js SFC files

Readme

Vite plugin for Vue.js SFC source manipulations

There are cases where to implement something in your code you would have to go through every single file in your project and do something to it. Some of those modifications are trivial and will stay there forever. Some are different and will change over time.

For those cases in other platforms, like Java or .NET, there is a concept of aspect-oriented programming (AOP). The idea behind it is that during compilation you get to transform the original source to either add, remove or change some of it to implement some cross-cutting concern in your system.

The best example here is the case of feature flags.

Imagine you would like to put a v-if="featureFlags.test('<feature-id-here>') in every single component. If you polute your codebase with those v-ifs you will loose clarity and readability. Some components might already have some conditional rendering and extending the expression will only make it worse.

This is where AOP comes into play.

It allows you to post-process your file, fish out those places that need to be augmented, do the augmentation and continue on with the regular compilation process as if those were the original source - just with an added concern.

Installation

To make use of this plugin you need to first install it:

npm install --save-dev @padcom/vite-plugin-vue-sfc-transform

Usage

Once the plugin is installed you need to use it in your config file:

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import transform, { type Section } from '@padcom/vite-plugin-vue-sfc-transform'

function transformer(filename: string, sections: Section[]): Section[] {
  // do something to any of those sections
  // you can also add/remove sections or completely redefine the sections

  return sections
}

export default defineConfig({
  plugins: [
    transform({
      transformer: transformer,
    }),
    vue(),
  ],
})

API

The API for this plugin is very simple and delegates most of the hard work to you. I know, it could do more, but the number of different ways you can transform sources is so vast that I won't get in your way.

Vite plugin options

You can specify the following plugin options:

transformer

This is a function that transforms sections of the component. It is given the filename (relative to project root), so that you know what you are transforming. This allows you to make different changes depending on which file you are transforming.

If not specified a noop will be used meaning no transformations take place.

includes

This is a list of files/glob patterns that will be included in the transformation. By default all .vue files in the src folder will be used (['src/**/*.vue'])

For a file to be processed it must be included and not excluded at the same time.

excludes

This is a list of files/glob patterns that will be excluded from the processing. By default all files in the node_modules are excluded (['node_modules/**/*'])

debug

This enables dumping the modified files to a folder for inspection. This isn't strictly necessary but if you find yourself wondering what the heck is going on it is a nice to have option. It is disabled by default.

debugPath

This is the root path where modified sources will be dumped for inspection. By default the path is constructed from {root}/dist and name of the transformer function (./dist/${transformer.name})