版博士V2.0程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

chunk-KFSUR3RT.mjs 1.1 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import {
  2. hotUpdateSetupSFC,
  3. transformSetupSFC
  4. } from "./chunk-MREUNVXY.mjs";
  5. // src/index.ts
  6. import { createUnplugin } from "unplugin";
  7. import {
  8. REGEX_SETUP_SFC,
  9. createFilter,
  10. detectVueVersion
  11. } from "@vue-macros/common";
  12. function resolveOption(options) {
  13. const version = options.version || detectVueVersion();
  14. return {
  15. include: [REGEX_SETUP_SFC],
  16. ...options,
  17. version
  18. };
  19. }
  20. var name = "unplugin-vue-setup-sfc";
  21. var src_default = createUnplugin(
  22. (userOptions = {}) => {
  23. const options = resolveOption(userOptions);
  24. const filter = createFilter(options);
  25. return {
  26. name,
  27. enforce: "pre",
  28. transformInclude(id) {
  29. return filter(id);
  30. },
  31. transform(code, id) {
  32. return transformSetupSFC(code, id);
  33. },
  34. vite: {
  35. config() {
  36. return {
  37. esbuild: {
  38. exclude: options.include,
  39. include: options.exclude
  40. }
  41. };
  42. },
  43. handleHotUpdate: (ctx) => {
  44. if (filter(ctx.file)) {
  45. return hotUpdateSetupSFC(ctx, filter);
  46. }
  47. }
  48. }
  49. };
  50. }
  51. );
  52. export {
  53. src_default
  54. };