|
- import {
- hotUpdateSetupSFC,
- transformSetupSFC
- } from "./chunk-MREUNVXY.mjs";
-
- // src/index.ts
- import { createUnplugin } from "unplugin";
- import {
- REGEX_SETUP_SFC,
- createFilter,
- detectVueVersion
- } from "@vue-macros/common";
- function resolveOption(options) {
- const version = options.version || detectVueVersion();
- return {
- include: [REGEX_SETUP_SFC],
- ...options,
- version
- };
- }
- var name = "unplugin-vue-setup-sfc";
- var src_default = createUnplugin(
- (userOptions = {}) => {
- const options = resolveOption(userOptions);
- const filter = createFilter(options);
- return {
- name,
- enforce: "pre",
- transformInclude(id) {
- return filter(id);
- },
- transform(code, id) {
- return transformSetupSFC(code, id);
- },
- vite: {
- config() {
- return {
- esbuild: {
- exclude: options.include,
- include: options.exclude
- }
- };
- },
- handleHotUpdate: (ctx) => {
- if (filter(ctx.file)) {
- return hotUpdateSetupSFC(ctx, filter);
- }
- }
- }
- };
- }
- );
-
- export {
- src_default
- };
|