unplugin-transform-class
Version:
transform class by rule, support use in vite, rollup, webpack
33 lines (30 loc) • 767 B
JavaScript
import {
transformCode
} from "./chunk-STUCRWO5.js";
// src/index.ts
import { createFilter } from "@rollup/pluginutils";
import { createUnplugin } from "unplugin";
var unpluginFactory = (options = {}) => {
const rules = options.rules;
const filter = createFilter(
options.include || [/\.[jt]sx?$/, /\.vue$/, /\.vue\?vue/],
options.exclude || [/[\\/]node_modules[\\/]/, /[\\/]\.git[\\/]/]
);
return {
name: "unplugin-transform-class",
enforce: "pre",
transformInclude(id) {
return filter(id);
},
transform(code) {
return transformCode(code, rules);
}
};
};
var unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
var index_default = unplugin;
export {
unpluginFactory,
unplugin,
index_default
};