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

@qubit-ltd/vite-plugin-vue-sfc-decorators

v1.0.1

Published

A small vite plugin to patch Vue SFC <script> to support decorators syntax.

Readme

@qubit-ltd/vite-plugin-vue-sfc-decorators

npm package License English Document CircleCI

vite-plugin-vue-sfc-decorators 是一个小型 Vite 插件,用于修补内部 vite:vue 插件的选项,使 Vue 单文件组件(SFC)的 <script> 块能够解析装饰器语法(例如 @Component)。它会从 Vue 插件的 Babel 解析器配置中移除已有的 decorators / decorators-legacyclassProperties 项,并用你指定的选项替换。 适用于需要在 Vue SFC 中统一支持装饰器的 monorepo 或 npm 包。

安装

可使用 npm 安装:

npm install --save-dev @qubit-ltd/vite-plugin-vue-sfc-decorators

或使用 yarn

yarn add --dev @qubit-ltd/vite-plugin-vue-sfc-decorators

使用方法

Vite 配置中引入并添加该插件。插件在 configResolved 阶段执行并修补 vite:vue 插件,因此只要 项目中存在 @vitejs/plugin-vue,插件顺序无关紧要。

import vue from '@vitejs/plugin-vue';
import vueSfcDecoratorsPlugin from '@qubit-ltd/vite-plugin-vue-sfc-decorators';

export default {
  plugins: [
    vue(),
    vueSfcDecoratorsPlugin({ decoratorsVersion: '2023-11' }),
  ],
};

配置选项

在创建插件时传入选项。可用选项及默认值如下:

| 选项 | 类型 | 默认值 | 说明 | |--------------------------|-----------|--------------|------------------------------------------------------------------------------| | decoratorsVersion | string | '2023-11' | 传给 Babel 解析器的装饰器提案版本(如 '2023-11''2018-09')。 | | includeClassProperties | boolean | true | 是否添加 classProperties 解析器插件(与装饰器一起使用时通常需要)。 |

与 Vue 和 Babel 一起使用示例

若使用 Babel(例如 @qubit-ltd/vite-plugin-babel)做转译,可通过本插件在 Vue SFC 的 script 解析器中启用装饰器,并在 Babel 中配置对应的装饰器/类属性插件:

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import vueSfcDecoratorsPlugin from '@qubit-ltd/vite-plugin-vue-sfc-decorators';
import babel from '@qubit-ltd/vite-plugin-babel';

export default defineConfig({
  plugins: [
    vue(),
    vueSfcDecoratorsPlugin({ decoratorsVersion: '2023-11' }),
    babel({
      config: {
        presets: [['@babel/preset-env', { modules: false }]],
        plugins: [
          '@babel/plugin-transform-runtime',
          ['@babel/plugin-proposal-decorators', { version: '2023-11' }],
          '@babel/plugin-transform-class-properties',
        ],
      },
    }),
  ],
});

贡献

如有问题或建议,欢迎在 GitHub 仓库 提交 issue 或 pull request。

许可

本插件采用 Apache 2.0 许可证。详见 LICENSE 文件。