import { code_default, helperId, shouldTransform, transform, transformVueSFC } from "./chunk-RYASVNY2.mjs"; // src/index.ts import { createUnplugin } from "unplugin"; import { REGEX_NODE_MODULES, REGEX_SETUP_SFC, REGEX_SRC_FILE, REGEX_VUE_SFC, REGEX_VUE_SUB, createFilter, detectVueVersion, normalizePath } from "@vue-macros/common"; function resolveOption(options, framework) { const version = options.version || detectVueVersion(); return { include: [REGEX_SRC_FILE, REGEX_VUE_SFC, REGEX_SETUP_SFC].concat( version === 2 && framework === "webpack" ? REGEX_VUE_SUB : [] ), exclude: [REGEX_NODE_MODULES], ...options, version }; } var name = "unplugin-reactivity-transform"; var src_default = createUnplugin( (userOptions = {}, { framework }) => { const options = resolveOption(userOptions, framework); const filter = createFilter(options); return { name, enforce: "pre", resolveId(id) { if (id === helperId) return id; }, loadInclude(id) { return id === helperId; }, load(_id) { const id = normalizePath(_id); if (id === helperId) return code_default; }, transformInclude(id) { return filter(id); }, transform(code, id) { if (REGEX_VUE_SFC.test(id) || REGEX_SETUP_SFC.test(id) || framework === "webpack" && REGEX_VUE_SUB.test(id)) { return transformVueSFC(code, id); } else { if (!shouldTransform(code)) return; return transform(code, { filename: id, sourceMap: true }); } } }; } ); export { src_default };